Definition of numbers by ear
In this article I will talk about a simple program for processing , which “listens” to the microphone and determines the numbers dialed on the phone in tone mode.
Univer stayed in the past about ten years ago, but all this time nostalgic feelings and longing for science have not left me. There is a feeling that I did not complete my education, or we ran too fast. Fortunately, modern platforms allow you to feel like a student all your life.
Lab writing No. 3 from the course “Basics of digital signal processing” LETI on the platform openedu pushed me to write this article .
If you click on the buttons of the phone (or here ), you can hear that each character has its own frequency, or rather even two, and this combination uniquely encodes the character.
Our task is to select the two strongest frequencies from the noisy signal and check whether they encode a character in accordance with the table:
I used processing because it has all the primitives for working with the microphone and the Fourier transform.
The algorithm is as follows:
You can build and run the program in the form of standalone jar from source , you can use the phone or this page to generate sounds .
The next step I want to implement the same thing on the Arduino.
Foreword
Univer stayed in the past about ten years ago, but all this time nostalgic feelings and longing for science have not left me. There is a feeling that I did not complete my education, or we ran too fast. Fortunately, modern platforms allow you to feel like a student all your life.
Lab writing No. 3 from the course “Basics of digital signal processing” LETI on the platform openedu pushed me to write this article .
Principle of operation
If you click on the buttons of the phone (or here ), you can hear that each character has its own frequency, or rather even two, and this combination uniquely encodes the character.
Our task is to select the two strongest frequencies from the noisy signal and check whether they encode a character in accordance with the table:
1209 Hz | 1336 Hz | 1477 Hz | 1633 Hz | |
---|---|---|---|---|
697 Hz | one | 2 | 3 | A |
770 Hz | four | five | 6 | B |
852 Hz | 7 | eight | 9 | C |
941 Hz | * | 0 | # | D |
I used processing because it has all the primitives for working with the microphone and the Fourier transform.
The algorithm is as follows:
- we represent the signal in the form of a spectrum, fft.analyze returns us an array of float []
- find the number of reference n 1 corresponding to the maximum amplitude
- we will annul him and everything in a certain neighborhood (chosen wisely), so as not to catch 2 close frequencies
- find the 2nd number of reference n 2 , corresponding to the maximum of the remaining amplitudes
- According to the numbers n 1 and n 2 we find the corresponding frequencies by the formula:
f n = f d n / N
where f n is the sampling frequency: 44100 Hz, N is the number of samples (power of two) - determine which frequencies from the table correspond to those found (with a certain tolerance of ± 35 Hz) and find the desired symbol
What happened
You can build and run the program in the form of standalone jar from source , you can use the phone or this page to generate sounds .
The next step I want to implement the same thing on the Arduino.