Hello all. I'm attempting to do create a wave file from scratch. I've searched online and understand the WAVE file format. Now I'm trying to load up all the necessary bytes into an array, and print the array to a binary file. Here's what it looks like so far:
Needles to say it doens't work. I try to play it in iTunes, and it doesn't work. Opening it in Praat gives me an error "File not finished."
Any ideas?
Code:
#!/usr/bin/perl
@array=(0x52,0x49,0x46,0x46,0x40,0x00,0x00,0x00,0x57,0x41,0x56,0x45,0x66,0x6d,0x74,0x20,0x10,0x00,0x00,0x00,0x01,0x00,0x01,0x00,
0x40,0x1f,0x00,0x00,0x40,0x1f,0x00,0x00,0x01,0x00,0x08,0x00,0x64,0x61,0x74,0x61,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x24,0x17,0x1e,0xf3,0x3c,0x13,0x3c,0x14,0x16,0xf9,0x18,0xf9,0x34,0xe7,0x23,0xa6,0x3c,0xf2,0x24,0xf2,0x11,0xce,0x1a,0x0d);
open(FILE, ">play.wav") or die "Error opening play.wav: $!\n";
binmode FILE;
print FILE @array;
close FILE;
Needles to say it doens't work. I try to play it in iTunes, and it doesn't work. Opening it in Praat gives me an error "File not finished."
Any ideas?