Now that I have upgraded my phone to the Windows Phone 7.1 Developers’ Preview, one of the features I’ve been anxious to try out is Custom Ringtones – the default tones and the ones provided by AT&T are “interesting”, but they’re just not “me.” Windows Phone 7.1 (AKA Mango) supports custom ringtones – but how do you go about making that happen?
IMPORTANT – The information below is based on Windows Phone 7.1 (AKA Mango) Beta 2, with a phone and the related Zune software upgraded to use the Developer Preview.
The available ringtones on the phone are segmented into groups which can be seen by going to Settings / Ringtones + Sounds and/or Contact / Edit / Ringtone (the latter location is used to override the default ringtone and set a per-contact ringtone.) The default collection of ringtones that are included by the phone OS, those provided by the carrier, and any custom ringtones installed by the user. Custom and OEM-provided ringtones can be deleted (for pruning the available ringtone list) whereas the ringtones included with the Phone OS cannot.
Custom ringtones are audio files that are “registered” with the phone OS in a certain way – more on this in a moment. However, in order to be registered, an audio file must meet the following criteria:
- It must be either a WMA or an MP3 file
- It must be 39 seconds or shorter in length
- It must be smaller than 1MB in size
- It cannot be copy protected / have DRM restrictions
Creating Custom Ringtone Files
So what do you need to create a custom ringtone file that fits this criteria? While there are several tools that can be used, I’ll highlight 2 here – Expression Encoder and Audacity. Expression Encoder is part of Microsoft’s Expression Suite. As of this writing, there are both free and pro versions available, and while I happen to have Pro (available as part of my MSDN Subscription), the audio features should be part of both SKUs. Expression Encoder succeeds the Windows Media Encoder, and although it is primarily targeted at video projects, it is usable for audio projects.
To get started with Expression Encoder, launch the application and select a “Transcoding Project” in the New Project dialog. To load the audio file, select either Import from the File menu, or locate the file in Windows Explorer and drag it onto the application. The file will be loaded into the editing timeline, and its metadata will be displayed. Using the editing controls within Encoder, the section of interest for the ringtone can be isolated. Since there is no waveform monitor within Encoder, this is exercise must largely be performed by ear and with an eye on the time displayed in the timeline. (Note – a full discussion of editing within the Encoder product is beyond the scope of this discussion.) Once the desired segment of audio has been isolated, the specific WMA format can be selected from the Encode toolstrip, and the Audio property panel can be used to set the target bitrate mode, bitrate, channel information, sample rate, and bit depth (these settings push and pull against each other to determine audio quality vs file size. Remember, this is a ringtone, and there are limits to the file size. Audio quality is probably negotiable here.) The Metadata toolstrip can be used to set the clip;s metadata attributes (in particular, Title and Genre are important here), and the Output toolstrip can be used to determine the file output. When ready, selecting Encode or Encode Selected Item from the File menu starts creating the new ringtone file.
Audacity is a free, open source, cross-platform sound editor. In addition to downloading the Audacity application itself, for these purposes 2 add-ons should be considered – the LAME MP3 encoder (if MP3 files are the desired output), and the FFmpeg import/export library (if WMA files will be imported or exported.) Links to these add-ons can be found at the Audactiy download site here. To start editing a file, select Import from the File menu, or drag the file into the application. Audacity does display a waveform synchronized to the timeline, making the audio editing experience more visual than in Expression Encoder. Once the target section of the file has been isolated, Export or Export Selection can be selected from the File menu. From here, the type of file being exported can be chosen (WMA or MP3 for ringtones), and depending on the selection, encoding options can be chosen. Note that there are far fewer encoding options for WMA here than in Expression Encoder. Once a target file location and options are selected, the metadata editor will be displayed, where metadata for the output file can be set.
Regardless of what is set in the encoding applications above, the details tab in the file properties dialog can be used to set the metadata. The Title property controls what is displayed when the file is shown in the Custom Ringtones group in the phone. The Genre value is actually quite important – in order to use the Zune software to load the ringtone, it must be set to “Ringtone.”
Adding Ringtones Using Zune Software
To manually transfer the ringtone, make sure the ringtone file that was just created is in one of the configured music folders within the Zune software, as pictured below.
Set the file (or fill folder) to be synced with the phone device. The next time the phone is plugged in, the file will be placed on the phone. Because its genre is set to “ringtone”, the files will not appear in the phone’s audio collection, and will appear in the list of custom ringtones.
Programmatically Adding Ringtones
If the ringtone files are not originating on the phone user’s desktop and/or using the Zune software is not practical, there is a mechanism for adding ringtones programmatically. This would be useful, for example, to provide an application that allows ringtones to be selected from an internet site or related resource. The SaveRingtoneTask takes center stage for programmatically setting ringtones. For SaveRingtoneTask, the DisplayName property determines the name the ringtone will be displayed with in the Custom Ringtones section, and the Source property provides a Uri to the location of the ringtone file to be used. This Uri typically points to a location in Isolated Storage, using the URI syntax for accessing Isolated Storage, as shown below (notice the similarity with the Uri used for the Connection String specified when accessing SQL CE databases in the WP 7.1 API. There is some discussion that the Source Uri will also support the appdata prefix syntax that is available for read-only files that are included as part of the app’s payload in the Xap file, but I have yet to test this specific functionality.)
Note that the file in Isolated Storage is “copied” to the internal ringtone location on the phone…if the application that ran the Chooser is subsequently uninstalled (which clears Isolated Storage for that application), the ringtone persists until it is explicitly deleted from the Custom Ringtone collection. Also, in the case of the web-based ringtone provider example discussed above, it may be prudent to use the Background Transfer Service to queue the selected ringtone download, then process the file once it has been fully downloaded.
A Note About the Audio Files Used in this Example
The audio files used in this discussion are ripped from CD’s that are physically in my own personal collection (my taste in music notwithstanding.) Please be sure to perform your own copyright research prior to launching any ringtone software / services.