Audio disk

1.pl – perl script – writes a wav file directly to a floppy disk
ignoring the wav header, and removing samples so it
doesnt sound stretched. Tested with 8bit/sample wave file.

2 – bash script – plays the audio

1.pl:
#!/usr/bin/perl
open(FILE,"<1.wav");
open(FILE_out,">2.wav");
seek(FILE,44,0);
while (!eof(FILE)){ 
 read FILE,$samp,2;
 seek(FILE,1,1);
 print FILE_out $samp;
}
system("dd if=/dev/zero of=/dev/fd0 bs=1024 count=1440"); # sounds better with this!
system("dd if=2.wav of=/dev/fd0 bs=512"); 

2:
#!/bin/sh
dd if=/dev/fd0 of=/dev/dsp bs=1024 count=1440
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: