The making of a ringtone generator
Sunday, June 7th, 2009**Note, before you read this scroll down and click the ‘preview’ button to pause the application while you read this article. The preview button is located to the right of the pan & volume.
In late 2008 Coca-Cola asked Juxt to create a ringtone generator for their Sprite brand. The concept was fairly fairly straight forward, create an engaging rich media campaign for Sprite that would supplement and drive additional traffic to their under the cap program. The under the cap program gives participants a digital prize on their mobile phone every time they text a cap code found under the cap of a 20 oz Sprite.
The rich media unit allowed visitors to mix custom samples to create a ringtone which then could be sent to their mobile phone. The mechanism for delivery of the ringtone was sending a text message with a unique code to 77483 [Sprite's short code]. The unique code was determined by the selection and pattern of samples chosen in the mixer.
So far so good, four samples (drums, bass, lead, and synth) and four measures the only piece missing is a creative mind to mix yourself a ringtone. This is where things get both complicated and interesting. Due to the hosting environment infrastructure and mobile messaging platform we were unable to create ringtones on demand in real-time. Instead we were require to create all possible combination of ringtones in advance. Using a 4×4 grid of samples and measures we are left with 65,536 possible combination’s but one option is complete silence so our magic number is 65,535 distinct ringtone possibilities.
We tried a wide variety of different software applications to sequence audio tracks to generate our 65,535 ringones. However, after much research we determined that each piece of software resulted in poor results. For the most part, desktop applications weren’t able to process the sheer bulk size of the files we were trying to sequence. It became evident that this wasn’t going to be an easy task. Eventually I found a audio conversion application for linux called the Swiss Army knife of sound processing (SOX). After trial and error and a make shift syntax manual I was able to join four samples (drums, bass, synth, lead) so they all played at the same time. Success. Well, not quite success but progress.
Having a solution to merge audio tracks was comforting, but there was still a few more hurdles. Mainly, how do I go from creating one combination to over sixty-five thousand, and how would I generate a code that could easily be interpreted by the Flash mixing interface so the right SMS code could be generated? Since SOX is a linux tool it made sense to create a script to write an application to sequence the ringtones. PHP was an obvious candidate, its available, easy to write, and very robust. I am going to spare the details of the contents of the script, but I can tell you that it used bit arrays, translation, loops, and math. As I mentioned previously matching the code to a specific ringtone is extremely important. If you are in the industry you are aware that banners and rich media units have file size requirements. In our case the flash mixer needed to be less than 100k. The design and functionality already left us at nearly 100k which meant we didn’t have room for logic in the application and we could not load a mapping into the flash application via XML because the file size would be ~5MB which would kill the experience.
Regardless, we found a pattern relying on hex that allowed us to use a simple naming scheme that the mixer could understand with very little logic. Then we modified the naming convention slightly to make sure we didn’t generate any codes that matched data in the 18,000 row document explaining how to spell vulgar or inappropriate terms using your keypad. After generating 65,535 ringtones in a number of formats we put them on a terabyte drive sent them to an unnamed country in Europe and the rest is history, run through the MTV or VHS properties to find the ringtone mixer and get yourself a new ringtone.



Recent Comments
SureshReddy Lakshmi wrote:
SELECT column FROM tableORDER BY RAND()
Jef wrote:
haha. I had just begun my...
Rob White wrote:
I need to post mine. My...