Preface
Part I: DAC output music https://blog.csdn.net/shaynerain/article/details/108052191
Related article: WAV file analysis https://blog.csdn.net/shaynerain/article/details/108052144
After the double-buffered output in the previous article, most of the songs will have pupu sound. After inspection, some other information is read when reading the music.
Main
Normal audio files will have 0x00 before and after buffering, as shown in the figure, but the exported wav file has some additional information after the data data, so you need to pay attention to whether there is more unnecessary information when reading it. Do processing when reading.
wav uses binary to open
deal with
Determine whether the total length at the end has been exceeded, if it exceeds, set the excess part to zero, that is, there is no sound