Page 1 of 1

recording pulseaudio output

Posted: Thu Nov 21, 2019 6:35 pm
by morgon
Hi,

On my debian system firefox uses the pulseaudio-sink "alsa_output.pci-0000_01_05.1.hdmi-stereo".
This is what I would like to record.

So I simply tried to record the monitor-sink like this:

Code: Select all

parec --format=s16le -d alsa_output.pci-0000_01_05.1.hdmi-stereo.monitor > out.raw
And that works. However there seems to be a problem: The volume of the recording is pretty low.

However when I create a null-sink ("pactl load-module module-null-sink sink_name=whatever"), direct the firefox output to this null-sink and record that I get a recording with proper volume level.

Why do these volume-levels differ?
Why is does recording from a "regular" sink result in lower volume as opposed to recording a null-sink?

So can someone explain to me what is happening here and what the preferred way to record a pulseaudio-sink is?

Many thanks!

Re: recording pulseaudio output

Posted: Thu Nov 21, 2019 10:03 pm
by bluebell
On my systems pulseaudio is configured to use jack-sink. My main audio system is jack. Recording pulseaudio clients (e.g. Firefox) with jack clients (e.g. Audacity) makes no problems. The volume is ok.

Re: recording pulseaudio output

Posted: Fri Nov 22, 2019 7:16 pm
by thetotalchaos
I will recommend to use pavucontrol. It gives you more options, compared to your desktop environment's volume control app. Use alsamixer (qasmixer, gnome-alsamixer) to check if your alsa levels are correct. For example my alsa volume level defaults on 40%, which makes my output very quiet, regardless of the level of pulseaudio out.
For recording i use "Cadence jack renderer", which is built in Cadnce by default. I am having a monitor channels activated. And i am using Meterbridge to help optimize the volume levels

Re: recording pulseaudio output

Posted: Sat Nov 23, 2019 7:18 am
by nikgnomicradio
check volume levels for the pulseaudio sinks

Code: Select all

pactl list sinks | grep -e 'Name' -e 'Volume' 
presumably null-sink is by-passing level control for regular sink set with level lower than 100%

would get same level for recording if regular sink was set to 100%, but likely would be too loud for comfortable listening

adding null-sink allows control of recording level that is not affected by level setting for listening

Re: recording pulseaudio output

Posted: Sat Nov 23, 2019 5:18 pm
by morgon
I think there is something that I may not quite understand about volume.

When I have a sink that is connected to a speaker, record the monitor of that sink with parec and play back the recording with paplay, I would expect to get the hear the same volume level (which is not what is happening which makes me infer that there is something wrong).

But maybe I simply don't understand how things work.

Is my expectiation that a recording would preserve the volume level valid?

Re: recording pulseaudio output

Posted: Sun Jun 07, 2020 12:45 am
by Plug&Play
I am on the PulseAudio learning curve, but I will take a turn at it.

I am an engineer, with a bunch of experience with instruments that measure analog signals.

I just recently read PulseAudio under the hood which has some details such as the concepts of sinks, sources, speakers.

The text tells us "Typical usage of the sink monitor is capturing all sound that was sent to speakers and duplicating it somewhere else. PulseAudio automatically creates a sink monitor for every sink."

From this I infer that the digital data sent to an amplifier/speaker system is preserved. I am sure that the "volume" is set by the amplifier capability and controls, the things that actually produce sound.

To try to answer your question, I suggest that if a recording is made of the speaker.monitor with the sensitivity at 0dB, and it is later played back with the gain at 0dB, and the identical speaker is used to reproduce the sound, then the "volume" with be the same as was heard in the first case.

All this to say that I think nikgnomicradio has given very good advice!

Cheers!