LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

play sound file

reza_sed,

Excellent!  I'm glad that worked!  There are several methods that can be used to 'un-compress' the WAV files, but here is the method that I used:
  1. Open Sound Recorder: 
    • Start » Run » sndrec32
  2. Open your WAV file:
    • File » Open » your_file.wav
  3. Open the Properties menu:
    • File » Properties
  4. Convert formats:
    • Click 'Convert Now'
Will open up a window with a Format and Attributes options.
  • Format: PCM
  • Attributes: As close to the original format (can see this by right clicking and choosing properties from Windows).
Click 'OK' on all open windows.  Then File » Save As... » your_file2.wav   (just in case!)
Regards,

Jared Boothe
Staff Hardware Engineer
National Instruments
0 Kudos
Message 11 of 31
(7,156 Views)
thanks
0 Kudos
Message 12 of 31
(7,151 Views)

Hello,

 

Im working on a test platform using labview for 5.1 / 7.1 channel audio analysis...

 

What types of files does this VI accept? Only 2-Channel PCM?

 

I want to be able to play 6 and 8 channel WAVs for surround sound test files... As a test device, I have a terratec aureon 5.1 USB, it only shows up as one WAV device in windows, but ive enabled it as 5.1 Channel under windows audio devices and this works using VLC for playback of multichannel WAVs. However when I try the same in labview, an error occurs (not supported format). The help is also not very useful in telling which formats are supported!?

 

The only way I think this might work is to have a sound card with multiple wav devices under windows

 

for example:

 

Audiofire 1&2

Audiofire 3&4

Audiofire 5&6

 

That way each stereo pair can be addressed with its corresponding channels using 3 play wav file VIs. This may work as long as all WAV devices are in phase/syncronised, as phase measurements will be required for analysis using simultaneous data acquisition boards (NI-4462).

 

Secondly the 6 channel WAV would have to be manually seperated into 3 different stereo wav files before use. That is inconvienient.

 

Any thoughts...?

 

Alex

:. LV2010 SP1 ... W7 .:
0 Kudos
Message 13 of 31
(6,983 Views)

Hi

I think this sound system will be better for you. The Labview sound system in 7.1 only read 2ch wave files. But it is very simple to parse a uncompressed wave file.



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

Coq Rouge wrote:

Hi

I think this sound system will be better for you. The Labview sound system in 7.1 only read 2ch wave files. But it is very simple to parse a uncompressed wave file.


Hi Coq Rouge

 

What sound system? I was referring to 7.1 surround sound, not LabVIEW 7.1... I am using labview 2009 for development, I should have mentioned that in my post :-s

 

Could you be more specific?

 

Greetings

 

AL

:. LV2010 SP1 ... W7 .:
0 Kudos
Message 15 of 31
(6,957 Views)

Using the Sound Output Configure.vi, there is an input called sound format which is a cluster containing 3 elements.  One of these elemenst is number of channels.  Looking at the detailed help on this shows that "number of channels specifies the number of channels. This input can accept as many channels as the sound card supports. For most sound cards 1 is Mono and 2 is Stereo."  If your sound card suppots more channels, then you can change this input to however many you want. 

 

Note I have not tried this as I don't have a 7.1 capable sound card, but the documentation seems pretty sound (no pun intended).

 

0 Kudos
Message 16 of 31
(6,946 Views)

David_L wrote:

Using the Sound Output Configure.vi, there is an input called sound format which is a cluster containing 3 elements.  One of these elemenst is number of channels.  Looking at the detailed help on this shows that "number of channels specifies the number of channels. This input can accept as many channels as the sound card supports. For most sound cards 1 is Mono and 2 is Stereo."  If your sound card suppots more channels, then you can change this input to however many you want. 

 

Note I have not tried this as I don't have a 7.1 capable sound card, but the documentation seems pretty sound (no pun intended).

 


Hello David_L,

 

Thank you for your reply.

 

I initially tried this scenario and it does work as you stated. I used the example "Generate Sound.vi" and upped the outputs to 6 which worked on all channels as expected, however this was a single channel stimulus being duplicated over all channels. This didnt really help me as I wanted to playback 6 discrete channels from a WAV file.

 

So then I tried to use the "Play Sound File.vi" to playback a 6ch wav file. I then received an error. When using this VI you can only select the device to play and not the number of output channels. The help for "Play Sound File.vi" which is the help I was referring to, did not state which formats it works with. A basic Mono/Stereo WAV file is ofcourse the obvious format, but how about compressed MP3 or other common uncompressed formats?

 

Anyway, your reply triggered another idea which seems to work a treat. I looked closely again at the "Sound Output Write.vi" help and realised that the input waveform was polymorphic... duh! so I then extended the example to 6 waveform generators for each channel being merged into an array to test discrete audio output. It worked!

 

If anyone else is interested I have attached to modded VI

 

Thanks

 

AL

:. LV2010 SP1 ... W7 .:
0 Kudos
Message 17 of 31
(6,918 Views)

I've been trying your VI with a 5.1 PCI soundcard (Creative X-Fi extreme), but this trick it doesn't work. The Souncard configure VI returns the error "cannot support sound format" when I put 3, 4, 5 or 7 channels in the sound config cluster, and returns "The sound driver or card does not support the desired operation." when I put in 6 channels.

 

It may be a difference in the way labVIEW interfaces with my PCI soundcard vs your 5.1 Terratec USB soundcard. 

 

Anything I might be doing wrong?

0 Kudos
Message 18 of 31
(6,705 Views)

Hi Tinnitus boy,

 

What operating system are you using?

 

NOTE: Make sure that the driver is setup at a 5.1 device under windows... that should do the trick. If for example, under audio devices in XP or 7 you have multiple stereo pairs for your output, this demo will not work. the driver must be a multichannel sounds device under windows. there may be a setting under the creative X-Fi software interface to switch between these pair and multichannel modes. my audiofire8 firewire soundcard for example can be configured as a stereo pairs 1-2, 3-4, 5-6, 7-8 OR as a single surround sound (7.1 ch) wave device under the audiofire interface software.

 

ive noticed that XP and Vista/7 handle this differently as the audio core was upgraded since vista...

 

hope this helps.

 

AL

 

:. LV2010 SP1 ... W7 .:
0 Kudos
Message 19 of 31
(6,678 Views)

Hi ali66b, thanks for getting back (especially being an old thread).

 

I'm running LabVIEW 9 on Windows 7. The soundcard is actually a 7.1 device, but I've made it a 5.1 device using the software that the soundcard comes with (which seems to change the soundcard driver directly). In windows playback device settings, there's only the one X-Fi speaker device, but I can access the balance (i.e. Left right) on all 7.1 audio channels (i.e. so yes, it's at least 7.1 audio device under windows).  I've had a large play with changing all the settings, making it a 7.1, 5.1, 4.1 or 4 device (which the soundcard can be set to), and changing the number of channels in the LabVIEW sound config vi. 

 

There's definitely something going on, because if the soundcard is set to be a 7.1 device, I only get the "odd" error statement in LabVIEW if I use 8 channels in the SOconfig, whereas the odd error statement occurs with 6 channels if the soundcard is set as a 5.1 device (and 5 for 4.1 etc..).

 

I suspect that it's something to do with the X-Fi driver itself and Windows 7, which was a new driver only recently released to adapt the soundcard for windows 7. 

 

Any extra thoughts?

0 Kudos
Message 20 of 31
(6,650 Views)