DTMF tone generation. (com.Nokia.Telephony.Tones not provided)

I am trying to make DTMF tones out the speaker.

I find this old dbus example, but com.Nokia.Telephony.Tones appear to be gone/obsolete.

Does it have a new name?
Any other suggestions?

[Extra credit:
How do I force the playback out the headphone jack if I want?
Can the XA2 do both headphone and speaker at the same time?]

# Play a DTMF tone corresponding to key '5'
dbus-send --system --print-reply --type=method_call --dest=com.Nokia.Telephony.Tones /com/Nokia/Telephony/Tones com.Nokia.Telephony.Tones.StartEventTone uint32:5 int32:0 uint32:0


Error org.freedesktop.DBus.Error.ServiceUnknown: The name com.Nokia.Telephony.Tones was not provided by any .service files`

Do you just want to hear them from the speaker? A super-quick and super-dirty method would be to just record the tones and then play them back with the audio renderer of your choice – e.g. python “playsound”. Audacity has a DTMF generator function if you don’t already have the audio in wav/mp3/whatever format.

If you need finer-grained control, you might need to generate the two sine waves programatically, but the frequencies are documented.

That is indeed another way to do it.
In the long run, I also want to play speech snippets, so its not as inelegant as one might think.

But using the commandline to get the dtmf tones directly would be easy for todays problem.

A while back, when I was testing mimic (for reasons detailed below) and couldn’t get it to play directly to phone speaker, so I used it to generate a wav file instead and used gstreamer to play that:

gst-launch-1.0 playbin uri=file:///home/nemo/temp.wav

but this works, too:

gst-launch-1.0 filesrc location=say.wav ! wavparse ! audioconvert !audioresample ! pulsesink

I was testing why pure maps couldn’t pronounce a nearby placename . . .

mimic -t “I can say Hermione and Siobhan, but I can’t say Olathe.” -o say.wav

and found out that mimic is more familiar with Harry Potter than it is with Northeastern Kansas cities.

And just bumbling around in the gstreamer docs, it looks like there’s a dtmf plugin, but it also looks tricky to use at first glance . . . looks like it can also decode dtmf!

1 Like