Search code examples
iosaudiorecordplayback

Is it possible to play the audio while recording


I am planning to develop an app for recording voice for iOS. The app should provide functions to record, stop, play, pause, rewind and fast forward on the user interface. When recording, the user should have playback option. Is it possible to develop such an app?


Solution

  • It might possible, I never try it on hand. But you can try to record multiple file and keep record the number of file that being recorded and in the end, you can merge multiple file in to one.

    The algorithm that I can think of is.

    1. Start recording
    2. Set FileRecordedNumber = 1
    3. On pause, save the temporary file to FileRecord1.mp3 or something
    4. When start recording again, you should increment the FileRecordedNumber
    5. On pause, save the temporary file to FileRecord2.mp3
    6. On play sound or stop, for loop FileRecordedNumber and merge the sound file
    7. Play the sound

    You can start new record sound file whenever you continue the record after play

    Sorry I could not provide the code, but I found couple of article that might help you for merging sound file.

    Combine two audio files into one in objective c How to concatenate 2 or 3 audio files in iOS? http://developer.telerik.com/featured/merging-audio-video-native-ios/

    Good luck for you project