# phone tone ?

Discussion in 'General Electronics Chat' started by Mathematics!, Apr 13, 2010.

1. ### Mathematics! Thread Starter Senior Member

Jul 21, 2008
1,022
4
Ok I am wondering if anybody knows a site that has the wav or mp3 audio clips of the phone tones for a 0,1,2,3,4,5,6,7,8,9,#,*.

This would be a great help if I could just download the tones for the specific numbers.

I don't want them to be all in one wav, or mp3 file.
Because my objective is to have my program play the tones out my audio port down the phone lines and make a call.

If not I can just record the phone buttons by creating or buying a device that plugs into my audio port.

Thanks

It must be out their somewhere on the internet havn't found it though

Aug 3, 2007
419
17

Nov 6, 2005
1,015
69
4. ### SgtWookie Expert

Jul 17, 2007
22,194
1,761
You can create .wav files using LTSpice.
Remember?

Just use two voltage sources set to create dual-tone sine waves of the correct frequencies.

Then sum the two using a resistor network. Write the .wav output from the junction of the resistors.

You can create sound clips as long or as short as you'd like.

[eta]
The attached LTSpice simulation is set up to generate the DTMF for a "1" and write it to c:\1.wav in 16bit stereo; this way the sound is pretty clear, and it doesn't matter if you use just one or both channels of your sound card.

Run the simulation, and then play C:\1.wav using Windows Media Player.

The other DTMF frequencies are here:
http://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling

[eta]
Rather than use a resistive summing network, it was easier to just use two voltage sources generating sinewaves in series.
The .wave directive is limited to +/-1v, which is why the voltage sources use 0.5v as the p-p voltage.

• ###### Phone Tone Generator.asc
File size:
554 bytes
Views:
17
Last edited: Apr 14, 2010

May 11, 2009
5,939
1,224
6. ### Mathematics! Thread Starter Senior Member

Jul 21, 2008
1,022
4

SgtWookie
Excellent idea.

Just a few question on a few lines of code
.wav c:\1.wav 16 11025 v(WavOut) v(WavOut)

what is the 16 11025

I am assuming this is telling it to be sampled in 16bits but what is the 11025 why did you use that.

Also for the tones length
.tran 100mS what made you pick this one?
And will I use these same values for 2 , 3, 4.wav ,...etc
Just changing the frequency of the 2 sine waves to create the others wav files...etc?

7. ### SgtWookie Expert

Jul 17, 2007
22,194
1,761
See the LTSpice help file for the .wave directive.

You will have to experiment to find the minimum acceptable length for your phone service, and then increase it by 120% or so for reliability. I chose that length because the resulting file size was fairly small, but long enough so that you could hear that it sounds like a typical touch-pad press.
You will need to change the filename and at least one of the frequencies to create the other tones you need.

I thought I posted the chart already?

You should be able to figure out the rest of it from what I first posted. It's really not that difficult.

8. ### Mathematics! Thread Starter Senior Member

Jul 21, 2008
1,022
4
Ya , I got it thank you.

Just for anybody interested this is the code that plays the phone number.
I wrote it in java so compile with javac PhoneDialer.java
run with java PhoneDialer

