iPhone: NSData representation of Audio file for Editing

前端 未结 1 443
面向向阳花
面向向阳花 2021-01-06 03:09

I have been scratching my head since long now but not getting around to this. I haven\'t found a single example for Audio editing! I want to insert new Audio file in between

相关标签:
1条回答
  • 2021-01-06 04:06

    I think your best bet would be to use an ExtAudioFileRef to extract the audio samples of each file into buffers.

    Then you can freely mix the samples together to and from whatever position you like and save the new mixed file to disk using ExtAudioFileWriteAsync.

    For example: Extract sound 1 into buffer A. Extract sound 2 into buffer B.

    Create buffer C whose size is A's length plus B's length. Then write that buffer to disk in whatever format you want using ExtAudioFileWriteAsync.

    That file should then be playable by AVAudioPlayer.

    0 讨论(0)
提交回复
热议问题