LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire Sound not working - linux ubuntu 20.04

Solved!
Go to solution

Hello,

I'am working in LabVIEW on linux and I've run into a issue with audio input/output VI's. When trying to place "Acquire" or "Play Waveform" Express VI shows no detected devices in the dialog, and after clicking OK button LabVIEW crashes and whole application shuts down. Below is uploaded screenshot with the pop up widow after placing "Acquire Sound" Express where you can't see any mic's detected even tho I have built-in microphone which is working normally.

 

Anyone had similar issue? Or know what to do?

 

I am quite new to this environment so maybe that's why I'm not sure what to do.

 

I'am working in LabVIEW Community Edition Version 21.0.1 (64-bit).

 

0 Kudos
Message 1 of 7
(2,891 Views)

I wonder if NI's Sound routines use Microsoft's DirectX to communicate with the PC's Sound card ...  Oops, the LabVIEW Help addresses this, and says for Linux, "You mush have the Open Sound System (OSS) driver to use the Sound VIs."

 

Do you have the Open Sound System driver?

 

Bob Schor

0 Kudos
Message 2 of 7
(2,869 Views)

@Bob_Schor wrote:

I wonder if NI's Sound routines use Microsoft's DirectX to communicate with the PC's Sound card ...  Oops, the LabVIEW Help addresses this, and says for Linux, "You mush have the Open Sound System (OSS) driver to use the Sound VIs."

 

Do you have the Open Sound System driver?

 

Bob Schor


Do you want to borrow my 8-Ball Bob?


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 7
(2,858 Views)
Solution
Accepted by TomPar

LabVIEW for Linux uses Open Sound System (OSS) to handle sound playback and capture, but OSS itself is well and truly deprecated (since early 2000s) in favor of ALSA and more recently PulseAudio. None of the distros LabVIEW for Linux supports ship with OSS.

 

I've written a replacement sound library for LabVIEW library called G-Audio which supports both ALSA and PulseAudio under Linux, and can handle audio playback and capture. It's been tested under OpenSUSE and CentOS, and though it's not been tested under Ubuntu, it should work.

 

You can find the source code on github, along with examples and installation instructions on adding the G-Audio library to your project. Unless you have VIPM working on Linux, I'd skip the VIPM package and grab a copy of the source and manually add the library to your project. The included example VIs Audio Capture Example.vi and Audio Playback Example.vi should help get you started.

Message 4 of 7
(2,836 Views)
Solution
Accepted by TomPar

Hi TomPar,

 

I did a quick test with an Ubuntu 20.04 virtual machine and LabVIEW 2021 SP1 Community edition, and verified capture works with G-Audio:

 

g-audio-capture-ubuntu.png

 

Just make sure to set the microphone / input volume in the Ubuntu settings to an appropriate level (I used 100%). You might also need to increase the capture buffer size in the example VI to something larger than 2048 (say 4096), depending on your hardware. If the configured buffer size is smaller than the device's buffer size, this can lead to audio glitches. There will be a warning displayed if configured buffer size is too small.

0 Kudos
Message 5 of 7
(2,806 Views)

Hello Dataflow_G,

 

Thank you for your help and a little guidance. Everything works as expected so now I'm going to have some fun and start testing this library in order to include it in my projects 😁.

Message 6 of 7
(2,789 Views)

Happy to hear you got it working, TomPar. If you run into any issues or have any questions with the library, feel free to raise an issue on github.

Message 7 of 7
(2,752 Views)