Forwarding Captured Audio to Playback

Still new to all of this? Feel free to post in any of the subforums on this site, but in this subforum newbie questions are especially encouraged!

Moderators: MattKingUSA, khz

Post Reply
hftsai256
Posts: 1
Joined: Fri Nov 12, 2021 4:24 pm

Forwarding Captured Audio to Playback

Post by hftsai256 »

Hello everyone. I'm trying to set up a software mixer on a headless raspberry pi, serving as a Roon Bridge to drive a pair of bookshelf speakers. However in addition to all the functionalities Roon offers, I may hook it up with an additional input device (E.g. Alexa Echo Dot) via an USB audio interface, and want to forward that input to the main playback device.

The easiest way to get this done is a simple pipe onto STDOUT:

Code: Select all

root@DietPi:~# arecord -D hw:2,0 -f S16_LE -r48000 --buffer-size=4096 --period-size=1024 | aplay -D hw:0,0 -
It does its job with a recognizable latency on a Pi 4B+. That's okay when latency is not a critical issue, but I'm wondering how can this be improved with JACK. I've tried the combination of jackd and jack_load/audioadapter, but I couldn't hear any audio coming out on card hw:0,0. On the daemon side I have:

Code: Select all

root@DietPi:~# jackd -RSd alsa -D hw:0 -n 3
jackdmp 1.9.19
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2021 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
creating alsa driver ... hw:0|hw:0|1024|3|48000|0|0|nomon|swmeter|-|32bit
ALSA: Cannot open PCM device alsa_pcm for capture. Falling back to playback-only mode
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 3 periods
ALSA: final selected sample format for playback: 16bit little-endian
ALSA: use 3 periods for playback
And on the client side:

Code: Select all

root@DietPi:~# jack_load -i "-C hw:2,0 -r48000 -p1024 -n3 -i2 -o2 -g8192" hairpin audioadapter
audioadapter is running.
client name = hairpin
The following message shows up when the client connects:

Code: Select all

Fixed ringbuffer size = 8192 frames
Audio Interface Description :
Sampling Frequency : 48000, Sample Format : S16_LE, buffering : 1024, nperiod : 3
Software inputs :  2, Software outputs :  2
Hardware inputs :  2, Hardware outputs :  2
Card info (address : 0x7f87b77c00)
	ID         = b1
	Driver     = bcm2835_hdmi
	Name       = bcm2835 HDMI 1
	LongName   = bcm2835 HDMI 1
	MixerName  = Broadcom Mixer
	Components =
--------------
HW Params info (address : 0x7f800143f0)

--------------
HW Params info (address : 0x7f80014660)

--------------
Seems like it is capturing input from hw:2,0 as it would occupy the resource. Am I missing something to get the audio out on the desired device?
Post Reply