LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Audible clicks in noise generation/acquisition vi

Solved!
Go to solution

Hey Everyone! 

 

Quick Background:

I'm trying to make a vi to perform room acoustics measurements.  The goal is apply octave-band filtered white noise to a room until a steady-state level is reached, then turn off the sound source and measure the decay of the sound field in the room.  So, my vi generates white noise , filters by specified octave parameters, and then simultaneously sends the output and starts data acquisition using 2 DAQ assistant blocks (both triggered by an external function generator).  I set the output DAQ  assistant to output N samples (same number as generated by the simulate signal block) and the input DAQ is set to acquire more samples than the simulate signal block generates, so that I continue acquiring signal after the speaker cuts off and by doing so measure the decaying sound field in the room.

 

The Problem:

The vi works beautifully except that when the speaker cuts off at the end of the N samples there is a very noticeable audible click, which must correspond to some kind of spike in the output single at the end of my N sample output.  This is a big problem because it's going to alter my sound-field decay measurements. (see 1st attachment for a screenshot of my vi)

 

Solutions I've tried without success:

1)  I thought the click might be caused by abruptly cutting off the excitation signal, so I tried inserting a window block to give a smooth envelope to the beginning and end of my signal.  The envelope faded the volume in and out nicely, but there was still a very noticeable click and the end of the output (after the fade-out).

2) I tried to zero-pad the end of the signal, thinking I might be able to output a zero-amplitude signal while I measure the decay-curve and hopefully delay the seemingly inevitable click until after I capture my data.  However, when I do this, my output DAQ Assistant gives me an error that the sampling rate is 1 and the valid range of sampling rates are 1000 to 204,800.  Apparently the output DAQ is being sent a single sample out of my output data array.  (see 2nd Screenshot below)

 

I'm really stumped, so any help would be very greatly appreciated.  Whether its a way to correctly implement my solution #2 from above, a new method of getting rid of or delaying the click, or if someone can point me to an existing vi that will perform the noise-excitation/acquisition functions that I need.

 

FYI, hardware is a PXI-4461.

 

Thanks in advance!

 

Michael K

 

 

0 Kudos
Message 1 of 8
(2,856 Views)

You should use proper Labview. Not the flimsy Express VIs. Experienced Labview programmers seldom or never use Express VIs. And it is reason why. Using Express VIs is like peeing in your pants a cold winter day. You may get warmer for a few minutes, but after that you will get very coldSmiley Surprised

I did not have the time to de-Express your program. But I made some mods. In order to zero pad the signal. I have not tested it but take a look.

.

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 2 of 8
(2,845 Views)

The first LV program I ever wrote (in LV version 1.2) generated audio pulses as stimulus to animals to test their hearing, not all that different from your room acoustic testing.  We also had problems with transients at the switching.

 

1. Several sources are possible. (a) The audio amplifier may do strange things with pulsed signals.  (b) Beginning or ending the signal at a non-zero value will cause clicks.  Your attempts to window or zero pad are the right kinds of things to do.  In addition make sure that the DC component is zero. (Take the mean of the signal and subtract it from the signal). (c) If there are any kinds of signal switches in the audio path, check their charge injection specifications.  These were the biggest culprit in our original system and the hardest to eliminate.

 

2. As mentioned above, not only should the signal start and end at zero, its mean value should also be zero.

 

3. Try generating your signal as you do now, then multiply it by 0.00001 or some other small number which should render the signal inaudible without being zero.  If you still get clicks, then the problem is not in the signal generation or windowing, but elsewhere in the system.  See 1 (c) or 2.

 

Lynn

Message 3 of 8
(2,838 Views)

Thanks for taking a look at the zero padding, I really appreciate it.  Unfortunately, I have Labview 9 so I can't open the vi you attached.  I hate to ask too much, but is there any chance you could save it as a version that would be backward compatible and repost?

 

And I know I probably shouldn't be using the Express VIs, but I guess I'm still a novice and haven't had the time or motivation to learn to properly use the DAQmx.  I guess I now have the motivation, so I just need to find the time :).

 

Thanks again,

Michael

0 Kudos
Message 4 of 8
(2,826 Views)

Lynn,

Thanks for your advice.  It looks like the mean of the noise signal is in fact zero (to 5 decimals) but I went ahead and set up the vi to subtract the mean from the signal anyway, just to be safe.  As per your suggestion #3, I set the noise amplitude to a very small number, and I do still get clicks.  In fact, when I disconnect the speaker and just loop the labview output back to the input, basically all I see is a decaying ring at the beginning of the signal and the click at 2 sec when the output stops (see attached screenshot).  If there is charge-buildup somewhere in the system, it looks like it has to be at the output of the NI hardward itself.  Hopefully that's not the case, because I don't know what I can do to fix that, but it is something I hadn't thought to consider so thanks for pointing it out.

 

For the meantime, I guess I'll continue to try to zero-pad the beginning and end of my signal and hope that eliminates the click or at least delays it long enough that it doesn't interfere with the measurement.  Any suggestions on how to append some zeros to the end of the signal without changing it to a data-type the DAQ assistant doesn't like?

 

Thanks,

Michael

0 Kudos
Message 5 of 8
(2,815 Views)

I do not work with the DAQ Assistant so I cannot help with that.  Can you make the data set 30 seconds long with the stimulus 5 0r 10 seconds in? That might move the transients far enough in time that they do not become a factor.

 

Another idea: Does the DAQ Assistant configure and shut down the AO for each stimulus pulse?  If so, switch to the standard DAQ drivers and configure once outside the loop, write to the output inside the loop, and shut down the AO after the loop. There may be a small transient (but large enough to make an audible click) when the AO is "activated."

 

Lynn

0 Kudos
Message 6 of 8
(2,809 Views)
Solution
Accepted by topic author MrMike84

Here is the code in 9.0 . As I said I have not tested it, as I have no daq unit on this PC

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 8
(2,801 Views)

Con Rouge,

Thanks!  It looks like your modification works beautifully, great work!  As you can see from the attached screen shot, the click is now delayed sufficiently so it shouldn't interfere with the measurements.  There is still a much more mild click that occurs intermittently at the end of the noise, but it doesn't happen all the time.  I'm guessing this less dramatic click happens if the noise happens to end on an extreme value and then jump to zero when the zero padding starts.  But I think some repetition and averaging should take care of that since it only occurs occasionally.  I think this is an excellent short-term solution so I can start taking measurements.

 

Lynn,

Thanks for the additional insights!  I think you're right about the AO shutting down after each pulse and that it would be best to switch to the standard DAQ drivers, and that will definitely be the long-tem solution, along with trying to insure the first and last samples of the noise are zeros. 

 

Thanks again, both of you!  I really apprecitate you taking the time to help out a noob.

Michael

0 Kudos
Message 8 of 8
(2,791 Views)