In honor of the US government's new National Do Not Call Registry, I give you a script to generate those three little tones that telemarketing computers hate to hear...
Special Information Tones to the rescue!
#!/usr/bin/perl -w
use strict;
use Audio::Wav;
my $sample_rate = 8000;
my $bits_sample = 8;
my $num_channels = 1;
my $pi = 4 * atan2 1, 1;
my $max_no = ( 2 ** $bits_sample ) / 2;
my @tones = map { 2 * $pi * $_ } (985.2, 1370.6, 1776.7); # in Hz
my @dur = map { $sample_rate / 1000 * $_ } (380, 274, 380); # in ms
my $details = {
'bits_sample' => $bits_sample,
'sample_rate' => $sample_rate,
'channels' => $num_channels,
};
my $wav = new Audio::Wav;
my $write = $wav->write( 'sit.wav', $details );
for ( 0 .. 2 ) {
for my $pos ( 0 .. $dur[$_] ) {
$write->write( $max_no * sin( $pos / $sample_rate * $tones[$_] ) )
+;
}
}
$write->finish();