Closed DeltaRazero closed 5 years ago
I like this bug report, good work. Can you also include the wave file that did not work so it's absolutely clear what to fix?
ke 10. huhtik. 2019 klo 22.17 DeltaRazero (notifications@github.com) kirjoitti:
Expected Behavior
WAVE audio samples a bit-depth of 8 loaded through the 'load' function in the 'wavetables' menu are loaded as 8-bit unsigned integers instead of 8-bit signed integers. [image: image] https://user-images.githubusercontent.com/26445643/55906880-9061c900-5bd5-11e9-8cdf-95d650a39771.png Current Behavior
WAVE audio samples a bit-depth of 8 loaded through the 'load' function in the 'wavetables' menu are loaded as 8-bit signed integers. This results in incorrect loaded waveforms. [image: image] https://user-images.githubusercontent.com/26445643/55906900-9d7eb800-5bd5-11e9-8d03-fcadb0b71c63.png Possible Solution
Unsigned to signed value conversion/parsing in wave_load() when WAVE.wBitsPerSample == 8. A variety of sources that I have read regarding the WAVE format also confirm that WAVE files with a bit-depth of 8 indeed store the samples as unsigned integers and be read as such. Citing from one such source:
8-bit samples are stored as unsigned bytes, ranging from 0 to 255. 16-bit samples are stored as 2's-complement signed integers, ranging from -32768 to 32767.
References
- WAVE PCM soundfile format http://soundfile.sapp.org/doc/WaveFormat/
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kometbomb/klystrack/issues/271, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCK6TfIXRcZP5f8oRlj8ize4E7Wh2Puks5vfjiegaJpZM4coEOG .
Here you go, I left two extra samples in as well https://drive.google.com/open?id=1qeBon-Rv0Dh-6lOuET894F_ZmkaEr1Ba
Should be as easy as changing this:
w->bits_per_sample == 16 ? CYD_WAVE_TYPE_SINT16 : CYD_WAVE_TYPE_SINT8
to
w->bits_per_sample == 16 ? CYD_WAVE_TYPE_SINT16 : CYD_WAVE_TYPE_UINT8
Expected Behavior
WAVE audio samples with a bit-depth of 8 loaded through the 'load' function in the 'wavetables' menu are to be loaded as 8-bit unsigned integers instead of 8-bit signed integers.
Current Behavior
WAVE audio samples with a bit-depth of 8 loaded through the 'load' function in the 'wavetables' menu are loaded as 8-bit signed integers. This results in incorrectly loaded waveforms.
Possible Solution
Unsigned to signed value conversion/parsing in
wave_load()
whenWAVE.wBitsPerSample == 8
. A variety of sources that I have read regarding the WAVE format also confirm that WAVE files with a bit-depth of 8 indeed store the samples as unsigned integers and be read as such. Citing from one such source:References