WavFileWriter

Status
Not open for further replies.

Foaly

Member
Hello everybody!
I am working on a little project and needed a way to store audio on a SD card. All I could find was code that either writes raw samples or some god awful spaghetti code attempting to write WAV files (sorry...:rolleyes:). So I decided to write a simple class that nicely abstracts all the nitty-gritty details away. I took inspiration from the Recorder example of Paul Stoffregens Audio library and the SFML SoundFileWriterWav class.

So here it is: WavFileWriter on GitHub. I welcome you all to check it out, test it and use it! Feedback is more than welcome!

For my purposes it is important to record at different sample rates. So I used Frank Boesings sample rate adaption code (see Util.hpp). This works nicely when recording audio from the mic inputs. Using a sine wave from AudioSynthWaveform with different sample rates results in a up or down pitched tone, but this seems to a problem of AudioSynthWaveform.

I did a lot of testing, but it turned out to be non-trivial to generate a signal of a precisly timed length to check if the size is written 100% correctly. According to my test the numbers are correct. But a code review/second pair of eyes is more than welcome :)

Also stereo recodring does not work (yet)...

As I said I am very open for comments, critique or suggestions for improvment :)
 
Thank you so much :eek: :D
There is a couple of things I would like to tweak.
- Using the proper size typedefs (ie int16_t, int32_t etc.) so that the integer width is guaranteed
- Adding multi channel support
- The files are displayed as containing 32-bit float, eventhough I write 16-bit integers into them...
And again it would be fantastic if someone could double check if the size is written properly, as I was unable to construct a proper test case on the teensy.
Maybe I can get those things ticked of until next week... :D
Good luck with the 1.42 and thanks for all your amazing work!
 
Last edited:
Status
Not open for further replies.
Back
Top