Convolution and Wav files

Nov 21, 2020 at 2:24pm
Hello guys,

I have a big project and a part of it is to convolute two wav files. The problem is that I have no idea how to do it. I don't know how to open the two wav files in my project and store the result into a third file. If there is someone willing to help I would be greatful. Thanks in advance.
Last edited on Nov 21, 2020 at 2:28pm
Nov 21, 2020 at 4:29pm
How much work do you have to do for yourself?

Or put another way, can you use library code to do most / all the heavy lifting for you?
https://ffmpeg.org/documentation.html
Nov 21, 2020 at 4:56pm
Using ffmpeg is like using a sledgehammer on a fly :D

Essentially, a non-compressed wav file is just some header information, and then a contiguous array of each time sample (one per each side if stereo).
You can write your own PCM WAV file file loader, but you need to understand how to load/write binary files.

http://soundfile.sapp.org/doc/WaveFormat/
http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html

I've done this in the past; it's a good learning experience. However, if you do just want it to work, I did a search and found what appears to be a simple wav reading/writing library.
https://github.com/adamstark/AudioFile

It's header-only, so you don't need to worry about linking or compiling a library.
The readme has examples.
Nov 21, 2020 at 5:15pm
Another .wav file library: CWave - A Simple C++ Class to Manipulate WAV Files
https://www.codeproject.com/articles/29676/cwave-a-simple-c-class-to-manipulate-wav-files

It is for Win32, so not totally generic.
Topic archived. No new replies allowed.