2006-12-01
Shell script music
Well, it seems I have the dubious distinction of being one of
the few (if any) people to discover a way to play music using shell
script. Observe the following snippet:
/usr/bin/yes foo > /dev/dsp & SP="${!}"; sleep 1; kill The more characters in the argument to /usr/bin/yes,
"$SP"
the lower the tone. The length of the sleep argument determines how
long the tone lasts, but a pre-constructed string of repeating
“foo\n” components will do just as well, though you need about a
thousand of them to last one second.

