Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python: Build a DTMF encoder. The Wikipedia page for DTMF Signaling gives a table of the tonal frequencies. For each keypress of a telephone

In Python:

Build a DTMF encoder. The Wikipedia page for DTMF Signaling gives a table of the tonal frequencies. For each keypress of a telephone keypad, the system combines a sinusoid of row tone and a column tone and sends both. Code below should explain that in the final few lines.

image text in transcribed

Your code should take a string of arbitrary length, e.g., "123-456-7890" and encode the values that correspond to valid keys and ignore the rest. E.g., "12 34aB-cd$%^&76" should output the tones for "1234abcd76" (allow both lowercase 'b' and uppercase 'B', etc.). Make each keypress a half second long and put a tenth of a second of silence between the keypresses. Do not add a silence period at the end. Ideally, both the silence length and the keypress length should be easily settable (and resettable) parameters.

Use Fs = 8000, the standard sampling rate for telephone quality audio.

What I have as of yet: (Not even close to working, but you can modify it to make it work according to specifications above)

import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') from IPython.display import Audio, Image import scipy.signal as sig %matplotlib inline

def __get_number(self, freqs): number = 0 keys= '1','2','3','A',\ '4','5','6','B',\ '7','8','9','C',\ '*','0','#','D' F1 = [697,770,852,941] F2 = [1209, 1336, 1477, 1633]

print ('*************************') print ('1\t2\t3\tA') print ('4\t5\t6\tB') print ('7\t8\t9\tC') print ('*\t0\t#\tD') print ('*************************')

xString = input("Enter your number: ") x = int(xString) xlist = list(str(x))

#Declaring the lengths of x N = len(xlist) Fs = 8000 t = np.linspace(0,1,Fs) hifreq = 0 lowfreq = 0 n = 0 while n DTMF keypad frequencies (with sound clips) 1209 Hz 1336 Hz 1477 Hz 1633 Hz 697 Hz 1 770 Hz 852 Hz7 941 Hz 4 0 DTMF keypad frequencies (with sound clips) 1209 Hz 1336 Hz 1477 Hz 1633 Hz 697 Hz 1 770 Hz 852 Hz7 941 Hz 4 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions