http://www.perlmonks.org?node_id=571140

perl -e'%c=map{[a..z]->[log($_)/log(2)*8-48],$_}map 2**($_/8),6*8..8*8 +; print((((chr)x($_/16)).("\x00"x(256-$_)/16))x128)for map{$c{$_},0}" +jklkjjj0kkk0j0g0g00jklkjjjjkkjkl"=~/./g'>>/dev/dsp
Optionally, adjust x128 to make it play faster or slower.
(Thanks to tybalt89 on freenode for the =~/./g suggestion)

Replies are listed 'Best First'.
Re: Mary had a Little Camel
by truedfx (Monk) on Sep 05, 2006 at 10:33 UTC
    Instead of >>/dev/dsp, you can also try |aplay (or a similar program). I have no /dev/dsp, so I needed that to hear anything. That said, it's pretty neat, and maybe you could do a morse JAPH? :)
      Yeah, I got sound with " | aplay -f S16_LE -c1 -r 8000 -t raw" , but it wasn't like 'Mary had a little lamb'. If anyone knows better settings, let me know.

      I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Mary had a Little Camel
by zentara (Archbishop) on Sep 05, 2006 at 08:01 UTC
    Could you say what the format and bitrate is for this audio? I get static, because without an initialization, my sblive will play audio at "Unsigned 8 bit, Rate 8000 Hz, Mono".

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      After grepping around a bit through the alsa source for my sound card, I found a section that says the default sample rate is 44100 for dsp (dsp_spos_scb_lib.c). However, playing around with aplay, as others have suggested,-r 8000 produces identical output to piping to dsp on this machine.
Re: Mary had a Little Camel
by ruoso (Curate) on Sep 05, 2006 at 04:24 UTC

    Just Fun!

    /me rofl

    daniel