Roland's homepage

My random knot in the Web

Making ringtones with free software tools

Most smartphones come with a range of ringtones.

But if you don’t like those, you can make them yourself from music that you are allowed to use.

All software that is used here is free software. They should work on all recent UNIX-like operating systems. In my case, I installed all of these programs using the FreeBSD ports system.

Workflow

The workflow is as follows;

  • Extract a clip from the source in WAV format.
  • Add fade-in and fade-out if you want.
  • If necessary, normalize it.
  • Convert it to MP3 format.
  • Upload the MP3 files to your phone.

Extracting music

For extracting audio from most music or video formats, we use the Swiss army knife of multimedia, ffmpeg. This should work with all formats that ffmpeg supports. Use ffmpeg -codecs to get a list of them.

Extracting WAV data from a video or audio file is shown below.

ffmpeg -ss 00:00:28 -to 00:00:57 \
-i music/fanfare_for_the_common_man.webm \
-af "afade=t=in:st=0:d=2,afade=t=out:st=27:d=2" \
-c:a pcm_s16le -vn ffcm.wav

The -ss and -to parameters indicate the start and end time for the clip in HH:MM:SS format. Note that these options should be in front of the input file option.

The -af option contains a set of two audio filters:

  • Fade in (afade=t=in) starting at the beginning (st=0) and lasting two seconds (d=2).
  • Fade out (afade=t=out) starting at 57-28-2=27 seconds (st=27) and lasting two seconds (d=2).

Using the -c:a pcm_s16le option we indicate that the output should be signed little-endian 16-bit PCM samples. This is the common format for generating MP3’s from. The -vn option disables video output.

For converting module or midi files to WAV, we use timidity++.

timidity -G 0-15 elysium.mod -Ow -o elysium.wav

The -G option marks the start and end of the clip. The -Ow options sets the output format to WAV format.

Normalizing

For ringtones it is generally desirable to have them at a standard volume level. The normalize program is used to adjust the volume of the WAV files.

Often it is sufficient to let this program do its thing without arguments.

normalize ringtone.wav

If necessary you can use the -a option to adjust the amplitude.

normalize -a 0.5 ffcm.wav

Conversion to MP3 format

For this we use lame.

lame --tt "Elysium" --ta "Jester" elysium.mod.wav elysium.mp3

Uploading to your phone

For my smartphone that uses Android, I use android-file-transfer after connecting the phone to my PC with a USB cable. The MP3 files should go into the folder Ringtones, and then they can be used.

Iphones generally only want to talk to the eldritch horror that is itunes. Which of course doesn’t run on free operating systems. You might try the software from libimobiledevice on your favorite free OS.


For comments, please send me an e-mail.


Related articles


←  Opening vim in a new terminal Add TeX macro around (visual) selections in Vim  →