The sounds from the above scripts were not working when I actually tried to use them, so I wrote it again using Audio::Data. This script has worked great so far on real telephone lines and other devices. This save as an au file, but if you need a wav you can use something like ffmpeg to convert it.
#!/usr/bin/perl use strict; use Audio::Data; my(@tones) = qw(1 2 3 4 5 6 7 8 9 0 * #); my %lut = ( '1'=>[697,1209], '2'=>[697,1336], '3'=>[697,1477], '4'=>[770,1209], '5'=>[770,1336], '6'=>[770,1477], '7'=>[852,1209], '8'=>[852,1336], '9'=>[852,1477], '*'=>[941,1209], '0'=>[941,1336], '#'=>[941,1477] ); my $rate = 44000; my $audio1 = Audio::Data->new(rate => $rate); my $audio2 = $audio1->clone(); foreach my $tone (@tones) { $audio1->tone(${$lut{$tone}}[0],.3,.8); $audio1->silence(.05); $audio2->tone(${$lut{$tone}}[1],.3,.8); $audio2->silence(.05); } my $final = $audio1 + $audio2; open(my $fh, '>dtmf'.join('',@tones).'.wav'); binmode $fh; $final->Save($fh); close($fh);

In reply to Re: DTMF Tone Generator by Anonymous Monk
in thread DTMF Tone Generator by Mr. Muskrat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.