LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Play Sound File triggered by notifier breaks after 21 days

@hooovahh how would you communicate to the arduino from LabVIEW? By just sending commands over RS232?

 

As an update to this, my code example that uses "Sound Output Write" to send waveform data to the speakers has been running for >23 days now and has not exhibited the same issue that the version using "Play Sound File".

 

I've updated my application to also accommodate the RS232 "RTS" controlled relay idea, so the end user can choose which alarm (relay activated or waveform generated). I currently do not have any explanation on why "Sound Output Write" appears to be more stable than "Play Sound File", and no proof of whether it is a hardware problem or not. 

0 Kudos
Message 21 of 25
(766 Views)

@Hooovahh wrote:


I'd hope there are alternate ways to invoke playing a sound more reliably, like maybe a command line call to VLC to play a file, then exit.


I'm not sure why I didn't post this before: https://github.com/dataflowg/g-audio. Maybe it was because I was focused on suggesting how to debug the issue.

 

I haven't looked recently, but I believe its WAV reading is also done through another DLL.

 

In case the OP's example isn't fully reflecting the situation and the issue really does come from the sound VIs, maybe this will help (and in any case, Dataflow G does interesting and amusing stuff. It's worth checking out).

https://dataflowg.github.io/
https://twitter.com/Dataflow_G

 


___________________
Try to take over the world!
Message 22 of 25
(749 Views)

Both the LINX and LIFA toolkits I linked to earlier create a palette in LabVIEW once installed.  There are examples showing how to open a session and perform functions.  Under the hood it really is just VISA serial commands, but the palette and default firmware makes using it pretty easy.

0 Kudos
Message 23 of 25
(731 Views)

@tst wrote:

@Hooovahh wrote:


I'd hope there are alternate ways to invoke playing a sound more reliably, like maybe a command line call to VLC to play a file, then exit.


I'm not sure why I didn't post this before: https://github.com/dataflowg/g-audio. Maybe it was because I was focused on suggesting how to debug the issue.

 

I haven't looked recently, but I believe its WAV reading is also done through another DLL.

 

In case the OP's example isn't fully reflecting the situation and the issue really does come from the sound VIs, maybe this will help (and in any case, Dataflow G does interesting and amusing stuff. It's worth checking out).

https://dataflowg.github.io/
https://twitter.com/Dataflow_G

 


Thanks for the mention, tst. G-Audio does use a compiled binary to decode wav / mp3 / flac / ogg files, and also for interfacing with audio devices.

 

I tried running the original alarm code and spamming notifier events, and manged to get the Play Sound File.vi to throw error 4810 - Cannot recognize sound format:

Dataflow_G_0-1668651169838.png

This error seems to set off a cascade of errors, where the audio device can't be initialized, and the file can't be decoded any more. Did you see this error on the TPC system, ProbablyPete?

 

Digging into Play Sound File.vi shows two playback methods depending on target bitness in a conditional disable structure. The 32-bit case handles the decoding and playback in a single DLL call, and the 64-bit case uses discrete playback functions. If the VI is saved as a new VI, and the diagram disable structure removed keeping only the 64-bit case, I can't reproduce that error any more.

 

If you went the G-Audio route, it has a Mixer component which can be used to trigger sample playback on demand (see the included Mixer Example.vi). That said, I'd probably go with a discrete alarm / buzzer device to minimize risk associated with the stability of audio devices drivers, WASAPI / DirectSound, etc.

0 Kudos
Message 24 of 25
(707 Views)

@Dataflow_G I didn't see that error specifically, but when I was building the 2nd example using Sound Output Write, I ran into a problem if I spammed the notifier without first "stopping" and "clearing" in between each "write" event. In that instance, I wasn't actually getting a LabVIEW error, I was just getting a hung Sound Output Write subvi.

 

I'll start looing in to G_Audio.

0 Kudos
Message 25 of 25
(673 Views)