Borrar filtros
Borrar filtros

How can I remove the discontinuity in concatenation of wav arrays?

4 visualizaciones (últimos 30 días)
Hello, I'm a beginner in matlab. I have a question: I have tried to concatenate two wav arrays, and I have played the result of the concatenation. There's a small discontinuity between the two sounds in the reproduction, although I have eliminated a number of samples at the end of the first sound and the beginning of the second. I can't remove other samples without damaging the information contained in the signals. How could I solve this problem? I wish the final sound seemed as natural as possible (the two initial sounds are syllables, and the final one is the word formed by the two syllables). This is a piece of the code:
%The two sounds have the same sampling frequency.
[sound1,Fs]=wavread('ca.wav');
sound2=wavread('ne.wav');
sound1=sound1(1:(size(sound1,1)-500));
sound2=sound2(50:end);
sound3=[sound1' sound2'];
sound(sound3,Fs);

Respuesta aceptada

Wayne King
Wayne King el 15 de Sept. de 2012
Editada: Wayne King el 15 de Sept. de 2012
How big is the discontinuity? I'm assuming the two waveforms are both essentially zero-mean waveforms. If not, you'll want to shift them to make them zero mean.
Then, one thing you can do is to apply a moving average filter to smooth out the discontinuity. I'll use a 5-point moving average filter here. I would try a low order filter first, because you probably don't want to filter your signal too much (it is a lowpass filter). The larger the magnitude of the discontinuity, the higher order you would need.
t = 0:0.01:1;
x = cos(2*pi*t).*(t<=0.5)+cos(2*pi*t-pi/8).*(t>0.5);
plot(t,x,'r'); hold on;
h = 1/5*ones(5,1);
y = filtfilt(h,1,x);
plot(t,y,'b')
  3 comentarios
Wayne King
Wayne King el 15 de Sept. de 2012
sound1 = detrend(sound1,0);
sound2 = detrend(sound2,0);
Assuming that the two waveforms don't have more complicated trends than a DC shift.
Micaela
Micaela el 15 de Sept. de 2012
Ok, now the final sound is really better. Thanks a lot!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by