# Perl 5: 94 <strike>122 140</strike> #

SND files have simpler headers, no need to print in binary. This versions produce 8khz mono SND file named 'a':

    open A,'>a';print
    A".snd",pack"N*",24,-1,2,8e3,1,map{(--$|x3)x(894261072>>$_&1?1600:400)}0..39

The result [file][1].

Old solution. Produces a 1khz 8-bit mono WAV file named 'a':

    open
    A,'>a';print
    A pack"A4lA8lssllssA4ls*",RIFF,17040,WAVEfmt,16,1,1,(1e3)x2,1,8,data,17004,map{($_)x(894261072>>$v++&1?400:100)}(255,0)x20

The result [file][2].

To get to 122 characters I had to paste the header in binary instead of packing it which makes the code hard to copy here. The escaped version is:

    open
    A,'>a';print
    A"RIFF\x90B\0\0WAVEfmt \0\0\0\0\0\xe8\0\0\xe8\0\0\0\0datalB\0\0",pack"s*",map{($_)x(894261072>>$v++&1?400:100)}(255,0)x20

Base64 encoding of the actual 122 bytes solution:

    b3BlbgpBLCc+YSc7cHJpbnQKQSJSSUZGkEIAAFdBVkVmbXQgEAAAAAEAAQDoAwAA6AMAAAEACABk
    YXRhbEIAACIscGFjayJzKiIsbWFweygkXyl4KDg5NDI2MTA3Mj4+JHYrKyYxPzQwMDoxMDApfSgy
    NTUsMCl4MjA=


  [1]: https://www.dropbox.com/s/l72ujazdidp9qzr/a.snd?dl=0
  [2]: https://www.dropbox.com/s/h00900dda7qfmu4/a.wav?dl=0