LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Audio Delay

Solved!
Go to solution

Hi,

 

I'm trying to add a delay in one of the signals that is generated in my system, so I want to be able to add a delay to one of the signals so that signal lags the other signal so using when using headphones it sounds like the sound is coming from either the right/left channel. I want the amplitude of both the signals to be the same and I just want to add a delay, so for example If I delayed the left channel speaker by 0.005 then the user should be able to tell that the sound is coming from the right channel even though the amplitudes of both the signals are the same. I've attched my attempt at this. I want one of the signals to be delayed continuosuly and not just at the onset. So I want one of the channels to be delayed by a certain amount of time compared to the other channel so using headphones it sounds like sound is coming from one of the sides of the head. 

 

Thanks 

0 Kudos
Message 1 of 8
(3,971 Views)

Several things about your VI do not make much sense.

 

1. Delaying one random signal with respect to another is completely meaningless. The sounds are totally uncorrelated before the delay so the ear/brain/mind system will not be able to detect any difference after the delay. If they are correlated, only generate one signal and modify it in two different ways. Try a sinusoidal signal.

2. Changing t0 will not have any effect. Sound Output Write ignores the timing information in the waveforms.

3. Since you are using error status as one of the ways to stop the VI, it would make more sense to wire it to the output of the Sound Output Write.vi to catch all the errors. Wiring errors through the signal generation VIs is probably a good idea also.

 

Here is a version which changes the phase of one signal with respect to the other using sine waves. It has some small glitches when the phase is changed but it does seem to "move" the apparent source position. I am not sure exactly where the speakers are hidden in my computer so I cannot verify the performance.  For my old ears it seemed that the position changes were more noticeable with lower frequencies.  Delay Right is the phase of one signal in degrees. The other signal has the pahse set to zero.

 

Lynn

0 Kudos
Message 2 of 8
(3,948 Views)

HI,

 

Firstly, thanks a lot for the attcheded file. Sorry for the badly built system, I'm new to Labview so I'm still learning. I was wondering is there an another way to shift the sound so it feels like it is coming from either the left/right channel while the amplitude of both the signals is the same. This is because I have to add this VI to another system and the signals that I use from that system are also sinosoidal signals but however I can't use their phase measurements to shift the sound in the headphones, becuase I have to add a delay of some sort to shift the position of the sound . So I was wondering if adding a silence in front of one of the channels will shift the sound position when listening with the headphones. I did some testing with the file that you had attached and for the most part the system seems to be working fien but the sound seems to move from one ear to the other, rather than sound just coming from one ear alone

 

 

I've trying to do what they're doing in the video in Labview, any examples or suggestions would be greatly appreciated. Thanks again 

http://www.youtube.com/watch?v=CuYNFv2Oc08 

 

Kg21

0 Kudos
Message 3 of 8
(3,924 Views)

@JohnSold, low frequencies are alot hard to determine location of, that's why home cinema sound systems have 1 sub bass, you cant place the sound anyway. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 8
(3,914 Views)
Solution
Accepted by kg21

Yameada,

 

That is true. I find that signals of 300-800 Hz are easier to work with than kilohertz signals as far as my old ears are concerned.

 

When the delays approach the period of the signal the ear/brain/mind system can be easily confused. With more complex signals like music or speech larger delays may still work.

 

Kg21,

 

Here is a modifcation of  the VI I posted before which actually inserts a delay.  As in the video you linked the delay consists of a waveform segment of zero amplitude. To keep the signals for both the right and left channels the same length I prepended a segment to one channel and appended it to the other. This results is short silent periods. Only one delay is defined. Negative values will interchange which channel has the delay.

 

On my computer a definite localization can be heard.

 

Lynn

0 Kudos
Message 5 of 8
(3,893 Views)

johnsold,

 

Thanks again for the all the help. I have tested the VI for a couple of hours now but there is only issue that I can't seem to fix which is that when I add delay for example to the right channel I except the sound to be coming from the left channel 'the (sound shifts to the left from the middle) but in this system the sound starts off moving to left channel but then it shifts to the right channel and it keeps alternating between the left and right channels whereas I want the sound to be continuously be coming from the left channel when there is a delay added to the right channel. So the right channel is delayed but the left channel doesn't change and the amplitudes of both signals are the same. Also, if there is a delay in front of the left channel the sound position will shift to the right channel and it should be continuously coming from the right channel, this is the opposite case. Other than that everything else works perfectly and I really appreciate the help. 

 

Thanks,

Kg21 

0 Kudos
Message 6 of 8
(3,879 Views)

That is expected. When the delay is >0.5t it'll move toward phase again (as you cant hear the difference on a full waveform). For a music signal, being alot more dynamic, it might be easier to diffrentiate. The correct solution would ofcourse be to "simulate" the sound bouncing around the room and also lower the reflected sound in addition to delay it.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 8
(3,861 Views)

As Yamaeda said, you cannot distinguish between a positive delay of 0.75*T and a negative delay of -0.25*T, where T is the period of the sinusoidal signal. 

 

The code I posted can be easily modified to change the delays and amplitudes of both channels independently. To change the amplitudes just multuiply the respective Y values by the amplitude controls before the Build Waveform nodes rather than changing the generation amplitude.

 

Lynn

0 Kudos
Message 8 of 8
(3,847 Views)