I built a telephone keypad sound generator using Max/MSP. The goal of this tutorial is to accurately produce the sound of a telephone keypad by pressing on its corresponding number.
I hit many hurdles on the way and I am pretty certain that this is not the best way, but it does the job.
This is what the telephone keypad user interface looks like:

You can listen to what it sounds like below:
Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.
If you have Max/MSP you can download my patch by right clicking and saving HERE or by copying the text after clicking the link and pressing alt+command+N in Max. If you don’t have Max/MSP you can download a fully functional demo here, which works for 1 month. Or you can try to re-create the telephone keypad by downloading a free equivalent called Pure Data [Pd].
the process
Okay, here we go. How it works is each button on the keypad is mapped to two frequencies which is why it is called ‘dual-tone multi-frequency’ or DTMF. So first we need to find the frequency chart so we can map the keys to their right tone. Where else would we quickly find this kind of information than on Wikipedia!

With this matrix we can start building the patch. The first step is to create each sine wave (same as the chart) using [cycle~] the second step is to add [+~] the sine waves from the top with the ones from the side. Just like this:

Next is the [selector~] object which is the heart of the patch (bottom left of picture). The argument for [selector~] is 16, which means 16 inputs and 1 output (mono). The sum of each 2 frequencies has its own input and [selector~] has 16 different message boxes attached to it.
The user interface is the keypad on the left in the image below. Each key (which is just a message box) is connected to its appropriate [message] number which tells [selector~ 16] which input to let pass.
At the same time, the [message] that is selected is sent to [send dialbang], which tells it to send a bang.
The bang is received by [receive dialbang] which triggers [message 1].
I am using [message 1] and [message 0] as an on/off switch for each key. Why am I not just using a toggle? Well for the keypad to be ‘performed’ the on/off has to correspond with the button being pressed. In other words, when the mouse clicks on the number of the keypad then the corresponding sound starts and continues until the user lets go, just like a real keypad.
I had a hard time here, and tried many things but the one that seemed to work as I wanted is the [mousefilter] object. It sends a bang only when the mouse click is let go. Perfect!
So this little setup means that when we click on the keypad, the corresponding frequencies are selected and the signal is sent to the multiply [*~] object which is multiplied by 1 [message 1] so it lets the signal past. When we let the mouse go, the [mousefilter] object sends a bang to [message 0] which therefore multiplies the signal by 0 and switches it off.

Finally, the last step before the sound is played back is to multiply [*~] the signal by 0.4 which makes it the loudest possible but with enough room to not clip.
The whole patch looks like this
Categories
Free Software
Sound Design Links
latest #tas tweets
- http://twitpic.com/1235gz - eu e o #tashttp://twitpic.com/1235gz - eu e o #tas […]LeLuquee (ϟ αℓessαndrαα ')
- #Blog do #Tas. Afinal: quando volta o CQC? http://tiny.cc/marcelotas#Blog do #Tas. Afinal: quando volta o CQC? http://tiny.cc/marcelotas […]tremma (Tremma SJC)
- #jobs #TAS North West Casual DSACS Support: Anglicare Tas http://url4.eu/1L5ti#jobs #TAS North West Casual DSACS Support: Anglicare Tas http://url4.eu/1L5ti […]JobseekerAlerts (Jobseeker Alerts)








No Responses to “How to Build a Telephone Keypad in Max/MSP {sound + tutorial}”
Please Wait
Leave a Reply