Since PCM is an uncompressed format, smooth playback is expected. There is nothing that could create a failure. The same thing happens if you use some kind of lossless codec, for example flac. On the other hand, if you use any lossy codec, such as mp3, wma, etc., there is no way to avoid glitches without any intervention. A WMA decoder, for example, will always give you more PCM than you originally provided during encoding. These extra bytes will cause a glitch, and it will also ruin the duration. In addition, such a combined playback (list) will have a longer duration than necessary. You can try to smooth out the failure with some DSP filtering. You can even try some simple actions, such as crosshatch transitions, etc. Perhaps this will give some useful results.
If any lossy codec is unacceptable due to the bandwidth, another approach would be to create compressed files with the lost codec, such as mp3, and start streaming from the calculated position. Of course, you cannot exactly search for a sample, as in PCM, and you will get a small amount of useless PCM when decoding, because you will start to decode the compressed data in the middle without the βprevious dataβ required by the decoder. I would suggest a constant bitrate when encoding such files, because you can quickly calculate the search position in a compressed file before streaming begins.
As for the glitches here, if you start to encode such mp3 files, and you create these files WITHOUT stopping the encoder, then there will be no failures when switching files, because you just split the compressed data into more files. Of course, you probably have to implement this yourself.
user1764961
source share