New Stuff

Worship Tech Web Tools Blog

4192093_illustration.gifThis is an ongoing blog of web tools and technology related to worship, music and church. The idea is to give you good web points and resources that you can go to. Some of it is just me cruising the net, others are favorites of friends.

Enjoy what you see here.  If you find an interesting, useful and technology related site or resource that deals with helping worship or musicians in general, please send us a note and we will check it out. Perhaps we can feature it here.

Thanks!

Enjoy! - Kim Gentes

Entries in patterns (2)

Internet, Music and Math: How to Waste Time With Three Fun Things (Kim Gentes / Worship Tech Blog)

Remember the promises of science fiction? Well, things haven't turned out quite the way the Jetsons promised us. When they said "Flying cars, robotic servants, instant meals", we didn't know they meant "Southwest Airlines, automated sales calls to our cell phones, and McDonald's happy meals".  But who's to blame? Well certainly not Batuhan Bozkurt.

Batuhan is a "sound artist" and programmer living in Istanbul, Turkey.  And he has done his part in bringing forth the joyous reality of that fantasy of almost all great science fiction- the fusion of technology and art. But is it that hoped-for utopia where ones own thoughts of melodies were enough for mind-reading computers to generate the symphonic masterpeices of the future?  Mr. Bozkurt doesn't promise such glorious realities, but he takes the needed baby-steps for our neophite, web-connected world. He calls it Otomata.

Quite simply, Otomata, is a sound generation web application. It generates tones based on a 9x9 grid which contains any number of bouncing boxes. You start with a blank grid. You add your boxes. You click play. The fun begins.

This might seem trivial (and it is), but Otomata is based on the same rules of operation that most iOS apps and even the first video game (Pong) held to- collision and redirection.  The boxes you place on the grid all move, in any of the 4 directions you instruct them to. When they hit another  box or a wall they alter direction. When they hit a wall, they emit a sound. The grid is set up in a specific musical configuration so that notes ascend a scale from left to right. You get the idea quickly. You develop patterns that create sound loops for basic rhythm and meter. Add some melodic chaos notes (boxes) to overlay said patterns of rhythm.

But the more complex you make them, the less sure you are of a clean results, or one that sounds musical (instead of an explosion of computer sounding blurps).

But enough talk. Try it out! Otomata is online, for all to try (apparantly, phone apps are in the works as well). You can go here and get started:

http://www.earslap.com/projectslab/otomata

