Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Mary had a Little Camel

by SubStack (Monk)
on Sep 04, 2006 at 19:32 UTC ( [id://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


Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-07-19 00:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.