I see this question asked a lot on StackOverflow, and I saw another example of this phenomenon. I decided to write this short article to simply explain why this is not possible, in my opinion, and why you should look for another media source to build your ringtones rather than using the existing media library.
The main problem with building ringtones from existing media content is the lack of access to direct media byte streams. Also known as – media content. You can play registered songs through the OS-based player, but you don’t have the byte array for the content that is played. That being said, SaveRingtoneTask does not accept a parameter of type Song.
What’s the reason for the restriction? The main one I see here would be illegal content distribution. If a third-party application would have access to the media content uploaded through Zune, this would mean that the same application could do whatever it wants with that content – send it somewhere, upload it to a public server. You name it. A lot of songs on various Windows Phone 7 devices are licensed and DRM-protected. Specific licenses restrict distribution of the content, therefore it makes sense to lock any possible backdoors that would facilitate doing that.
What about beat extraction through VisualizationData (via MediaPlayer.GetVisualizationData)?
Not going to work because it is not available on Windows Phone:
What should I do?
Either bundle ringtones with the application (not really efficient but possible – for example, through soundboard apps) or have your own web server (or space on a web server) that can be accessed from within your application to download MP3 and WMA files of appropriate length and size (also, without DRM).