DTMF tone generator for Puppy (Solved)

Requests go here. If you fill a request, give it a new thread in the appropriate category and then link to it in the request thread.
Post Reply
Message
Author
User avatar
mouldy
Posts: 663
Joined: Wed 04 May 2005, 21:47

DTMF tone generator for Puppy (Solved)

#1 Post by mouldy »

Used to be a linux program way back called dtmfdial or dialfix or something like that. Googling, just finding ancient references to it or that it was dropped from repositories or whatever.

Is there a modern program that does this? Site search here for dtmf just found skype type threads. Dtmfdial or dialfix just generated dtmf tones from computer speaker and I think had little gui dialpad on screen, but may have been command line, dont remember anymore. There is a windows program out there with name dtmfdial, but this was linux.

I am still using 4.3.1 though shouldnt matter for little application like this.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#2 Post by SFR »

Hi mouldy.

Audiacity can do this trick.
There's Generate -> DTMF Tones submenu.
You can enter there 1234567890*#ABCD + additionaly all lower case corresponding to the digits.
The string will be converted to the sound wave and then you can do with this anything you want.

HTH
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
mouldy
Posts: 663
Joined: Wed 04 May 2005, 21:47

#3 Post by mouldy »

I'd prefer smaller program that does nothing else. But will try Audacity. Thanks.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#4 Post by SFR »

mouldy wrote:I'd prefer smaller program that does nothing else. But will try Audacity. Thanks.
Actually, I think the same way, and I've found this idea interesting, so I wrote a simple shell app for playing DTMF tones.
Also I made examplary .wav files with those tones (in Audiacity), but you can make your own library of samples.

It's enough to unpack the attached archived folder (the tool is included, too), open terminal window within it, and type, f.e.:

Code: Select all

