LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

question about Sound Devices

Hi,
  There is a section of article in the LabVIEW HELP.
 
  Sound Devices
  Sound devices are sound cards or other hardware attached to the computer. The value of the Device ID input of the Sound Output Configure, the Sound Input Configure, and the Play Sound VIs specifies which sound device to use. Enter 0 in Device ID for the default sound device on the computer. Enter 1, 2, 3, and so on, for other devices.
  Though the  the above-mentioned article I see that we can  control different Sound Devices
though different Device ID.
  The following are my question.
  is  the line in Sound Devices?
  How can I know  which Sound Devices the  Device ID 1,2,3 each indicate?
  Can any one help me out please?
  Thanks.
   lizhi
0 Kudos
Message 1 of 7
(7,833 Views)

Lizhi,

Most Windows PC's will only have one sound device available.  You can check to see if you have additional devices by accessing the "Sounds and Audio Devices" in the control panel of windows (if you have the windows volume icon in your taskbar you can right click that and select "adjust audio properties"). In the Sounds and Audio Devices Properties window select the Audio Tab.  The zero index device ID for the sound VI's will be the one listed in the drop down list for the Default device.  If you select a different device here, the sound VI's will now use that device for index zero.  However, unless you have an additional sound card you will probably only see one device in the list.  In that case, putting a device ID into the sound VI's of any value other than zero will not work.

If you have more than one listed you can use this attached VI.  In the past I was using a second sound card to do some audio stuff using the sound VI's and I ran into the same questions that you are asking.  I also found some VI's that accessed the windows API dll's as I believe you found in one of your other posts.  I modified and made my own vi that I'll attach.  If you run this VI you can get a list of the names of sound devices that would show up as available sound devices for use in the sound VI.  If you run it, the VI will return in an array a list of names of Sound device that you can use.  Select the one that you want and pass that index that it is found in the array to the sound VI's provided by NI.

The VI was written in LV 8.0.1 and I don't have access to that version anymore so I can't down convert it for you, sorry.

Paul

 

Message 2 of 7
(7,810 Views)

1. Thank you for your informaiton. Your example vi is very informative for me.

2. In addition to device names, I would like to know where I can find available sound card sampling frequency. As I understand, sound card normally uses 44100, 22050, 11025(?) Hz. I would like to know where I can check or set the values in windows. Moreover, I would like to know if I can check it in Labview.

3. I would like to know what happen in sound card if I use frequency other than 44100, 22050, 11025 and so on. In sound write and wave write vi, I can set any sampling freqeuncy (double value). Do the vis resample? Actually, I experienced that signal is distorted if I save and reroad the signal with wav write vi at 25000Hz. Does it true?

Thank you very much.

 

0 Kudos
Message 3 of 7
(7,759 Views)
The available frequencies for you sound card should be in the manufacturer's specifications that you got with the card.  If you did not get anything, the manufacturer's website is usually your best choice.  Since many applications show this information, there is a Windows way to query it.  Said method will probably be ActiveX or a system DLL call, in which case it can be called by LabVIEW.  However, I have never done this, so I can't help you with specifics.  Anyone?  A quick way to find out what your card is capable of is to download a free audio editor, such as Audacity, and see what it says you can use.

As for giving an invalid frequency, I suspect that will depend on the hardware/drivers.  LabVIEW uses standard Windows calls in Windows to access the sound card.  There is no processing.
0 Kudos
Message 4 of 7
(7,737 Views)
Sorry for my bad english

I saw your verry good explications, i have one more question ?
How can i select the input in the same device
Exemple; my carte have a microphone input and 2 line imput
How can i select for exemple the microphone input ?
The question is the same with the output. If the devise have 4 output, how can i select
the output 3 for exemple ?

Thank's
0 Kudos
Message 5 of 7
(7,659 Views)
To select the input channel, you will need to use the utility that came with your sound card.  Under Windows, this is done from the control panel.  This will select, for example, line in, CD in, or microphone.  You can probably do this from an ActiveX control in LabVIEW, although I have never done so.  Once you have selected the input, you usually have more than one channel (e.g. line in is usually stereo, giving two input channels).  You can then acquire one or both of them, but cannot individually select the second channel.  So, if you need only the second channel, you will need to acquire both and throw away the data from the first.

There is no selection of the output channel, just the number of output channels.  So, if you want to output only channel 2, you need to set the output to two channels, then output a blank waveform (all 0s) to channel 1 and your waveform to channel 2.

I realize this is not very optimum, but it should work.  Good luck.  Let us know if you need more information.
Message 6 of 7
(7,649 Views)

ok, thank's

I will test with activex

0 Kudos
Message 7 of 7
(7,636 Views)