kwasmich
kwasmich

Reputation: 121

Programmatic ALSA loopback

I need some pointers where to start with the following:

From any application that plays audio using ALSA to the connected speaker I'd like to grab the samples and do some audio processing. I am not in control of the player and I'd like to be able to process the audio from any source. Basically it will be an UV-meter, perhaps later with FFT (all just on the command line). Additionally I'd like my app to be self-contained.

In my research I've found:

Using the kernel module and altering the configuration file introduces some dependencies of my application to the configuration of the system.
And creating a plugin I give up control over the app and cannot start/terminate it whenever I want.

This is not satisfactory to me so I'd like to know if there is a way to either:

Upvotes: 2

Views: 653

Answers (1)

user1797754
user1797754

Reputation: 37

You can use the pulseaudio for linux where you can very easily create a loopback device .There ia a pactl command -it will help you create a null sink and you can loopback from it .

something like this //this would create a null sink with specified channel conf

pactl load-module module-null-sink sink_name=sink6ch format=s16le rate=48000 channels=6 channel_map=front-left,front-right,front-center,lfe,rear-left,rear-right

//make it default

pactl set-default-sink sink6ch

you can use its monitor device to read about the monitor devices of pulse audio

Upvotes: 1

Related Questions