I have a Raspberry Pi 3 - and was able to get my ASUS USB audio device to work both with mic/line-in and output to speakers.

Right now I can do it it in two steps:

  • arecord will record to a wav file
  • aplay will play the wav file

Just wondering if it's possible with a simple config setting to somehow have the audio pass thru directly from line-in to speaker-out?

Hoping to avoid using avconv or ffmepg to redirect -seems like a lot of cpu just to do pass-thru audio.

If I can do this, I'd like to be running a program in the background that would interrupt the audio for a message and then return back to passthru audio

  • Are both line-in and speaker-out part of the same device? If yes, what are its mixer controls (see alsamixer)?
    – CL.
    Oct 13, 2016 at 6:01
  • Yes they are. Not sure what you mean - Input is set to Line, Loudness is on, PCM volumes are set to middle low levels. I have both input and output defaulting to the HW device 1 so I can pipe directly from arecord to aplay and it does work
    – dbmitch
    Oct 13, 2016 at 6:05
  • 2
    So there is no "Line-In" playback control? Then you need to use software. (Any software. I've heard PulseAudio can do this.)
    – CL.
    Oct 13, 2016 at 6:16

2 Answers 2


I found a simple solution using just ALSA and uses little CPU - around 3-5% on RPi 3 using latest Jessie build and a USB Audio Device

It appears that recent builds all come with ALSA's dmix plugin built-in. This allows you to share and output audio output stream

Create New .asoundrc

pi@raspberrypi:~ $ sudo nano .asoundrc

Copy/Paste this based on USB Audio Device is the second card in system

pcm.LineOut {
    type dmix # Kernel PCM
    ipc_key 1112233  # Any Unique Number Number
    slave {
        pcm "hw:1,0" # Card # of USB Audio from aplay -l
        period_time 0
        period_size 1024
        buffer_size 8192
        rate 48000
        #periods 128

pcm.!default {
        type hw
        card 1
ctl.!default {
        type hw
        card 1

Modify ALSA settings to make the USB Audio device the default using

Select the USB Sound Card
Change Inout to Line if you have a high end Audio device, otherwise leave as Mic
Modify volumes to 40-50%

On exit, save settings

alsactl store

Start the stream playback from Audio In direct to Audio Out (& will return to command line)

arecord -f dat | aplay -D "LineOut" &

Reduce volume of line input:

 amixer set Line,0 0% 

Use dmix shared pcm device to insert wav file previously recorded from line in:

aplay -D LineOut -R 48000 hiVol.wav

When it's all done restore the volume back to normal:

amixer set Line,0 50% 

You can use module-loopback functionality of PulseAudio. First identify the names for your sound card's line in and speakers using pactl list sources and pactl list sinks respectively. Then create the loopback:

pactl load-module module-loopback source=src_name sink=sink_name

If your soundcard is detected with correct default source and sink, simply running pactl load-module module-loopback may be enough.

Once the loopback is created, the sink and source it uses can be modified with pavucontrol.

  • Thanks - I'll have a look and give that a try. It looks like the Python software does something similar in that when I start it up, it automatically starts the passthru and the speaker starts playing the audio coming thru the mp3 Player connected to line-in. Stops when I stop the process
    – dbmitch
    Oct 13, 2016 at 17:05
  • I can do it directly using arecord -f dat | aplay and it never uses more than 3-4% cpu.
    – dbmitch
    Oct 18, 2016 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.