Audio Recording Pass-Through

Not sure that Pass-Through is the right term…
I recently switched from Ubuntu and am pleased that I have. I used to use AudioRecorder to record sound that I was playing from a Web page (it was buggy but once I had understood its quirks I had no problems with it).
This isn’t available as an RPM or Flatpak, so I reluctantly installed SnapStore then AudioRecorder as a Snap. As expected it didn’t work (segmentation fault). I haven’t had a good experience with using or creating Snaps on Ubuntu either, IMHO Flatpaks and the whole process around them are far preferable.
I have notes that Audacity (which is a quality app) can be used for this if PulseAudio is installed, but I can’t find any sign of this in a usable package type except PulseAudio Volume Control which doesn’t help.
I can’t find another suitable app, so any suggestions?

I had similar problems trying to record from the web. My work-around solution was to play the audio on my laptop and use an audio cable to connect the headphone out on the laptop to the line in on my desktop and record on the desktop.

I was using audacity to record.

That is a bit of a kludge but it did work. I think the issue seems to be that a single audio device cannot both play and record at the same time with the software I was able to find (probably to prevent feedback). Without assigning the output to an audio device nothing happened.

It seems reasonable to assume that if you had 2 discrete audio devices, such as the one built in on the motherboard and another plugin card or usb device then one machine could both play and record by going out on one and in on the other.

Hmmm… I may try that with hdmi audio out to my monitor and back in on the motherboard audio. Still using an audio cable jumper though.

It’s an idea, but I can already do something similar by playing the output from the computer into a video recorder, recording a disk, putting the disk into the computer and then converting the file to a FLAC. Longwinded but I know it works and there aren’t any dangling cables. I’d far prefer a software solution.

Try gnome-sound-recorder. Connect it in pavucontrol to the monitor of the sound card, otherwise the mic will be recorded, which should be muted. The monitor is behind the mixer, I do not know which processing is done between digital datastream and monitor.
Problem at the moment is the transition to pipewire sound system, there are different and better possibilities via pipewire and jack, but I have to study it.

In Fedora34, with pipewire-jack-connection-kit and qjackctl, you can start a recording in audacity, and connect audacity-in to firefox-out (keeping firefox->soundcard) Problem I have is that both firefox and audacity disappear when stopped, so this is not convenient.

With the proper gstreamer and plugins installed, this scriptlet seems to work too:

#!/bin/sh
if [[ ! -z "$1" ]]
then
	gst-launch-1.0 jackaudiosrc  port-pattern="Firefox" ! audioconvert ! lamemp3enc target=bitrate bitrate=192 ! filesink location="$1"
fi

Argument is target mp3 file. Firefox should be playing.

@hmmsjan Thanks, I think you have described two options, I’ll have to spend some time understanding them.

Yes, I understand it needs some study… Just load gnome-sound-recorder and connect to soundcard monitor is the easiest.

The screenshot below indicates the possibilities in Fedora35, also working in F34. You need pipewire with jack and pulseaudio, qjackctl, pavucontrol

pactl load-module module-null-sink loads the null output. If firefox is assigned to the null output in pavucontrol, it stays there and does not jump to standard soundcard.
The monitor of null is connected to the soundcard, gnome-sound-recorder and audacity, so live sound, recording on gnome-sound-recorder and audacity at the same time. Have fun!

Thanks @hmmsjan, you have obviously put some effort into your answer.

I looked for these packages in “Software” and installed anything that looked similar:
pipewire - EasyEffects audio effects for pipewire applications
jack - nothing similar
pulseaudio - PulseEffects, PulseView, PulseCaster
qjackctl - qcjackctl
pavucontrol - PulseAudio volume control

I was a bit worried that “Jack” wasn’t supplied by “Software”, perhaps there is a problem with it, however I found it and installed it anyway.

here https://fedora.pkgs.org/
https://fedora.pkgs.org/34/fedora-x86_64/pipewire-jack-audio-connection-kit-0.3.25-1.fc34.x86_64.rpm.html
pipewire-jack-audio-connection-kit-0.3.25-1.fc34.x86_64

