Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

G-Audio sound library on Raspberry Pi (beta testing)

Hi everyone,

 

I'm in the process of bringing G-Audio to Raspberry Pi / LINX, and am pleased to report audio playback is working with a Raspberry Pi 3B+.

 

This means it's now possible to decode and playback MP3, FLAC, WAV, and Ogg Vorbis files directly from LabVIEW running on a LINX target. No chroot ssh trick, system exec calls, or Python code necessary 🎉

 

 

Spoiler

Those tact switches make for terrible sample trigger buttons - here's a more musical demo video of the same example VI running on Windows, demonstrating the multi-channel mixer.

If you're unfamiliar with G-Audio, it's an open source LabVIEW library designed as a replacement for LabVIEW's sound library (lvsound2), while bringing a number of new features and improvements.

 

Now a humble request to fellow hobbyists - I only have access to RPi 3B+ hardware, so would greatly appreciate if anyone could help test the library with other Raspberry Pi variants, BeagleBone Black, or other LINX capable boards (RockPi etc). If you have an audio hat / cape for your board or USB soundcard, I'd be interested to know if the library works with those too.

 

If you're interested in testing, or just want to try out the library, installation and (optional) build instructions are below.

 

Installation

Before beginning, ensure your board has the LINX toolkit installed and SSH is enabled.

 

1. Install G-Audio
Download and install the VIPM package from the github project dev branch:

https://github.com/dataflowg/g-audio/raw/dev/src/LabVIEW/VIPM/dataflow_g_lib_g_audio-0.3.0.2-dev.vip

 

2. Install ALSA to chroot
SSH into the LINX target (using PuTTy or similar) and run the commands:

 

 

sudo schroot -r -c lv
opkg update
opkg install alsa-lib
exit

 

 

 

3. Copy g_audio_32.so to the target
(Note: This library has been compiled for armv7a processors. Other architectures may need to build the library using the build instructions below.)

 

SCP / SFTP to the LINX target (using WinSCP or similar) and copy the library file located in <vi.lib>\Dataflow_G\G-Audio\lib\LINX\g_audio_32.so to the /srv/chroot/labview/usr/lib folder.

 

Alternatively, SSH to the LINX target and download the library direct from github:

 

 

cd /srv/chroot/labview/usr/lib
wget https://github.com/dataflowg/g-audio/raw/dev/src/LabVIEW/G-Audio/lib/LINX/g_audio_32.so

 

 


4. Make some noise!
Copy some audio files to your device using SCP or SFTP and place them in /home/pi or your preferred location. Create a LabVIEW project, add your LINX target, then try running the playback example VI from the Add-ons >> G-Audio >> Examples >> LINX palette.

 

If you need to adjust the volume output, SSH into the LINX target and run alsamixer. Press F6, then select the physical audio device (not Default). Use the up and down arrow keys to adjust the volume, or use numbers 1-9 to set the volume in 10% increments. Press Esc to save and exit the mixer.


Building

If you don't trust random libraries from the internet (and why would you?) or the pre-built library doesn't work on your hardware, the library can also be built from source. The following commands will install the build environment to chroot, clone the git repo, build the library, and copy the built library to chroot's /usr/lib.

 

 

 

sudo schroot -r -c lv
opkg update
opkg install packagegroup-core-buildessential
opkg install --force-depends libc6-dev
opkg install --force-depends libgcc-s-dev
opkg install libstdc++-staticdev
opkg install git
opkg install alsa-lib-dev
git clone https://github.com/dataflowg/g-audio
cd g-audio/src/C++
git checkout dev
g++ -shared -fPIC -o g_audio_32.so *.cpp -lm -lpthread -ldl -std=c++11
cp g_audio_32.so /usr/lib
exit

 

 


Known Issues

  • Calling Configure Audio Device.vi with an audio device other than the default (unwired) device will either hang during playback, or return an error. This includes what should be the default headphone device returned by Query Audio Devices.vi.
  • HDMI audio on Raspberry Pi doesn't work, even if it works in the host and is the default device in /etc/asound.conf in both host and chroot.
  • CPU usage when decoding and playing files in chroot is roughly double that of the same decoding and playback functions compiled in the host. Possibly softfp / fpu related - need to test compiler options.

 

If you do get a chance to test the library, please mention the hardware board, OS version, and the audio device you tested with. There are a few known issues (see above), but playback should work with the default headphone audio device. Thank you!


on VIPM, GitHub
Twitter: @Dataflow_G

Message 1 of 1
(250 Views)