Skip to content

Instantly share code, notes, and snippets.

@aelindeman
Created November 19, 2020 23:45
Show Gist options
  • Save aelindeman/e6f09210b00c65e09e2b48459a710865 to your computer and use it in GitHub Desktop.
Save aelindeman/e6f09210b00c65e09e2b48459a710865 to your computer and use it in GitHub Desktop.
alsa audio passthrough service with fifo
[Unit]
Description=aplay passthrough audio from arecord
BindsTo=arecord.service
[Service]
Environment=INPUT=/var/run/arecord
ExecStart=/usr/bin/aplay $INPUT
[Unit]
Description=arecord for USB audio device
After=sound.target
[Service]
Environment=OUTPUT=/var/run/arecord
ExecStartPre=mkfifo $OUTPUT
ExecStart=/usr/bin/arecord --disable-softvol --nonblock --device=plughw:CARD=CODEC,DEV=0 --format=s32_le --rate=192000 --channels=2 $OUTPUT
ExecStopPost=-rm $OUTPUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment