implement monowav writer in boing^3

implement monowav writer in boing^3

It would save a step to be able to have a quick and dirty way to write mono WAV files, 32-bit or even 24 bit. It would save the extra step involved in getting SoX to work.

task id: implement-monowav

2024-05-23 10:12: simple WAV file generators: didn't I do this already? #implement-monowav

I feel like I wrote a bare bones mono wav file generator somewhere in C.

2024-05-23 12:34: filling out initial chunks #implement-monowav

2024-05-23 12:44: Okay, poking at the hex data for the header #implement-monowav

2024-05-23 13:11: wav written, but afplay doesn't like it #implement-monowav

2024-05-23 13:16: why is the exif data saying my WAV has duration of 0? #implement-monowav

2024-05-23 13:26: Time to generate a smaller reference file #implement-monowav

2024-05-23 13:37: now we're only writing zeros #implement-monowav

2024-05-23 13:44: why is there weird junk in the reference zeros? #implement-monowav

2024-05-23 13:49: Don't know what the junk is, but the header is wrong #implement-monowav

I used sox to convert my generated wav into another wav, and it fixed some things. I diffed the xxd'd output and saw the header differences.

2024-05-23 13:57: 36 byte difference between data payload chunk size and riff chunk size #implement-monowav

4 bytes for RIFF 16 bytes for fmt 16 bytes for data in riff?

2024-05-23 14:04: zerod wav works. now add sound. #implement-monowav

2024-05-23 14:08: off to lunch. next steps #implement-monowav

next steps: get dynamic file size working.

2024-05-23 15:07: Return from lunch. settled in. #implement-monowav

Now, to tackle the file size things. I'm anticipating when I port this to Rust, I'll want to be able to write the stream of an indefinite size, get the total samples written to disk, and then update the header bits. It would be nice to do that using someo kind of r/w mode. Otherwise, just close and re-open.

2024-05-23 15:26: it seems to work without updates? #implement-monowav

Nevermind, just didn't update everything, and had to go back to the beginning of the file. Be kind, and rewind().

2024-05-23 15:28: back on track #implement-monowav

2024-05-24 14:44: monowav pre-setup #implement-monowav

just some scaffolding