LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a sound (tone) without clicking noise, and how to select left or right speaker

Solved!
Go to solution

Hi All,

I am trying to write write a VI that generates a pure tone of specific frequency and volume, then sends that tone to one speaker or the other (Left or right) for use in teaching students about audiology (those hearing tests you may have taken where you hear a noise in one ear or the other).  I have created a rather primitive VI to accomplish this, but I am plagued by a few issues:

 

1) At some frequencies but not all, the VI generates a clicking sound at the start and stop of the tone (I believe this is related to repeating configuration and call of the hardware, but I don't know how to set this up ahead of time and avoid it - and why doesn't it create the clicking sound at all frequencies?).

 

2) At some frequencies (14000Hz and higher), I don't hear the tone at all on my computer speakers (I still hear the click before and after, but I don't hear the tone. I know what you might be thinking, but no, this is not a hearing deficit on my part 🙂

 

3) I would like to be able to direct the tone selectively to the left speaker or right speaker, but right now my VI only allows me to pick the "number of channels" (for which I presume "2 channels" means both left and right), but I don't know how to selectively pick only one channel or the other.

 

Thank you for any helpful suggestions you can offer,

Eric

 

0 Kudos
Message 1 of 14
(8,969 Views)

Where did you get Generate Sound_subVI.vi? I do not have that and it seems to be where everything happens.

 

I built a similar sound system 25 years ago. The clicks in that system were the result of two things: Using square pulses of sound and DC transients at the switching. Our test subjects could hear the clicks regardless of the tone frequency or amplitude.  

 

The graphs in the top row show waveforms which will probably produce clicks. The lower one probably will not. The lower one is generated by applying a Hanning window to the waveform above it.

 

Lynn

Message 2 of 14
(8,936 Views)

Hi Lynn,

 

To answer your question, the VI I posted is from a project originally started by some of my students; I believe that the Generate Sound_subVI.vi is a routine the students created by modifying the pre-written LabVIEW example VI called Generate Sound.vi (on comparing the two, I see that they are very similar).

 

Regarding the clicks, I made some minor changes to my VI that allowed me to increase the volume slightly on my computer. After doing so, I find that indeed, the clicks are made whenever any sound frequency is generated; however, the clicks are only audible to me if the volume is getting to the high range of its limits (i.e., If I am able to hear the pure tone at a low volume, I don't notice the clicks, but as the tone gets louder, the clicks become more conspicuous.  Also, the clicks are easier to hear when the actual tone is not produced by the VI - still I don't know why that happens).

 

In your reply you mention the "graphs" in the "top row" and the "lower one." To what are you referring? Did you post an attachment of code or an image?  If so, I don't see it.

 

- Eric

0 Kudos
Message 3 of 14
(8,894 Views)

hello bekateen,

 

I also don't have access to the express VI in question, but my *guess* as to why you're hearing these clicks would be a discontinuity in the signal generated.  I would double-check that the generated tone begins and ends at 0V (rather than some arbitrary gain).

 

Regards,

Tom L.
0 Kudos
Message 4 of 14
(8,884 Views)

Hi Tom (and Lynn),

 

Neither one of you have access to the Generate sound_subVI in my code.  Do you mean that when you open my VI all you see is the greyed-out icon with a question mark indicating that the subVI is missing?  If so, here is the subVI.

 

Eric

0 Kudos
Message 5 of 14
(8,878 Views)

Eric,

 

Yes, I intended to include an image. Sorry. Here it is.

 

Clicks.png

 

Thanks for the subVI. With it I hear clicks most of the time except on some of the low amplitude outputs. Interestingly, at frequencies above 10 kHz where my hearing is poor, when I do hear something it is a non-pure sound with a dominant frequency lower than the generated frequency.  I am not sure whether it is something in the sound system on my computer or in my ear/brain/mind acoustic analysis system. Here is what I get with my bad ears.

 

bad ears.png

 

This is what the graph on Generate Sound-subVI shows when I hear the lower pitched sounds. Although the frequency is low enough that it is not aliased, I suspect that I am hearing the envelope rather than the underlying carrier.

 

Funny sound.png

 

I have not played with the windowing yet to see if that reduces the clicks. They could be generated by the Sound Write turning sound on and off.

 

Lynn

Message 6 of 14
(8,867 Views)

How about the control to right or left speaker?  Does anyone have any thoughts on that issue?

0 Kudos
Message 7 of 14
(8,837 Views)

I can't open the vi (still at LV12) however

another source of a click could be the sound driver system itself.

If the DAC run biased and is C decoupled, it is possible that this will create a click when the sounddriver is activated.

 

So open a continous wave generation once, and feed stereo zero to the sound output for 'silence' ...

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 8 of 14
(8,820 Views)

About left and rigth channel:

the sound output is feeded by a two dimensional array containing two arrays, one for each channel.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 9 of 14
(8,812 Views)
Solution
Accepted by bekateen

I put together a quick and dirty tryout without ramp up and down (good thing for a state MC )  so the name is not correct 😉  but my kids are waiting ..... time for weekend

I set the buffer to a quarter second , but however the 'GUI' is not very responsive....

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 10 of 14
(8,807 Views)