Recent News

Creating small size ring tones

Posted by Root on February 28th, 2008

When you are in the business of selling ring tones there are certain elements that make it difficult to ensure 100% content delivery and with the added pressures to use DRM. The main issue which we will be looking at in this post will be the size issue, There are various ways to try and reduce the size of your ring tone to allow for easy downloading for instance changing the bit-rate , changing the format(encoding) or just shorting the ring tone length. All the methods I just mentioned work but at a compromise to the quality or length of the ring tone. My solution is no different at all to the suggestions above but at least the quality will still be decent for the phone and the length will still be a full track.

Most ring tones in the market are of mp3 quality(true tone) but it is not easy to download a full track mp3 song on the mobile phone yet, The technology is getting better but it is still very much unstable. An alternative to the mp3 download is to use amr encoding which offers good quality at a small file size, It is not cd quality but it is still decent for the mobile phone. You can offer this as alternative download option to your already mp3 or wma ring tone formats.

With amr you can lower the file size e.g. 3 mega bytes full track(mp3) to 500 kilo bytes full track (amr). The only thing you might have to be careful about would be to check if the particular mobile phone does support amr format first before giving it the file because this can cause problems for you with users complaining about downloads not working. If you do not know how to perform checks on the phone – I would suggest you read my other previous post about achieving this feature – detecting mobile devices on your website .

Lets start converting.
Please Note: This post assumes you have Ffmpeg installed and configured on your machine,if you do not know what I mean please read the Ffmpeg section on the site.

/user/bin/ffmpeg -y -i ring.mp3 -ac 1 -ab 12.2k -ar 8000 -f amr -acodec libamr_nb ring.amr

That is all it takes to get the amr conversion working, you might want to play around with these options -ac 1 -ab 12.2k -ar 8000
until you find the right quality and size for you. Please read about the amr options available for use with Ffmpeg and what values can be or cannot be changed.

That’s it folks, I will try to cover the DRM section next time for those who do not know how to use it.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Tags: , , ,

Detecting mobile devices on your website

Posted by Root on February 26th, 2008

The purpose of this post is to introduce the concept of detecting mobile devices on your website using an open source library called wurfl, The library can be deployed using the following programming languages:

  1. 1C++
  2. Dot Net
  3. Java
  4. Perl
  5. Python
  6. PHP
  7. Ruby

I will be using PHP for all the examples on this post, So I hope you have a little understanding of PHP to go through some of the example code.

Requirements for this Exercise:

  • At least 50 mega bytes of storage(for the wurfl files to be generated).

Step 1:This step can be set up in different ways, It all depends on how you want to use wurfl on your project, I personally use it on more than one project. To avoid creating a wurfl installation for all my projects I have had to set up a global wurfl installation on my web server which allows all my projects to use one wurfl instance.

create wurfl global

go to /www and create a folder called /www/global and inside global create another directory called /www/global/wurfl. We need to create one last directory inside our /www/global/wurfl/ directory which we are going to call /www/global/wurfl/data, Before we close this step please make sure that your directory /www/global/wurfl/data is writeable

chmod 0777 /www/global/wurfl/data

NB chmod 0777 is not recommended on a production server and one must be careful when granting write permission to files. For the sake of the demonstration we will ignore this rule though.

Your directory structure should look like this: /www/global/wurfl/data

Step 2:
Go to wurfl download page and get the PHP files and store them inside /www/global/wurfl directory http://wurfl.sourceforge.net/php/index.php
you need to also download the http://wurfl.sourceforge.net/wurfl.xml(7mb) which contains all the information about the different types of phones in the market. This file is updated constantly and you need to update it on your side regularly. This file must be copied to /www/global/wurfl/data/wurfl.xml

Step 3:
After you uncompress the downloaded PHP files you should have these following files available:1.

  1. check_wurfl.php
  2. update_cache.php
  3. wurfl_class.php
  4. wurfl_config.php
  5. wurfl_parser.php
  6. readme.txt

Step 4:

Now lets configure our library by opening /www/global/wurfl/wurfl_config.php
lets change the config file as shown below.

Line 90:
NB: Make path absolute

// Where all data is stored (wurfl.xml, cache file, logs, etc) define(“DATADIR”, ‘/www/global/wurfl/data/’);

Line 93:
// Path and filename of wurfl_parser.php define(“WURFL_PARSER_FILE”, ‘/www/global/wurfl/wurfl_parser.php’);

Line 96:
// Path and filename of wurfl_class.php define(“WURFL_CLASS_FILE”, ‘/www/global/wurfl/wurfl_class.php’);

That will do for now. If you are interested in some of the configuration settings on this file you can consult the documentation for the library.

Step 5:
We now need to run /www/global/wurfl/update_cache.php on the console which will create a folder called /global/wurfl/data/multicache that has a lot of files inside of it.

/usr/bin/php -f /www/global/wurfl/update_cache.php

After you run the command it will create the folder mentioned above and a file called /www/global/wurfl/data/cache.php. This command will take a while to execute depending on your machine but will take between 30 to 60 seconds to execute. My /www/global/wurfl/data directory’s size is now 37 mega bytes.

Step 6:
Lets write a little test code which determines if the device on our site is a mobile device and if so we can then redirect the device to the mobile version of our site.


Just like that we now have a script that can tell us whether the user is using a computer web browser or phone browser. If the phone is picked up by our script $myDevice->brand = nokia will carry the phone brand while $myDevice->model = N70. But Please remember that this method is not 100% accurate and also keeping an updated version of /www/global/wurfl/data/wurfl.xml will increase the accuracy rate.

$wurfl_class->capabilities holds an array of the device’s capabilities e.g.
can the device support gif images?

Please try and explore the documentation for the library and you will find all sorts of features. For the sake of keeping this post small I will not show any more examples but rather encourage you to read up a bit on this beautiful library. I hope you find this post useful and you get to do magical stuff with this library , Feel free to leave a comment.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Tags: , , ,

Recent Comments | Recent Posts


designed by: Website Builder | Coded by: Blog Directory | Provided by: Wedding photojournalism chicago
bottom