Now for the really cool part. Once you develop an interesting pattern on Otomata, click the "Copy piece link" and you have the URL to your musical/web/grid configuration. Share it with your friends, build on each other's patterns. All very fun, time wasting and addictive.  Real musos will initially bauk at this trivial tool, but finding the patterns is the key. Don't waste your time just throwing blocks on the board (at least don't keep doing it after 30 minutes or so). If you just do that, of course, you will be bored. Instead, start to develop a library of patterns that you can re-use for your bass end, your mid-chords and your high end rhythms.  Then, start to mix and match and see what happens.

The app is online for anyone who has a web browser. Oh, a real web browser I mean- this one is in Flash, so you can't play it on iPads or iPhones (at least until they add Flash).  However, the folks who wrote this online application have a great new port for the iOS devices and you can also download an app for your iPhone/iPod/iPad as well to take Otomata mobile.

Here are a couple patterns I worked on that I use as a base for more "compositions". Real music? Hmmm.. maybe not. But inventive, thoughtful, and certainly musical fun. You decide.

http://www.earslap.com/projectslab/otomata?q=4g3k5z4x0d0v7n7a8d8v

http://www.earslap.com/projectslab/otomata?q=3n4n5n3a4a5a8j0q177r

http://www.earslap.com/projectslab/otomata?q=3n4n5n3a4a5a8j0q

 

It's a fun time waster.. and your pattern recognition skills may just improve along the way!

Thanks Otomata! Thanks Batuhan Bozkurt!

 

Let's go people---

Go forth and blipify! 

Kim Gentes

 

 

Regular Expressions Except a Given String - Negative Patterns (Kim Gentes Worship & Tech Blog)

Occasionally, I use this column in technology and worship tech to put some tips out there on the technical side of things.  Today is such a day.  This is another Regular Expression segment that might help someone.

The goal of much software is to find things.  A way to find stuff in computer languages is a sub-language called "Regular Expressions".  Most regular expressions deal with finding specific instances of data inside of a larger string. When looking for those instances of data, we often use "patterns" to match what we intend to look for with the data we are looking through to find our desired information.  Those patterns often indicate what we are looking for, as in ".*Kim.*" (without the quotes) is a regex pattern that would look for my first name inside of any string.  Any string that contained my name would match that pattern.

But in real life, we don't always know what we are looking for in a positive fashion.  Sometimes we are looking for things simply because they AREN'T something else.  Let's go back to my name, Kim.  If I want to create a regex pattern that would match every string that did NOT contain my name, regex has a way to do that as well.  It is called "negative lookaround".  There are two types of negative lookaround- "negative lookahead" and "negative lookbehind".  One is for looking forward into a string, the other is for looking past the current position we are at in a string.  For simplicity sake, lets simply look forward, since that will be the most obvious case.

So let me clarify- what we want to do is write a pattern that will find every string that does NOT contain my name, Kim.  Ok, here you go:

^(?:(?!Kim).)*$

The core of the "negativeness" of this expression is (?!Kim), which simply says match the next thing forward that doesn't equal exactly "Kim".  The rest of the expression allows us to capture the entire string, from start to end. And if all you are doing is trying to make sure that you match a string that doesn't contain a specific pattern, then you are good.

However, sometimes what you are actually looking for is to find any part of any string that does not contain the negative pattern (the name for a pattern that finds a string avoiding a specific pattern).  In other words, what you want to do, is look through and extract all the data from any string, except avoid the data from the negative pattern.  This is actually a little more complicated, but here is one option:

^(((?:(?! Kim).)*)|((.*)Kim(.*)))$

This pattern will find lines of data that contain nothing to do with Kim, and it will capture data that is on a line with Kim (but can programmatically ignore Kim itself).  But in order for this to work, you must actually use what is called captured groups. Regex programmers will understand this as the chunks of identified data that matched groups in their expression.  A group in a regex expression is formed each time you use a pair of parenthesis.  Using numbered groups, you can get just the information you intended. In the above case, you will need a little user code to get the right data out.  So, in PHP, you would have the following code using the above pattern:

if (preg_match('/^(((?:(?!Kim).)*)|((.*)Kim(.*)))$/im', $rawstring, $regexps)) {
  $clean_line= $regexps[2];
  $clean_before_patt= $regexps[4];
  $clean_after_patt= $regexps[5];
} else {
  //failure
}

What you end up with is 3 variables as you parse through your strings. The variable "$clean_line" will contain the string that matches data that has no "Kim" in it at all.  The variable "$clean_before_patt" will contain the portion of a string which preceeds the the word "Kim". The variable "$clean_after_patt" will contain the portion of a string which follows the the word "Kim".  Simply evaluate the values off of those variables to determine what you want to use as you search through your strings.

Of course, you would replace "Kim" with whatever pattern you DON'T want to find in your strings.

Also, my examples use both matching ^ and $ at lines breaks and search case insensitive (on the PHP preg_match).  If you want to search case sensitive simply remove the "i" flag on the preg_match pattern. Similarly, if you don't want ^ and $ to match at lines breaks, just remove the "m" flag in the same preg_match situation (your use and regex engine may have its own flavor on both these flags). 

God bless, and happy coding

Kim Gentes

 

*YOU ARE FREE to use this algorithm in any application (commercial or personal or whatever). It comes with no warrantees.  If you DO end up using this REGEX pattern, I ask (but don't require) that you please do so with the following considerations:

  • Please make this notation in your source code:  ©2008 Kim Anthony Gentes - FREE TO USE ANYWHERE.
  • Please post a response on this blog entry below (you do that by clicking on the "Comments" link at the bottom of this entry), saying you found this and are using it. I'd just like to know if its helping people and how people are using it.

When using the regex, some important things to know:

Options (turned on in your language/utility): ^ and $ match at line breaks