Code ( (Unknown Language)):
1.
2.
3. import java.io.File;
4. import javax.sound.sampled.AudioFormat;
5. import javax.sound.sampled.AudioInputStream;
6. import javax.sound.sampled.AudioSystem;
7. import javax.sound.sampled.DataLine;
8. import javax.sound.sampled.SourceDataLine;
9.
10. public class PhoneDialer {
11. public static void main(String args[])
12. {
13. int p[] = { 1,8,8,8,4,5,6,2,3,4 } ; // number to call change to whatever you want
14. call(p) ;
15.
16. }
17.
18. public static void call(int phonenumber[])
19. {
20. for( int i = 0 ; i < phonenumber.length ; i++ )
21. {
22. play_number_tone( "" + phonenumber[i] + ".wav" ) ;
23. }
24. return ;
25. }
26.
27. public static void play_number_tone( String digit )
28. {
29.
30. int EXTERNAL_BUFFER_SIZE = 524288;
31.
32. File soundFile = new File(digit);
33.
34. if (!soundFile.exists())
35. {
37.  return;
38. }
39.
40. AudioInputStream audioInputStream = null;
41. try
42. {
43.  audioInputStream = AudioSystem.getAudioInputStream(soundFile);
44. }
45. catch(Exception e)
46. {
47.  e.printStackTrace();
48.  return;
49. }
50.
51. AudioFormat format = audioInputStream.getFormat();
52.
53. SourceDataLine auline = null;
54.
55. //Describe a desired line
56. DataLine.Info info = new DataLine.Info(SourceDataLine.class,format);
57.
58. try
59. {
60.  auline = (SourceDataLine) AudioSystem.getLine(info);
61.
62.  //Opens the line with the specified format,
63.  //causing the line to acquire any required
64.  //system resources and become operational.
65.  auline.open(format);
66. }
67. catch(Exception e)
68. {
69.  e.printStackTrace();
70.  return;
71. }
72.
73.  //Allows a line to engage in data I/O
74. auline.start();
75.
77. byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
78.
79. try
80. {
82.  {
85.   {
86.    //Writes audio data to the mixer via this source data line
87.    //NOTE : A mixer is an audio device with one or more lines
89.   }
90.  }
91. }
92. catch(Exception e)
93. {
94.  e.printStackTrace();
95.  return;
96. }
97. finally
98. {
99.  //Drains queued data from the line
100.  //by continuing data I/O until the
101.  //data line's internal buffer has been emptied
102.  auline.drain();
103.
104.  //Closes the line, indicating that any system
105.  //resources in use by the line can be released
106.  auline.close();
107. }
108. }
109. }
110.
111. [/i]

Note for this code to work you must put the digit files in the same folder as this file. And the wav files must be 1.wav , 2.wav ,....9.wav , 0.wav , #.wav , star.wav

You may want have a loop to call many numbers in the main function....
up to you.... remember if you loop thru everybodys phone number you will probably get arrested .

What you could do is dial a number wait for 30 seconds and leave a message with another wav file.... or call everybody with a message

Anyway thanks for the help with the wav file stuff.
enjoy

9. ### redlight000 Member

Feb 26, 2010
66
2
Hi Rjenkins,
I tried your link you gave, relating to phone tones, but when clicked on, it dont do anything on the website where your link takes one..?? do you have to Join? that webiste..
thanks
redlight000

10. ### Mathematics! Thread Starter Senior Member

Jul 21, 2008
1,022
4
Ok , I have built a device that plugs into my stereo or line out port.
And plugs directly into my phone jack.
What I want to know is I have tested it with my program I gave above.
It plays the sound out the stereo/line out jack. It is 1 volt rms AC and I can hear it perfectly if I tie speaker wire into the phone jack line to hear if it is getting their.

Works fine what I don't get is why it is not connecting me to the dialed number.
I believe everything is tone dialing now so whats the reason?

I have comcast and I tried dialing my own number and logging into my account the recording say's press one to listen to your messages ,...etc so I thought I could just play the 1.wav out my stereo port but apparently that didn't work...
Then I pressed the one button on the phone and it worked fine....

So I am confused how are they determining the difference between the tone and the one digit etc...

Is their a certain time limit I should wait between key presses or something. How long a duration of the tone do I need to be safe to say it will work. I have been using 1volt ac for the tones because I thought it was one voltage ac superimposed on 50 something volts dc for the voice/tones......maybe I am wrong....

Thanks for any help with this one it would be cool to get this to work.

Last edited: Apr 15, 2010
11. ### SgtWookie Expert

Jul 17, 2007
22,194
1,761
Why don't you try a brief silence between each DTMF, like somewhere between 10mS and 100mS?

