It's possible for the dr_wav decoder to output distorted audio for certain files.
The problem is reproduced by downloading these test files, and compiling this program (a simple miniaudio player) to play them back.
The program will ask you to input a file, after which it will start playing the file. Once you press return, it will then seek forward half the total number of frames (you should hear nasty distorted audio as a result, so watch out!!).
I found that the distortion occurs only when the program has played back a bit of the audio, and then perform a seek in the forward direction. In order words, if the program was to start playback from halfway inside the file, the problem doesn't manifest itself.
Also, the seek needs to be of a certain size (relative to the playback position) before the distortion will happen.
I've noticed that the problem affects both .aif and .wav files, but only seems to occur with 24-bit audio.
In case it's useful, I also captured 40-something bytes from the output buffer (see below), with GOOD being the correct output (captured immediately after a seek without playing audio beforehand), and BAD being the distorted output (captured immediately after a seek, but having played back some audio first).
BAD is offset by 10 bytes (for better overview, I've aligned the values in the capture below). Assuming that each sample in the audio signal consist of 6-bytes (true for 24-bit audio), this could explain the distortion.
Additionally, BAD contains a different value for every fourth byte.
It's possible for the dr_wav decoder to output distorted audio for certain files.
The problem is reproduced by downloading these test files, and compiling this program (a simple miniaudio player) to play them back.
The program will ask you to input a file, after which it will start playing the file. Once you press return, it will then seek forward half the total number of frames (you should hear nasty distorted audio as a result, so watch out!!).
I found that the distortion occurs only when the program has played back a bit of the audio, and then perform a seek in the forward direction. In order words, if the program was to start playback from halfway inside the file, the problem doesn't manifest itself. Also, the seek needs to be of a certain size (relative to the playback position) before the distortion will happen.
I've noticed that the problem affects both .aif and .wav files, but only seems to occur with 24-bit audio.
In case it's useful, I also captured 40-something bytes from the output buffer (see below), with GOOD being the correct output (captured immediately after a seek without playing audio beforehand), and BAD being the distorted output (captured immediately after a seek, but having played back some audio first).