Cutting a clip from iPod library file
My requirements are as follows:
I need to access a song from iPod library and play it(which is doable). I have implemented this using Assets library, and now I need to trim that song programmatically, so that I can get a clip of it. One application is already on the app store featuring same functional开发者_如何转开发ity, called "Ringtone Designer" Any thoughts?
I guess you are retrieving the ALAsset of the song (since you say that you already know how to play it start-to-stop).
Now, to select parts of it you want to extract you can call the Method defaultRepresentation on the ALAsset, then call getBytes:fromOffset:length:error: on that ALAssetRepresentation-Object.
http://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/ALAsset_Class/Reference/Reference.html
http://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/ALAssetRepresentation_Class/Reference/Reference.html#//apple_ref/doc/c_ref/ALAssetRepresentation
If the song is encoded you might have to decode it first.
Good Luck!
精彩评论