tad-iizuka / MP3RecordingSample

MP3 Recording with lame and AVAudioEngine, Swift 4
21 stars 0 forks source link

The playback misses always the last second of recording #1

Closed appfabtech closed 3 years ago

appfabtech commented 6 years ago

I tried your example and when I playback the last second of recorded audio is missing

Thanks

tad-iizuka commented 6 years ago

Yes, in this code, to check reached the end of playing by using callback,

    self.audioFilePlayer.scheduleSegment(audioFile,
        startingFrame: AVAudioFramePosition(0),
        frameCount: AVAudioFrameCount(self.audioFile.length),
        at: nil,
        completionHandler: self.completion)

But calling timing is a little bit early. If you want to stop pricisely, you might be implemented interval timer see if reached end of audio file length. See