Can we slice an audio file(mp3 or any) into segments(parts of smaller size) programmatically in Xcode
I have a sound file which requires to be split into smaller parts. Is there any way i can do it, dividing an audio file into small slices of sound as Music Cutte开发者_JAVA技巧r does.
I also need to check that sliced parts can be played individually.
Any help will be appreciated.
Thanks Vikas Ojha
It depends on the specific format of the file - an mp3 file, no - a wav file, yes.
For an mp3 file you would have to decompress the audio from the file first (you could use an audioqueue ), then split the raw audio data how ever you please, then re-encode each slice as mp3. Apple has sample code for decoding and encoding mp3's.
This is still not going to enable you to accept any input file format, for that you would need other external libraries, such as ffmpeg, LAME, etc. you might have to build these yourself and they may have disagreeable licensing restrictions.
精彩评论