Add wav2mozzi.py to convert .WAV files to Mozzi headers#328
Conversation
|
Hi, |
|
I am gradually testing it with some of the files I have, but so far it works, so no changes in this regard. Regarding the PR you referenced, I can add similar symmetrical int8_t conversion here too. |
|
Sorry for the late reply.
I think this would be cool. After some debates, there was some consensus that symmetrical waveforms are usually preferable as negating them can be done without risking an overflow if the type is not changed before. Regarding other types, indeed only |
|
I've added 2 options: output bitwidth selector (8/16 bits, 8 by default), and symmetric mode (on by default) |
|
Alright, looks very good to me! Tried it with samples of different bitness and works like a charm.
|
|
Yeah, good points! I used windows for development, so haven't tested the shebang, now this should be fixed (and the file is also made executable on linux). |
|
Looks very good, thanks. Merging, this will be part of the next release. |
Hi. I've found using char2mozzi with raw files a bit cumbersome, so I made a similar script that takes WAV files.
It reads bitness, sample format, and sample rate from the WAV header automatically.
Supports 8-bit unsigned, 16-bit signed, 24-bit signed, and 32-bit signed PCM WAV files, as well as 32-bit IEEE float WAV files (samples in -1.0..1.0 range).
Everything is converted to int8 C array, format taken from char2mozzi.
If file is stereo, only first channel is used.
I've tested it on some of my files, but will test it more extensively if there is interest.