I then ran “qcjackclt” as that is what shows in the image. It looks as though I’ll have to train as a sound engineer to understand it :(.

I’ve filed a bug report with audio-recorder and a request to create a Flatpak as they work.
If there is no response to this I’ll have to try your solution. Why is doing this so ridiculously complicated in Linux? If Audio-Recorder can do it, why can’t the other apps?

In principle it is not so difficult, gnome-sound-recorder is easy and probably comparable to Audio-Recorder, you only have to tell it in pavucontrol to take the monitor of the sound card, and not the mic.

What I do not like is the “soundcard monitor”. If you leave by accident the microphone on, you might get the desired result mixed with undefined sounds. The construction in qjackctl allows you to catch the sound stream directly from firefox and pass it directly to the sound recorder. But I should admit: jack is the Linux swiss army knife for sound engineers.

The little script is also easy, if firefox is playing sound, just type “scriptname outputfile.mp3” and the recording appears in outputfile.mp3.

@hmmsjan

  1. SoundRecorder with PulseAudio volume control, “take the monitor of the sound card”. I can’t see anything referring to “monitor” and I’ve no idea which other option might be relevant.



  2. I’ve tried the script, it errors like this:

WARNING: erroneous pipeline: no element “jackaudiosrc”

I have installed pipewire-jack-audio-connection-kit and qjackctl as above, but I assume some software to do with Jack is still missing, can you identify it from the error?

That’s not so nice… On the pavucontrol input device tab I’ve “Monitor of builtin analog stereo” and “Buildin analog stereo” internal front/back/line. May be your hardware does not support it. You can try the command “pactl list | grep -i Monitor” . I’ve a output like:
Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
Description: Monitor of Built-in Audio Analog Stereo

But: your first or second screenshot contains" Show: All Except Monitors" !! May be that’s the simple reason :slight_smile: Pavucontrol / Input devices, at the bottom of the window.

The gstreamer module, yes, you have to know it. It’s in package
gstreamer1-plugins-good-extras.
One remark: there is transition from jack or pulseaudio to jack+pulseaudio viapipewire. It works in Fedora 35, hope it works in 34 too…

  1. “That’s not so nice…”

[chris@fedora Desktop]$ pactl list | grep -i Monitor
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
This script must be run as root
[chris@fedora Desktop]$ sudo pactl list | grep -i Monitor
[sudo] password for chris:
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
Monitor Source: alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor
Monitor Source: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
Name: alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor
Description: Monitor of High Definition Audio Controller Digital Stereo (HDMI)
Monitor of Sink: alsa_output.pci-0000_01_00.1.hdmi-stereo
device.description = “Monitor of High Definition Audio Controller Digital Stereo (HDMI)”
device.class = “monitor”
Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
Description: Monitor of Built-in Audio Analog Stereo
Monitor of Sink: alsa_output.pci-0000_00_1b.0.analog-stereo
device.description = “Monitor of Built-in Audio Analog Stereo”
device.class = “monitor”
Monitor of Sink: n/a
[chris@fedora Desktop]$

‘But: your first or second screenshot contains" Show: All Except Monitors" !!’
Who’d have thought that the screen was involved in all this.

It now shows “Monitor of Built-in Audio Analogue Stereo” but doesn’t work, I’ll have to guess at some of the other settings.
3) “The gstreamer module” - I’ve found that and installed it.
4) “One remark: there is transition” Well collecting the various bits and pieces together like that might make things simpler. If all else fails I’ll try the Fedora 35Beta.

There it is. If you have gnome-sound-recorder up and recording, it should be mentioned on the “recording” tab. There should be an option to select the monitor output. Note the vu-meters in pavucontrol for sound card and monitor…

I´ve never seen this cgroup warning. In contrast, I should run the pactl info command not as root. Somewhere the installations differ. No idea…

Tested in Fedora 34. It heavily depends on the correct installation. pipewire, pulseaudio and jack struggle on access to the sound card. Be sure that packages pipewire-pulseaudio and pipewire-jack-audio-connection-kit are installed. “dnf --allow-erasing install” is your friend because it removes conflicting packages. This brings both pulseaudio and jack under pipewire control. pipewire, pipewire-media-session and pipewire-pulseaudio should be in the process list.

In gstreamer, jackaudiosrc is unstable both in F34 and F35. You can use also “pulsesrc” instead in the script, Now you can connect gstreamer to monitor in pavucontrol, or gstreamer directly to firefox in qjackctl. But in order to avoid all this complexity, I hope you’re able to use gnome-sound-recorder to catch the sound card monitor in pavucontrol, that’s simple.

Much testing, now the problem is whether I’ve to file a bug report or it’s my stupidity…

1 Like

I can see VLC which is my source mentioned in Pulse Audio Volume Control in 3 of the tabs now. After a couple of silent recordings, I can see the waveform and the saved file replays the sound. Thank goodness I didn’t need to go on to paragraphs 2,3 and 4!
I’ll have to fiddle about a bit until I understand how it works, and when I install Fedora-34Beta I’ll probably try installing the extra packages one at a time to see which is really necessary.

Thanks very much for your thorough assistance @hmmsjan.