spmathis
Posts: 3
Joined: Mon Nov 30, 2015 7:18 pm

Sound or Tone input to a Pi

Mon Nov 30, 2015 7:27 pm

Not sure if the beginner forum is the right place to post this but I'm a beginner with the Pi so I hope the is the right place.

I'm finding a lot of information about sound on the PI, specifically about sound generation but I haven't been able to find anything on reading sound, specifically any abilities to read tones and recognize their frequencies. I'm working on having the ability to read touch tone off of the standard phone system and was wondering if anyone has worked with or knows about any hardware that can translate (or read) tones, either from a mic or directly off of a phone receiver.

Would appreciate any help in this area.

Thanx!

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Sound or Tone input to a Pi

Mon Nov 30, 2015 10:06 pm

There's no sound input device on a RPi. So you're either going to need a sound card that connects on the GPIO pins or you'll need a USB sound card.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

spmathis
Posts: 3
Joined: Mon Nov 30, 2015 7:18 pm

Re: Sound or Tone input to a Pi

Tue Dec 01, 2015 11:35 pm

DougieLawson wrote:There's no sound input device on a RPi. So you're either going to need a sound card that connects on the GPIO pins or you'll need a USB sound card.
Thanx Doug - I'll have to look for a USB sound card (though I don't think I've ever seen or heard of one...

User avatar
Douglas6
Posts: 4853
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Sound or Tone input to a Pi

Wed Dec 02, 2015 12:17 am

spmathis wrote:I'll have to look for a USB sound card (though I don't think I've ever seen or heard of one...
There are a ton out there, I have a couple based on the CM108 chipset that are good and cost around $5. But I would research tone detection chips first. 35 years ago Radio Shack had one for DTMF. Coding tone detection software is not trivial; do some research on the Raspberry Pi and FFT. You might also look at the 'Aubio' Python library.

SiriusHardware
Posts: 503
Joined: Thu Aug 02, 2012 9:09 pm
Location: UK

Re: Sound or Tone input to a Pi

Wed Dec 02, 2015 12:54 am

If your interest is purely in decoding DTMF tones like those used by touch tone telephones then it would be much, much easier to use a dedicated DTMF decoder chip to handle the tone side of the tone input.

For example, there's the MT8870, which has a 4-bit parallel data interface (+ strobe) or the MT3370 which has a simple 'serial' data output format.

Typically, ICs like this use just a few components and a commonly available 3.57Mhz crystal. All of them output digital-level signals which represent the tones being received, although you might want to look for a chip which is specifically 3-volt friendly, otherwise you will have to use level converters or dividers between the chip and the Pi.

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Sound or Tone input to a Pi

Wed Dec 02, 2015 1:19 am

Douglas6 wrote:
spmathis wrote:I'll have to look for a USB sound card (though I don't think I've ever seen or heard of one...
There are a ton out there, I have a couple based on the CM108 chipset that are good and cost around $5. But I would research tone detection chips first. 35 years ago Radio Shack had one for DTMF. Coding tone detection software is not trivial; do some research on the Raspberry Pi and FFT. You might also look at the 'Aubio' Python library.
DTMF decoding is trivial using the multimon program. The DTMF decoding chips are hard to get these days and quite obsolete.

As for USB sound cards:
http://www.dx.com/s/usb%2bsound?PriceSort=up

Starting at about $2.

User avatar
Douglas6
Posts: 4853
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Sound or Tone input to a Pi

Wed Dec 02, 2015 1:36 am

Yikes, I seem to be targeted. But there you go, try multimon.

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Sound or Tone input to a Pi

Wed Dec 02, 2015 1:39 am

Douglas6 wrote:Yikes, I seem to be targeted. But there you go, try multimon.
No. I could easily have replied to SiriusHardware.

SiriusHardware
Posts: 503
Joined: Thu Aug 02, 2012 9:09 pm
Location: UK

Re: Sound or Tone input to a Pi

Wed Dec 02, 2015 2:19 am

ame wrote:
Douglas6 wrote:Yikes, I seem to be targeted. But there you go, try multimon.
No. I could easily have replied to SiriusHardware.
Indeed, but we use several different DTMF decoder ICs in quite a lot of the products we make where I work - I haven't noticed that we are suffering from any shortage of them and we make tens of thousands of such products every year.

The manufacturers spent a lot of time over the years honing these things to reject false signals, cope with a wide range of input signal amplitudes, etc - that's a lot of useful work which your software then doesn't have to care about.

Any and all working solutions are valid but for a from-scratch effort, a hardware decoder IC combined with relatively simple reader code is always going to be easier than trying to write your own two-tone decoder software from scratch.

If there are prebuilt software modules or solutions etc already out there, then that's great.

Navyscourge
Posts: 258
Joined: Sat Oct 24, 2015 1:50 pm

Re: Sound or Tone input to a Pi

Wed Dec 02, 2015 8:46 am

There is this blog: http://asliceofraspberrypi.blogspot.co. ... evice.html

I have this device (a pack of 3! - cheap) but have not yet tried to get it working. Maybe soon ;)

spmathis
Posts: 3
Joined: Mon Nov 30, 2015 7:18 pm

Re: Sound or Tone input to a Pi

Fri Dec 11, 2015 1:26 am

Thanx everyone the has responded to this post. a lot of things for me to look into but that's what I'm here for.

Thanx again. I'll post back with what I find.

jwl
Posts: 5
Joined: Mon Apr 17, 2017 2:21 pm

Re: Sound or Tone input to a Pi

Thu Mar 29, 2018 2:49 pm

Decoding DTMF in software is not difficult and does not require a lot of processing power.
Here is an example which generates and decodes the tones.

https://github.com/wb2osz/direwolf/blob/master/dtmf.c

Return to “Beginners”