how to compare two audio signals with Matlab -
i have 2 audio signas want compare using matlab, problem can hear difference between them loud , clear, when use function pwelch
compare psd ,i don't see difference between them,any idea how can compare them different methode ! in advance ! ps: 1. ask quesiton in dsp.stackexchange had no answer! 2. i'm not asking codes, that's why didn't put mine !
update
after answer of @bas swinckels here code par i'm using result , still can't see way describ ?
clear; clc; [x0,fs] = audioread('nonoise.wav'); x0 = x0(:,1); [y0,g] = pwelch(x0,hamming(512)); plot(g,10*log10(y0)); grid on [x50,fs] = audioread('50% noise.wav'); x50 = x50(:,1); [y50,g] = pwelch(x50,hamming(512)); hold on ; plot(g,10*log10(y50),'r'); [x100,fs] = audioread('100% noisy.wav'); x100 = x100(:,1); [y100,g] = pwelch(x100,hamming(512)); hold on ; plot(g,10*log10(y100),'g'); %% spectrogram spectrogram(x0,hann(64),32,64,fs) figure(); spectrogram(x50,hann(64),32,64,fs) figure(); spectrogram(x100,hann(64),32,64,fs)
and here result :
can tell me how noise or effect i'm adding source influences spectrum ?
you try plot spectrogram of both signals so:
spectrogram(x, hann(nfft), nfft/2, nfft, fsample)
when calculate psd pwelch
, average spectrum , lose temporal information: not show if signal louder @ beginning or @ end. calculating spectrogram pretty similar ears perceive, measure sort of spectrum function of time. if can hear difference, should show difference in spectrogram enough snr.
when make spectrogram, should try play frequency , temporal resolution, since follow sort of heisenberg law. making fft window short (by chosing small nfft
) give temporal resolution, worse frequency resolution, , other way around.
Comments
Post a Comment