could someone provide me a link to source code (preferably C/C++) of a simple WAV 16-bit to 8-bit (and back if possible) converter? I have basic knowledge of C++ and I need to have a resource to understand wav writing and converting values for my new project. At this moment I have a lecture about RIFF chunks structure.
Also any formulas for converting values between different bit depths (also these un standard) appreciated...
I'll prefer it to be simple and command line so I can edit it with notepad and easily compile.
Thanks in advance!
For reading and writing WAV files have a look at the specification:
https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
For converting between 8 and 16 bit you just need to divide or multiply by 256.
For example (converting from 16 to 8 bit in C):
fopen()
.If you need more specific information please ask.