Just record another short .wav file at a DC level of 0v. In other words, just write the GND node to the wave file.

12. ### retched AAC Fanatic!

Dec 5, 2009
5,201
315
Was the AT code for dialing gap delay ats11=x? Where x was the mS between tones?

I remember using this to speed up the dialing of the modem.. Ahh.. Back when BBSes were king. QuickBBS with FIDOnet. WWIV, TAG, cNET...

WOW the SysOp wants to CHAT!!

Check out that ANSI picture! Cool. I wonder if EbonyEyes used TheDRAW?

Sorry.. Memory lane. But sgtWookies suggestion is a valid one. You should have a P.wav for pause. This is if you have to wait x number of seconds before dialing a voicemail password or extension number.. or even after *70 or such commands. Some get funny if you have no delay before starting to dial the number. AT commands used th comma

so ATDT*70,555-555-5555 Would use dialtone to dial *70 then pause, then dial 555-555-5555

13. ### Mathematics! Thread Starter Senior Member

Jul 21, 2008
1,022
4

I have tried inserting like you said an audio clip of zero volts for 100mS
between each tone send. Still doesn't work.

If somebody want to test it and see if they have the same problem feel free.

Do you think I need the key tones to be more then 100mS ?

14. ### SgtWookie Expert

Jul 17, 2007
22,194
1,761
You have an O-scope, right?

Why don't you measure the P-P voltage on the phone line when you are dialing with an ordinary telephone?

You didn't post the circuit you are using to send the DTMF with.

I have no clue where in the world you are.

Why don't you click on the "User CP" link on the menu, and put your country/province/state/whatever where you are?

kingdano likes this.
15. ### SgtWookie Expert

Jul 17, 2007
22,194
1,761
Have you compared how your created .wav files sound compared to pressing a button on your phone?

They should sound identical.

If you're tone deaf, you wouldn't be able to tell the difference.

kingdano likes this.
16. ### Mathematics! Thread Starter Senior Member

Jul 21, 2008
1,022
4
Well they sound the same.
I don't have an O -scope though so I cann't be fully sure.

I do think the number tones from the phone are a little bit louder though.

And I finally got around to adding some stuff in the CP tab like you said.

Last edited: Apr 15, 2010
17. ### SgtWookie Expert

Jul 17, 2007
22,194
1,761
Does your program wait for a dial tone after going off-hook, but before dialing?

The dial tone is 350Hz + 440Hz.

18. ### Mathematics! Thread Starter Senior Member

Jul 21, 2008
1,022
4
I usually just pickup the phone and wait until the dial tone goes away then send the tones down the phone. I can hear the tones in the speaker of the phone so I know it is being sent.

I just cann't test if they are the exact shape because I don't have an O-scope. They sound pretty much the same....

In your spice file you gave me I have just been changing the
sin( 0.5 1209) and sin(0.5 697) plus the names 1,2,3,4...etc .wav
To get me wav file number tones....
Should I change something else?
Or increase the amplitude I was think it should be around 1 like you have it.

Would the digital to analog converter in the sound card not be fine enough to give the correct sine wave.... I don't think it is this since the phone system is pretty much digital.

Wondering though if when you try to make a phone call does the phone circuit send some ack tones before sending the numbers because maybe that could be my problem?

Very werid

19. ### SgtWookie Expert

Jul 17, 2007
22,194
1,761
You should wait until you HEAR a dial tone, not wait until it goes away.

They are perfect sine waves, added to each other.

If you attempt to increase the peak voltage beyond 0.5, the waveform will be clipped, and harmonics will then be present. The .wave directive is limited to 1v. I don't know what the impact of the harmonics might be.[/QUOTE]

The .wav file is 16 bit stereo, 11kHz sample rate. That should be adequate. Your sound card is also likely 16-bit compatible. If you wish to improve the sound quality more, increase the sample rate. See the .wave help for supported frequencies; down near the bottom.

Not that I know of.