I record audio streams as byte sequence, for playing via https://github.com/mattgallagher/AudioStreamer. If i play mp3 stream from URL it plays fine, but if i play it from local file it has glitches, i opened file in audio editor, i see flat lines in place of glitches in record(on screenshot), when i remove this flat lines in editor record works fine.
I also opened record in Audacity and it open it without this lines, and play audio without glitches, but when i open record in my app, or in any mac audio player it play with this glitches.
My record algorithm is simple, i just add bytes from stream to NSMutableData and write it in file, and then open it via same AudioStreamer like stream but from local file system.
Also i save structures for play, like AudioStreamBasicDescription, because without them AudioQueue will not start play.
As i understand i didn't save some structure that need to cut this empty pieces when playing. Because when i playing it from online URL stream it works without glitches.
i found a bug, when i write a stream to file it write also stream metadata like song name. When i start wrote only audio data all works fine.