Info

This question is closed. Reopen it to edit or answer.

Help create a DTFM decode function

1 view (last 30 days)
xoxox
xoxox on 5 Aug 2019
Closed: MATLAB Answer Bot on 20 Aug 2021
Need help create a code that can decode the ringphones. When I run function lab 9. i will get the answer such as
>> lab9
s1: 123456789*0# is O.K.
s2: 123456789*0# is O.K.
s3: 123456789*0# is O.K.
s4: 123456789*0# is O.K.
s5: 123456789*0# is O.K.
s6: 123456789*0# is O.K.
complete this code:
function str=dtmfcode(s,fs)
function lab9
%
% Make sure you download all the test files s1.wav -> s8.wav
nFiles = 6;
for i = 1:nFiles
fileName = ['s' num2str(i)];
[s, fs] = audioread(fileName);
num = round(32768 * s(end-12:end));
indx = find(num);
num = num(indx(1):end);
str = char(48 + num);
out = dtmfdecode(s, fs);
fprintf(1, '%s: ', fileName)
if (~isempty(out))
if (strcmp(out(:), str(:)))
fprintf(1, '%s is O.K.\n', out);
else
fprintf(1, 'Got %s instead of %s\n', out, str);
end
else
disp('Empty');
end
end
return

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!