You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a bug report.
8bit WAVs have unsigned samples. The library seems aware of this, but shifting the sample to signed 16bit happens in AudioOutput classes by calling MakeSampleStereo16 function. However, this happens too late in the pipeline in case the file is first mixed with another file, or its gain is changed by AudioMixer class. In this case the sequence of events is the following:
Sample is loaded and stored as u8 in i16 buffer in AudioGeneratorWAV, its 0 amplitude is value 128.
Sample is passed to AudioMixer class where it is scaled by applying gain (0 amplitude is not 128 anymore) or added to other channels (DC bias is added to bias of other channels).
Resulting sample is passed to final output class (e.g. AudioOutputI2S) where it is unbiased by MakeSampleStereo16, but it is only subtracting 128 from value, so the DC bias is modified but still remains.
I propose the change to convert the sample to signed when loading it in GeneratorWAV class, and use it as such from then on. MakeSampleStereo16 function should not do the shifting, but only scaling.
PS Not sure, but this might be the cause of some reports of people having clicks and pops in sound output.
The text was updated successfully, but these errors were encountered:
Thank you @positron96, this was the issue for me. I reconverted my 8-bit wav files from their original sources to 16-bit and a noticeable fuzz at both the beginning and end of playing the file was eliminated.
Hello and thanks for a wonderful library.
Here is a bug report.
8bit WAVs have unsigned samples. The library seems aware of this, but shifting the sample to signed 16bit happens in AudioOutput classes by calling
MakeSampleStereo16
function. However, this happens too late in the pipeline in case the file is first mixed with another file, or its gain is changed byAudioMixer
class. In this case the sequence of events is the following:AudioGeneratorWAV
, its 0 amplitude is value 128.AudioMixer
class where it is scaled by applying gain (0 amplitude is not 128 anymore) or added to other channels (DC bias is added to bias of other channels).AudioOutputI2S
) where it is unbiased byMakeSampleStereo16
, but it is only subtracting 128 from value, so the DC bias is modified but still remains.I propose the change to convert the sample to signed when loading it in GeneratorWAV class, and use it as such from then on. MakeSampleStereo16 function should not do the shifting, but only scaling.
PS Not sure, but this might be the cause of some reports of people having clicks and pops in sound output.
The text was updated successfully, but these errors were encountered: