Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Mary had a Little Camel

by SubStack (Monk)
on Sep 04, 2006 at 19:32 UTC ( #571140=obfuscated: print w/replies, xml ) Need Help??

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 14: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 12: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 08:24 UTC

    Just Fun!

    /me rofl

    daniel

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://571140]
Approved by Tanktalus
Front-paged by ysth
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2019-01-20 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    After Perl5, I'm mostly interested in:
































    Results (350 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!