Raw byte string to WAV file converter. This was put together in roughly 30 minutes because apparently there are no easy ways to compile bytebeat entries (the classical variety, not the floating-point / JavaScript one) losslessly.
raw2wav <filename> [<duration>] [<refresh>]
Reads bytes from the standard input, and exports a WAV file called <filename>
.
Every byte corresponds to an 8-bit unsigned audio sample. The output file is at
most <duration>
seconds long (default 30) using <refresh>
as the sample rate
(default 8000 Hz).
$ yes zzzzzzz | ./raw2wav.out pulse.wav 5
Produces a file which plays a 12.5% pulse wave at 1 kHz for 5 seconds.
$ gcc example.c
$ ./a.out | ./raw2wav.out example.wav 20 22050
Produces the first example of this video, but also makes it play much faster.
MIT License.