Solved

Playing DTMF tones (HCI) Delphi 4

Posted on 2000-04-07
9
651 Views
Last Modified: 2010-05-18
I am writing a program to simulate the user interface of a phone. Does anybody have any code which will either poll the speaker and/or send dual frequency sine waves to the a sound card? i.e I specify a frequency or dual frequency and duration. I don't want to play sampled wave files as these can be rather large. I  just want to emulate the tone of a phone i.e dialing numbers 1 to D, dial tone, busy etc.

I have tried using wave files before but there is a slow response time in say pressing a button and hereing a response. Also on repeating a tone say the busy tone in a cycle there can be delay due to multi threading this will vary on the machines I have to run the program on here in uni?

I am writing the program at home under 98se but will be testing the thing at uni who run NT. Is there any way to make the pc speaker accept more than one tone? i.e buffer the waveform you created somewhere and send these shifts in frequency(or a square wave repersentation) to the pc speaker? As far as I am aware the pc speaker can be in two states in or out and any tone you have to send it has to variey in frequency i.e high the frequency more pulses through the speaker. I have found a speaker and a taudio componient @ http://www.efg2.com/lab/Library/Delphi/Graphics/Multimedia.htm
The taudio componient will allow me to create a wave form in its buffer which it then outputs to the sound card. Is there any way of implimenting the buffer for the PCspeaker? The PCSpkr componient on the above mention site only seems to work on 98 as NT produces a "Privelage instruction" error message.
I found some information on the beep instruction you mentioned :-
"Function Beep(dwFreq {Hertz (37 .. 32767)}, dwDuration {milliseconds}:  DWORD):  BOOL;
Under Windows 95 the Beep parameters are ignored and the Windows plays the default sound event.  Unders Windows NT, Beep is synchronous, except for when dwDuration is -1.  In this case Beep is asynchronous and continues until the next call to Beep."
Thanks
Chris




0
Comment
Question by:ironwood321
9 Comments
 
LVL 5

Expert Comment

by:Gwena
ID: 2694732
listening....
It seems like the sampled wav files would not need to be very large though
because the wavs would only need to be a fraction of a second to dial out on a phone line.... 12 sounds of say 1/5 sec each should work ok...store them in a res file.
0
 

Author Comment

by:ironwood321
ID: 2699810
Edited text of question.
0
 

Author Comment

by:ironwood321
ID: 2699823
Edited text of question.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 3

Expert Comment

by:Diggie
ID: 2702186
the native win32 Beep function takes frequenty and duration parameters (only on NT!)

<-paste from win32 programmer's ref.->
BOOL Beep(
    DWORD dwFreq,
    // sound frequency, in hertz
    DWORD dwDuration
    // sound duration, in milliseconds
);
<-end paste->

as I remember (from some ISDN programs) the DTMF specifications are somewhere described (e.g. busy: 3s 5000Hz, 1s silence, 3s 5000Hz etc.)

Hope u use NT ;-)
0
 

Author Comment

by:ironwood321
ID: 2703598
Edited text of question.
0
 

Author Comment

by:ironwood321
ID: 2703633
Edited text of question.
0
 
LVL 1

Expert Comment

by:flooder
ID: 2799611
As far as I understand DTMF frequencies are not for example say 500Hz or 1500Hz. Rather it is a mix of frequencies, which is difficult to create.
0
 
LVL 3

Expert Comment

by:Diggie
ID: 2801666
Flooder,
you're right: according to
http://www.whatis.com/dtmf.htm
it is a mix of a low and high frequencies.
But there's probably a nice component to achieve this...

DiggiE

p.s.
The whatis link doesn't show the complete DTMF list, but it's a start...
0
 
LVL 15

Accepted Solution

by:
simonet earned 100 total points
ID: 2843642
Better than giving you the answer here, I'll give you the 2 sources I used when I had a similar problem. However, I no longer have the application I wrote (it was for the company I was working for), but I ket the URLs:

Dual Tone Multiple Frequency:
http://www.glowingcoast.demon.co.uk/theory/t_dtmf.htm 

Generating DTMF tones using soundcard
http://www.hut.fi/~then/mytexts/dtmf_generation.html 

The latest will point you to an application that generated the WAV files for the source codes. The application contains source for both Pascal and C++.

Yours,

Alex


0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question