Apple has crippled the iPhone to not allow normal music files as ringtones. Business decision. Technically any sub 40 second MP4 audio file will do once you rename it to
*.m4r and drag-and-drop it to the ringtones folder of your phone in iTunes. Longer ones will work, too. But you'd need a jailbroken iPhone for that as iTunes will refuse to transfer the ringtone file if it's too long. Not much of an issue imho, who keeps ringing your phone for 40 seconds or more?
There's a gazillion websites available telling you how to convert a single .mp3-file to a ringtone with or without iTunes help and there are hundreds of tools doing that for you if you can't find out how to do it with just iTunes itself. Still the ones I tried failed for me as I wanted to convert my 20 or so standard ringtones from the good old Motorola K3 to iPhone ringtones all in one go. Without having to edit each one by hand. They are already nice ringtones and have served me well for years, just too long for the iPhone and in .mp3 format.
The basic processing sequence needed is
- Cut the .mp3 down to 39s
- Convert the .mp3 -> .wav (with mplayer, normalize output gain while we're at it)
- Convert the .wav -> .mp4 (with facc)
- Clean up, GOTO 1 for next file
So below is the free shell script to create multiple ringtones in one go on any Linux system. You need to install cutmp3, mplayer and faac for it, so
apt-get install cutmp3 mplayer faac on Debian or Ubuntu. cutmp3 is currently not in the portage tree for Gentoo, but you can download an ebuild from Polynomial-C's overlay (mirror). Or you just download the cutmp3 binary from Jochen Puchalla's homepage. There's no error checking in the script, so know your way around the shell before running it.
Without further ado:
# convert_to_ringtone file1.mp3 [file2.mp3, ...]
# Placed into the public domain by Daniel Lange, 2011.
echo "Processing $arg..."
cutmp3 -c -a 0:0.0 -b 0:39.0 -i "$arg" -O "$arg.tmp"
mplayer -vo null -vc null -af volnorm -ao pcm:fast:file=tmpfile.wav "$arg.tmp"
faac -b 128 -c 44100 -w tmpfile.wav
name=`echo $arg| sed 's/.mp3//g'| sed 's/ /_/g'`
mv tmpfile.m4a $name.m4r
echo "$arg done."
23.12.14 Apparently the faac package in Debian and Ubuntu has had the MP4 writing capability removed in v1.28-5 and later due to a minor license incompatibility. See the Debian Changelogs. Duh.
faac (1.28-5) unstable; urgency=low [ Andres Mejia ] * Disable mp4v2 support. This only disables mp4v2 for the faac utility program. The faac utility is GPL-2 but the mp4v2 library is MPL-1.1. The two licenses are incompatible with each other.
So ... unfortunately you have to built faac from source yourself or pin the v1.28-4 version which is identical except for the castration anyways.
Random distro dev: "Why oh why doesn't my distro ever head mainstream...?"
Hint: Because of stuff like this.