Info
此问题已关闭。 请重新打开它进行编辑或回答。
Help create a DTFM decode function
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!