Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Do Not Call!

by Mr. Muskrat (Canon)
on Jun 27, 2003 at 22:09 UTC ( #269761=CUFP: print w/replies, xml ) Need Help??

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();

Replies are listed 'Best First'.
Re: Do Not Call!
by allolex (Curate) on Jun 28, 2003 at 02:46 UTC

    What an excellent idea! You can download the .wav files on this page for comparison. :) One if them includes a "not in service" announcement for the day (maybe we're too late) when the telemarketers turn off the SIT recognition on their dialers.


Re: Do Not Call!
by Nkuvu (Priest) on Jun 27, 2003 at 22:17 UTC

    Cool. Now if I could just get my answering machine to run Perl scripts... ;)

Re: Do Not Call!
by Phaysis (Pilgrim) on Jun 29, 2003 at 23:58 UTC
    Hoo, yeah. Niiice. This may prove quite useful for us. We have too many telemarketers calling, seeing that I've not registered our number with the Texas No-Call list (and just where does that $2.25us/3yr go? How many residential lines statewide? Hmm.). Hey, maybe it'll throw off some creditors, too, eh? This should definitely work well with my installation of the VOCP/vgetty voicemail system (a very cool package indeed!).

    Heh. I just hope it doesn't throw off too many of our friends. One should hope it doesn't do so, right?

    A useful script; I should look into more sound-generation stuff. And thanks for the extra links, guys. Some very useful information there. I'll be looking into it soon. Cheers!

    (Ph) Phaysis (Shawn)
    If idle hands are the tools of the devil, are idol tools the hands of god?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://269761]
Approved by beretboy
Front-paged by beretboy
[ovedpo15]: another question about regex. if I have a string like this: "a/b/,c/d/e,5" I would like to remove the string after the last comma so the output will be "a/b/,c/d/e" how to do so?
[Corion]: ovedpo15: You could split on comma, and then join everything together, except the last part. Or you could match and make sure that the last part has no comma, like qr!,[^,]+$!, or you could use rindex.
[ovedpo15]: But I don't know the length of the string. will it still work?
[ovedpo15]: The only thing I know is that there is a comma at the end and a value after that

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2018-05-27 10:33 GMT
Find Nodes?
    Voting Booth?