Awk is powerful and concise, but it's not my friend - I can never remember how
the heck it works ;-)
I'd probably do like Paul D. suggests and use existing tools - e.g.
find something
to generate an appropriate soundfile, then feed it through sox.
But just for fun, here's something silly I just whipped up:
$ ./sine_hex.py
Usage: ./sine_hex.py frequency [sampling rate] [bits]
Print one cycle of a sine wave of approximately the
given frequency.
Values given in hex with *bits* precision at *sampling rate*.
Default sampling rate is 44100. Default bits is 16.
pwinkler@Winkler-P-LT2K ~
$ ./sine_hex.py 24000 48000
0000
ffff
pwinkler@Winkler-P-LT2K ~
$ ./sine_hex.py 3000 48000
0000
31f1
61f7
8e39
b504
d4da
ec82
fb14
ffff
fb14
ec82
d4da
b504
8e39
61f7
31f1
And here's the source. Most of it is argument handling :-)
http://www.slinkp.com/~paul/sine_hex.py
--
http://www.slinkp.com