The simplest way is to connect aplay
and arecord
by a pipe. There's no arecord -L
information for PCM sources, but assuming it looks similar to the PCM sinks:
arecord -t au -r 44100 -D front:CARD=Intel,DEV=0 | aplay -t au -D front:CARD=Intel,DEV=0
There's a noticable delay until the output is played, because a pipe isn't intended for real-time audio processing.
The -t au
options select the Sun Audio format. This is important, because e.g. the WAV format contains a header with the length of the file, so it can't be used across a pipe.
The default rate for arecord
is 8000 samples/s, which is usually not what you want, so the -r
option is also important.
The PCM sources and sinks may not support some combinations of rates/format/channels, so you either may have to pick valid combinations for your hardware using more options, or use plughw
instead of front
. For more modern ALSA installations, plughw
entries are automatically generated, and they put a plug
plugin in front of the real hardware to do format conversion. If your ALSA doesn't generate those automatically, you have to add them manually to your .asoundrc
.
There are other ways to do it, for example with a chain of various ALSA plugins, if you want to have this feature permanently. It's not necessary for the hardware to be able to route audio directly.
I just managed to configure exactly this thanks to the instructions in the ArchLinux wiki :
Set the one sink - HDMI - in pavucontrol/Configuration, and the other - analog output - you specify in default.pa
:
load-module module-alsa-sink device=hw:0,0
load-module module-combine-sink sink_name=combined
set-default-sink combined
Maybe you were missing the last two lines?
Addendum: This is OK to add the analog output to HDMI, but what if you want it the other way around? (I want to keep analog input, Pulse calls that "duplex"...) Unfortunately, load-module module-alsa-sink device=hw:0,3
did not work to add HDMI output to Pulse's "Analog Stereo Duplex" configuration. Pulse would start, but no HDMI output.
I compared the output of pacmd list-sinks
in the two situations. When I added device=hw:0,3
, that one would show up without ports. When HDMI output was chosen in pavucontrol, there would be ports. Looking at the output details, I came up with device=hdmi:0.
Choose "Analog Stereo Duplex" as your pavucontrol configuration, and add to default.pa
:
load-module module-alsa-sink device=hdmi:0
load-module module-combine-sink sink_name=combined
set-default-sink combined
Works like a charm. I keep my microphone input, and on pavucontrol/Output Devices I have all options for analog output and for HDMI.
Best Answer
I get just about same output from
arecord -l
. I've usedaudacity
to record a song from a website (yes, I tried to buy the song from the site, but...). Need to get the right adjustment of muting the microphone (if possible) and then cleaning up any static/background noise. So for you, I would startaudacity
, start your program, set to record to a new project and then perform the functionality the you want to record.