Question

Write a Matlab script that 1. Uses your computer’s audio device to record a single DTMF...

Write a Matlab script that

1. Uses your computer’s audio device to record a single DTMF tone as generated by a cell phone (or an app).

2. Decodes and displays the number associated with the recorded tone.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
1. symbol = {'1','2','3','4','5','6','7','8','9','*','0','#'};
[tones, Fs, f, lfg, hfg] = helperDTMFToneGenerator(symbol, false);
helperDFTEstimationPlot1(tones, symbol, Fs, f);

Here is the matlab script for the given question:

2. pc = load('phonecall.mat');

x = pc.x;

fs = pc.fs;

% [S,F,T] = spectrogram(x, 1024, 512, 256*3, fs, 'yaxis');

[S,F,T] = spectrogram(x, 1024, 512*3/4, 256*3, fs, 'yaxis');

Sa = abs(S);

[r, c] = find(Sa >= 30);

Fr = F(r);

Tc = T(c)';

FT = [Tc Fr];

[C, ia, ic] = unique(FT(:,1)); % Find Unique Times

for k1 = 1:size(C,1) % Create Cell Array By Time

FrqTime{k1} = FT(FT(:,1) == C(k1),:); % Time & Frequency Cell

end

original_f = [697 770 852 941 1209 1336 1477]; % DTMF Frequencies

dtmf_dcd = [1 5; 1 6; 1 7; 2 5; 2 6; 2 7; 3 5; 3 6; 3 7; 4 5; 4 6; 4 7]; % Combination Codes w.r.t. ‘original_f’

nbr_map = ['1' '2' '3' '4' '5' '6' '7' '8' '9' '*' '0' '#']; % Number Key Map

for k1 = 1:size(C,1)

freq_dist = abs(bsxfun(@minus, FrqTime{k1}(:,2), original_f)); % Distance Of ‘FrqTime’ Frequencies From ‘original_f’ Frequencies

[~,freq_pos(:,k1)] = min(freq_dist,[],2); % Frequency Positions Of ‘FrqTime’ In ‘original_f’

num_pad(k1) = nbr_map(ismember(dtmf_dcd, freq_pos(:,k1)', 'rows')); % Map To Number Key Pad

end

Add a comment
Know the answer?
Add Answer to:
Write a Matlab script that 1. Uses your computer’s audio device to record a single DTMF...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT