DTMF decoder .wav files code

8 visualizaciones (últimos 30 días)
Danylo Begim
Danylo Begim el 8 de Nov. de 2019
Hi i copy the code from one guy in this forum ,but it doesn`t work for me. Could you please help me wit this? Actually i alredy found where is the problem. but know i have another one.Know the code works good, but i have 1 digit more then one time. Where i can change it? I already tried to change it in spectrogtam function. I attached my signal in .rar file
Thank you for the help!
clear all;clc;close all;
[x,fs]=audioread('9234567.wav');
% [S,F,T] = spectrogram(x, 1024, 512, 256*3, fs, 'yaxis');
[S,F,T] = spectrogram(x,2100, 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 1366 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
  2 comentarios
Star Strider
Star Strider el 8 de Nov. de 2019
I attached my signal in .rar file
Where?
Danylo Begim
Danylo Begim el 8 de Nov. de 2019
Sorry, i forget to attach. Now it`s here

Iniciar sesión para comentar.

Respuestas (1)

Daniel M
Daniel M el 8 de Nov. de 2019
It's a problem with your window size. Like I mentioned in a previous iteration of this question, you can look detect a proper window size (or epoch length) by looking at the signal in the time domain. But it depends on the timing of the numbers the user enters. Your case seems pretty ideal in that the numbers are played for a uniform period of time, with uniform spacing in between. Therefore, your window size should just be the length of the signal divided by the number of digits. And you don't need an overlap. This works:
[S,F,T] = spectrogram(x,round(length(x)/7), 0, 256*3, fs, 'yaxis');
Note: this is not a general solution to your problem, and will only work in the ideal case described above, and for only 7 digits.
  1 comentario
Dharshana Jayalath Ralalage
Dharshana Jayalath Ralalage el 15 de Ag. de 2021
what if i have a audio file with 10 digits? thank you in advanced

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by