LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stereo sound generation

I have been looking for an example that will allow me to generate two different tones right and left channel using a sound card.

 

All of the examples I can find generate a mono signal of the exact same frequency and amplitude on both channels.  The Sound Output Configure.vi lets you pick one or two channels but if I select one channel what channel is selected right or left? How do I select the Right channels for a 1khz tone and the left channels for a 5Khz tone?

 

BTW: I need to generate the tones not playback a waveform or recorded stereo sound file

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 11
(2,514 Views)

After reacquainting myself with the Generate Sound example, I seem to remember that Sound Output Write will take an array of waveforms as input (one for each channel).

Message 2 of 11
(2,468 Views)

Is this what you need?

Generate Stereo Sound.png

Lucian
CLA
0 Kudos
Message 3 of 11
(2,459 Views)
@Mancho00 wrote:

After reacquainting myself with the Generate Sound example, I seem to remember that Sound Output Write will take an array of waveforms as input (one for each channel).


I will look into that , Thanks!

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 11
(2,425 Views)

 

 


@LucianM wrote:

Is this what you need?

Generate Stereo Sound.png



Sure that might work but I want to know how to do it.

 

Can you give me an example without using Express VI's?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 11
(2,423 Views)

You can right-click the ExpressVI and select "Show Front Panel" to view the contents. It's using the same Sound Output Configure and Sound Output Write that you've mentioned using already in the Graphics and Sound -> Sound -> Output palettes.

 

The Help for Sound Output Write says:

data writes any sound data to the internal buffers. For multi-channel sound data, data is an array of waveforms where each element of the array is a single channel.

 

I'm not sure how to tell it which waveform you want on left or right, but I'd guess it would be consistent oce you figure out which way it goes.

 

Edit: Why the heck is there so much whitespace on this post?

0 Kudos
Message 6 of 11
(2,404 Views)

@RTSLVU wrote:

 

 


@LucianM wrote:

Is this what you need?

Generate Stereo Sound.png



Sure that might work but I want to know how to do it.

 

Can you give me an example without using Express VI's?


Please check the code behind Play Waveform Express VI.

Lucian
CLA
0 Kudos
Message 7 of 11
(2,370 Views)

You can use two copies of Basic Function Generator.vi, then build an array of waveforms to create a stereo pair (where index 0 is the left channel). The array of waveforms can then be written to the sound device configured in continuous sample mode.

 

Two Tones.png

Message 8 of 11
(2,355 Views)

Off topic...


@BertMcMahan wrote:

Edit: Why the heck is there so much whitespace on this post?


 

<div id="styleDivScrolling" style="height: 766px;">
<p>Edit: Why the heck is there so much whitespace on this post?</p>
</div>

 

style="height: 766px;" caused the problem.

 

Not sure how that ended up there. Selecting everything and then clicking "clear formatting" (the Tx icon) should remove all formatting. Or go into the HTML view...

 

With modified HTML:

 

<div id="styleDivScrolling">
<p>Edit: Why the heck is there so much whitespace on this post?</p>
</div>

 

 


@BertMcMahan wrote:

Edit: Why the heck is there so much whitespace on this post?


 

Message 9 of 11
(2,352 Views)

@Dataflow_G wrote:

You can use two copies of Basic Function Generator.vi, then build an array of waveforms to create a stereo pair (where index 0 is the left channel). The array of waveforms can then be written to the sound device configured in continuous sample mode.

 

Two Tones.png


This is basically what I tried at home last night. One tone at a time was always fine regardless of which tone.

But whenever I had two channels there was an annoying pop sound during playback.

I see you put the Phase in a shift register, I will try that.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 11
(2,292 Views)