recording pulseaudio output

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

Post Reply
morgon
Established Member
Posts: 3
Joined: Thu Nov 21, 2019 6:20 pm

recording pulseaudio output

Post 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!
User avatar
bluebell
Established Member
Posts: 1910
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: recording pulseaudio output

Post 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.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

User avatar
thetotalchaos
Established Member
Posts: 211
Joined: Mon Sep 29, 2014 8:29 pm
Has thanked: 53 times
Been thanked: 9 times
Contact:

Re: recording pulseaudio output

Post 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
You can listen to my music at: https://totalchaos-music.bandcamp.com/

Take a journey to wonderland with The Butterfly Effect 2016
https://totalchaos-music.bandcamp.com/a ... fly-effect
User avatar
nikgnomicradio
Established Member
Posts: 109
Joined: Wed Feb 07, 2018 9:31 pm
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: recording pulseaudio output

Post 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
morgon
Established Member
Posts: 3
Joined: Thu Nov 21, 2019 6:20 pm

Re: recording pulseaudio output

Post 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?
Plug&Play
Established Member
Posts: 49
Joined: Sat Jan 14, 2017 2:09 am

Re: recording pulseaudio output

Post 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!

Rob

Music Music Music !
Post Reply