Apply a variable delay to an audio signal
Mostrar comentarios más antiguos
Hi,
Ill try to explain my goal, then where I am so far.
I am trying to simulate a moving sound source by creating a 2 microphone signals. The first channel contains a set of harmonic sinusoids with different amplitudes and frequencies. The second channel should be a delayed version of the first channel. I would like the delay to start at zero, move to -1 millisecond, back to zero, then to +1 millisecond before returning again to zero delay. In this way by computing the time delay of arrival with a simple cross correlation it would appear the sound source is to one side then the other.
To accomplish this I have found dsp.VariableIntegerDelay class which I think is suitable for the task, however I believe this is only available in 2011a, I have the student version 2011a. Is there another way to create this variable delay in the second signal?
Help is much appreciated! thanks Jesse
Respuesta aceptada
Más respuestas (1)
Fangjun Jiang
el 5 de Sept. de 2011
If you want to delay a signal, usually you can pad zeros in front of it. Let's say x is your signal data, it's sample time is 0.1 millisecond, then you need to pad 10 zeros at the beginning to reflect 1 millisecond delay.
Ts=1e-4;
Delay=1e-3;
N=Delay/Ts;
y=[zeros(1,N) x];%x is row vector
%y=zeros(N,1);x];%x is column vector
Not sure what you mean by delay -1 millisecond. You want to cut off 1 millisecond of sound? That's easy.
y=x(N+1:end);
3 comentarios
Jesse
el 5 de Sept. de 2011
Daniel Shub
el 5 de Sept. de 2011
One problem with adding zeros is that with the typical sample rate of 44.1 kHz a single 0 adds a delay of over 22 micro seconds. This is over twice the magnitude of the delay that is just detectable. It is much better to add the delay in the frequency domain.
Fangjun Jiang
el 5 de Sept. de 2011
Now I think Daniel's answer using sin(2*pi*f*(t-tau)) is what you want since you are not really delay an existing signal. You are creating two signals with designed delay among them.
Categorías
Más información sobre Signal Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!