Comparing two audio signals (guitar chords recognizer)

9 ビュー (過去 30 日間)
Phantom.i7
Phantom.i7 2014 年 3 月 4 日
回答済み: KIRAN SL 2017 年 6 月 16 日
I want to compare two audio signals and check their similarities however it seems i cannot compare them.. this is supposedly my process.
  • > input audio signal (1 strum on guitar)
  • > read the data and convert to frequency domain
  • > get the raw audio file > read > convert to frequency domain
  • > check their similarities
function guitartrial
recObj = audiorecorder;
disp('Start speaking.')
recordblocking(recObj, 4);
disp('End of Recording.');
myRecording = getaudiodata(recObj);
wavwrite(myRecording,'chordread.wav');
[x, Fs] = wavread('chordread.wav');
[x1, Fs1] = wavread('chordA.wav');
Y = fft(abs(x));
Z = fft(abs(x1));
subplot(3,1,1), plot (Y);
subplot(3,1,2), plot (Z);
[C1, lag1] = xcorr(Y,Z);
subplot(3,1,3), plot(lag1/Fs,C1);
ylabel('Amplitude'); grid on
title('Cross-correlation between Template 1 and Signal')
end
whenever i run the program i get this..
It seems wrong to me.. Im new in matlab programming so If someone can help me I would be very grateful. Is my process wrong? how can I get the percentage of similarity? is there another method that is best suited for my application? thank you very much

回答 (2 件)

Suneesh
Suneesh 2014 年 3 月 4 日
If your confusion is regarding the first and second plots then that is because yo uare plotting the complex values returned by FFT. Try:
subplot(3,1,1), plot(abs(Y));
subplot(3,1,2), plot(abs(Z));
Also, in
Y = fft(abs(x));
The abs(x) is not required since audio signals are real signals.
  2 件のコメント
Phantom.i7
Phantom.i7 2014 年 3 月 5 日
[C1, lag1] = xcorr(Y,Z);
is that correct or should i make it
[C1, lag1] = xcorr(abs(Y),abs(Z));
Suneesh
Suneesh 2014 年 3 月 11 日
If you need to look for similarities in the magnitude of the two FFT results then
[C1, lag1] = xcorr(abs(Y),abs(Z));
is correct. This does not consider the phases which is lost by the ABS operation. Also, if the samples are of different lengths then make sure both are normalized.

サインインしてコメントする。


KIRAN SL
KIRAN SL 2017 年 6 月 16 日
what is the correlation plot means?

カテゴリ

Help Center および File ExchangeMeasurements and Spatial Audio についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by