./dtmf 1234567890XYABCD
(X=* and Y=#)

It's not fancy stuff, but works quite decent...

Hope this helps a bit more, until you'll find better tool :wink:
And thanks for giving me a challenge :D
BTW, I wrote this tool in Lupu-528 and hopefully it will work in your 4.3.1.

Greetings!

Code: Select all

#!/bin/sh

# DTMF Tone Player by SFR'2012
#
# Syntax: dtmf <string>
# <string> can be 1234567890XYABCD [ where X=* and Y=# ]
# 
# Requires "wavplay" and *.wav files (16-bit, MONO, 11025Hz) as shown below:

t[1]="1.wav"
t[2]="2.wav"
t[3]="3.wav"
t[4]="4.wav"
t[5]="5.wav"
t[6]="6.wav"
t[7]="7.wav"
t[8]="8.wav"
t[9]="9.wav"
t[0]="0.wav"
t[10]="X.wav"
t[11]="Y.wav"
t[12]="A.wav"
t[13]="B.wav"
t[14]="C.wav"
t[15]="D.wav"

STRING=$@
LEN=$(( ${#STRING} - 1 ))
[ $LEN -eq -1 ] && echo "Null string, exiting!" && exit


for i in `seq 0 $LEN`; do
CONV=`echo ${STRING:$i:1}`
TEMP=${t[$CONV]}
[ "$CONV" == "X" ] && TEMP=${t[10]}
[ "$CONV" == "Y" ] && TEMP=${t[11]}
[ "$CONV" == "A" ] && TEMP=${t[12]}
[ "$CONV" == "B" ] && TEMP=${t[13]}
[ "$CONV" == "C" ] && TEMP=${t[14]}
[ "$CONV" == "D" ] && TEMP=${t[15]}
GEN=$GEN" "$TEMP
done

echo ""
echo "Playing DTMF tone of:" $STRING

wavplay -q -s 11025 -M -b 16 $GEN

exit

# END
Attachments
dtmf.tar.gz
DTMF tones player + Samples
(54.68 KiB) Downloaded 840 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
mouldy
Posts: 663
Joined: Wed 04 May 2005, 21:47

#5 Post by mouldy »

Cool, works as advertised. Big thanks. It will meet my needs as is.

However, if you want to go further and bundle it with a small telephone keyboard gui frontend..... so I could click the numbers individually with mouse like I was dialing a phone....

Nobody is every completely satisfied...

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#6 Post by SFR »

mouldy wrote:Cool, works as advertised. Big thanks. It will meet my needs as is.

However, if you want to go further and bundle it with a small telephone keyboard gui frontend..... so I could click the numbers individually with mouse like I was dialing a phone....

Nobody is every completely satisfied...
I've been thinking about it also :)
I'll try to implement it, when I'll find a some time.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
mouldy
Posts: 663
Joined: Wed 04 May 2005, 21:47

#7 Post by mouldy »

EUREKA! Its crude but I did it myself. I simply created 12 executable files. Each for a different key, made them executable and set each one to call up your script and play that particular tone. Then moved all to corner of desktop. I hit the number one button and it plays the tone and so on. A crude keyboard. BUT IT WORKS and does exactly what I want it to do.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#8 Post by SFR »

Cool! Original approach - that's what I like :D

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
mouldy
Posts: 663
Joined: Wed 04 May 2005, 21:47

#9 Post by mouldy »

Alas not sure if its my speakers, the telephone mike in handset, or something little off with tone on one or more numbers. But cant dial telephone with it. Phone company cuts in that call cant be completed as dialed. So I assume its detecting some of tones but not all???

My whole thing with this is that I live on top of big hill and lightening keeps knocking out electronic phones. I have couple old electro-mechanical dial phones, that are pretty immune to lightening unless it hits the line very close to home. So instead of buying yet another electronic phone, got to thinking of generating tones and just putting handset of dial phone next to speaker. Only really need it to interact with the now obligatory automated switchboards. "Press ONE NOW for Swahili!" or whatever. Dial phone still can dial original connection number. And dialing a number doesnt bother me, grew up with it.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#10 Post by SFR »

I suppose it might be because of low frequency of the samples, or their shortness.
I can't test it - I have no landline phone...
Best, if you try to dial few numbers directly from Audiacity (to adjust its freq and lenght), and then save them separately.
In the script, the frequency is set up through "-s <freq>":
wavplay -q -s 11025 -M -b 16 $GEN

HTH

EDIT: by "frequency" I meant "sample rate" of course...

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
mouldy
Posts: 663
Joined: Wed 04 May 2005, 21:47

#11 Post by mouldy »

I found both a downloadable flash tone generator, works offline (just open the swf file with browser) and an online one. Neither have any better result. So probably either my speaker distorts it or the phone mike distorts it just enough it doesnt work. One of these days I'll hunt up the other phone and try it with that. And I have more computer speakers too.....

That flash tone generator was nice find! http://www.mediacollege.com/audio/tone/ ... htones.swf

And I still have landline cause for me out in boonies, its either dialup or satellite. Satellite is WAY overpriced for what they offer. Though dialup is dieing at fast pace so may not have choice soon enough.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#12 Post by SFR »

Hi mouldy.

Any progress?
If you're still interested, I wrote the GUI at last.
http://www.murga-linux.com/puppy/viewtopic.php?t=75757
And the sample rate is increased to 22050Hz now.

BTW, very nice tool you have found, but to my ear the quality of its sound is very close to those 11025Hz samples I created before...
So, again, maybe this is the problem..?

Anyway, I wish you luck with this. :)

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
ariel
Posts: 140
Joined: Fri 03 Jul 2009, 19:47
Contact:

Re: current dtmf tone generator.

#13 Post by ariel »

mouldy wrote:Used to be a linux program way back called dtmfdial or dialfix or something like that. Googling, just finding ancient references to it or that it was dropped from repositories or whatever.
did you look in the ubuntu repo? it's just one package

hope that helps

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#14 Post by vovchik »

Thanks ariel.

dtmfdial is tiny and works like a charm in Lucid.

With kind regards,
vovchik

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

Re: current dtmf tone generator.

#15 Post by SFR »

ariel wrote:did you look in the ubuntu repo? it's just one package
Nice find!
...and here's simple GUI for this.
I've implemented only 4 (crucial, IMHO) parameters in "Settings" window;
'--bits' is set to '16' and others (volume, channels, device, bufsize, etc.) are default.

Greetings!
Attachments
dtmfdial_GUI.png
screenshot
(38.16 KiB) Downloaded 3074 times
dtmfdial_GUI.tar.gz
Unpack &amp; click to launch (&quot;dtmfdial&quot; must be installed first).
(1.55 KiB) Downloaded 655 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#16 Post by vovchik »

Dear SFR,

Nice job, really. I cleaned up the code a bit - in my own N. Wirth-like fashion :) - and added a tiny bit of eyecandy, if you don't mind.

With kind regards,
vovchik
Attachments
dtmfdial_gui.tar.gz
(1.93 KiB) Downloaded 384 times
dtmtdial_gui-nq8.png
(9.48 KiB) Downloaded 684 times

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#17 Post by jpeps »

dtmf works fine replacing:

wavplay -q -s 11025 -M -b 16 $GEN

with:

mplayer $GEN

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#18 Post by SFR »

@vovchik:
Personally I'm totally hopeless in graphic designs, so thanks very much :)

@jpeps:
Thanks for the hint. And one can use 'aplay' also.

BTW, guys, if you've seen the code (dtmfdial_GUI) you may noticed that there's double line <action type="refresh">SPEED</action>.
It's weird, but if there's only one such line and if I enter a value outside the range (eg. Speed = 1) and press OK, the variable isn't really changed to its default 8000 ("foolproof" mechanism) and 'dtmfdial' displays error (next time I go to Settings/Config - everything's ok then).
That happens always with the last "refresh" line, but (surprisingly) doubling fixes this.
I just wonder is it a glitch in my code or GtkDialog's..?

PS. Nothing urgent, just curious... :wink:

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

Post Reply