/raw2wav

Raw byte string to WAV file converter

Primary LanguageC++MIT LicenseMIT

raw2wav

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.

Synopsis

raw2wav <filename> [<duration>] [<refresh>]

Description

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).

Example

$ 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.

License

MIT License.