LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

generate sound VI not working

Solved!
Go to solution

hello,

I was trying out waveform generation with the waveform generation palette but I don't get any tone for sine wave, with triangle and other i get some sound but not sure if they are ok. Following is the vi,

1.jpg

 

I expected tone sound like the one from the the sound generate example in the labview help. I even replaced the waveform generation block for sine and tried with simulate signal block but i don't get any sound.

 

 

0 Kudos
Message 1 of 9
(2,442 Views)

I'd try to wire (correct) sampling info to the waveform.vi.

 

The sound VI simply plays the samples of the waveform, I suspect it completely ignores the frequency (that is 1000 Hz by default). The 1000 Hz of the waveform and the 44100 Hz of the audio don't match.

 

Also, post the VI if you want us to try and\or correct it.

0 Kudos
Message 2 of 9
(2,415 Views)

hi,

i tried your suggestion to configure the sampling rate to 44100Hz and samples 5000 but it did not work. Attached is the vi file.

 

0 Kudos
Message 3 of 9
(2,397 Views)
Solution
Accepted by ee-diary

Your VI works just fine (you need to place the sampling info cluster outside the case and wire it in all cases.)

 

Your frequency knob goes from 0 to 10 HZ. It is very unlikely that your PC speaker will be able to produce such a low frequency sound, so change the scale of the knob from e.g. 0..1000 and try a frequency that is in the audible range, e.g. 300Hz.

 

I don't think you need the phase control, but if you use it, you want it to go up to 360 degrees.

0 Kudos
Message 4 of 9
(2,378 Views)

In the Graphics and Sound/Sound/Sound Output Palette (on the Block Diagram), there is a VI called "Configure" (its Icon is a Wrench just above a Speaker).  According to the Help, this "Configures a sound output device to generate data".  If you "feed it" a Sound Format cluster of 44100, 2, 16, it will create a 16-bit stereo sound for playing at 44.1 kHz (standard "Sound Output" D/A rate).  Wire, say, 5000 samples/channel and feed this to the "Write" function on this Palette.  Now you can generate a Waveform to play using, for example, the Simulate Signal Express VI.  For example, if you give the Express VI parameters of 440 (Hz), it will generate 5000 points of the note A-440 (to which an orchestra tunes, played by the oboe).  Convert this Dynamic Data Wire to a Waveform, feed this into the "Data" input of the Write (sound) VI, and run it.  (You might want to turn the speaker volume down first).

 

When in doubt how to use or wire any of these VIs on the Sound Palette, write click the VI and choose Help.  Be sure to read the Detailed Help, if present.

 

Bob Schor

0 Kudos
Message 5 of 9
(2,376 Views)
Solution
Accepted by ee-diary

@altenbach wrote:

Your VI works just fine....


Here's a quick cleanup with better default values. Try it.

 

altenbach_0-1636988586904.png

 

Of course you could set the volume instead of the amplitude. In this case, the volume needs to be inside the loop.

 

Message 6 of 9
(2,372 Views)

hi,

nice and neat solution, thank you.

 

i don't know whether i should be asking here or create new thread but i had several questions,

 

- how can i output the signal selectively on left and right channel separately?

- want to set the frequency to max output frequency like 20KHz maybe, how best to do it?

- as i understand the amplitude level range is between +1V and -1V for soundcard on PC, so is using 0 to 1 range as amplitude the same? How accurate is the amplitude level like if 100mV is set do we get 100mV on actual output signal from the generator

 

thank you

 

 

0 Kudos
Message 7 of 9
(2,351 Views)

Sound cards are typically AC coupled and probably not very accurate for exact voltages. You cannot output DC voltages.

You can set the limits for data entry (right-click the control...data entry.. set upper and lower limits).

You can create an array of two waveforms and set each amplitude according to your needs (see the help).

Message 8 of 9
(2,334 Views)

Here's one possibility to implement a balance feature.

 

altenbach_0-1637000407381.png

 

Message 9 of 9
(2,333 Views)