ALSA/PulseAudio mess/mystery

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
bobsuperjohnbobson
Level 1
Level 1
Posts: 21
Joined: Mon Oct 02, 2017 11:50 pm

ALSA/PulseAudio mess/mystery

Post by bobsuperjohnbobson » Mon Nov 20, 2017 7:00 pm

How can I know for sure what samplerates and bitrates I am ever using when ALSA does things like this?:

Code: Select all

2 sink(s) available.
    index: 0
	name: <alsa_output.pci-0000_01_00.1.hdmi-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE 
	priority: 9050
	volume: front-left: 65524 / 100% / -0.00 dB,   front-right: 65524 / 100% / -0.00 dB
	        balance 0.00
	base volume: 65536 / 100% / 0.00 dB
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max request: 0 KiB
	max rewind: 0 KiB
	monitor source: 0
	sample spec: s16le 2ch 192000Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 85.33 ms
	card: 0 <alsa_card.pci-0000_01_00.1>
	module: 6
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "HDMI 0"
		alsa.id = "HDMI 0"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "3"
		alsa.card = "1"
		alsa.card_name = "HDA ATI HDMI"
		alsa.long_card_name = "HDA ATI HDMI at 0xfe99c000 irq 29"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:01:00.1"
		sysfs.path = "/devices/pci0000:00/0000:00:02.0/0000:01:00.1/sound/card1"
		device.bus = "pci"
		device.vendor.id = "1002"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
		device.product.id = "aac0"
		device.product.name = "Tobago HDMI Audio [Radeon R7 360 / R9 360 OEM]"
		device.string = "hdmi:1"
		device.buffering.buffer_size = "65536"
		device.buffering.fragment_size = "32768"
		device.access_mode = "mmap+timer"
		device.profile.name = "hdmi-stereo"
		device.profile.description = "Digital Stereo (HDMI)"
		device.description = "Tobago HDMI Audio [Radeon R7 360 / R9 360 OEM] Digital Stereo (HDMI)"
		alsa.mixer_name = "ATI R6xx HDMI"
		alsa.components = "HDA:1002aa01,00aa0100,00100500"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	ports:
		hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "video-display"
	active port: <hdmi-output-0>
  * index: 1
	name: <alsa_output.pci-0000_00_14.2.analog-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE 
	priority: 9959
	volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	base volume: 65536 / 100% / 0.00 dB
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max request: 0 KiB
	max rewind: 0 KiB
	monitor source: 1
	sample spec: s16le 2ch 192000Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 85.33 ms
	card: 1 <alsa_card.pci-0000_00_14.2>
	module: 7
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "ALC888-VD Analog"
		alsa.id = "ALC888-VD Analog"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "0"
		alsa.card = "0"
		alsa.card_name = "HDA ATI SB"
		alsa.long_card_name = "HDA ATI SB at 0xfe8f4000 irq 16"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:14.2"
		sysfs.path = "/devices/pci0000:00/0000:00:14.2/sound/card0"
		device.bus = "pci"
		device.vendor.id = "1002"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
		device.product.id = "4383"
		device.product.name = "SBx00 Azalia (Intel HDA)"
		device.form_factor = "internal"
		device.string = "front:0"
		device.buffering.buffer_size = "65536"
		device.buffering.fragment_size = "32768"
		device.access_mode = "mmap+timer"
		device.profile.name = "analog-stereo"
		device.profile.description = "Analog Stereo"
		device.description = "Built-in Audio Analog Stereo"
		alsa.mixer_name = "Realtek ALC888-VD"
		alsa.components = "HDA:10ec0888,103c2ab1,00100302"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	ports:
		analog-output-lineout: Line Out (priority 9900, latency offset 0 usec, available: yes)
			properties:
				
		analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "audio-headphones"
	active port: <analog-output-lineout>

I don't remember where, but I saw 32 bit somewhere. Why is it 16 bit?

How do I check my hardware capabilities and settings?
And how do I know if something along the line isn't re-sampling my audio?


How many layers does this thing have?

rene
Level 8
Level 8
Posts: 2228
Joined: Sun Mar 27, 2016 6:58 pm

Re: ALSA/PulseAudio mess/mystery

Post by rene » Mon Nov 20, 2017 9:48 pm

Pulseaudio is a mostly unnecessary layer of complication on top of ALSA. When playing something check ALSA's settings directly through e.g. cat /proc/asound/cardX/pcmYp/subZ/hw_params for the relevant values of X, Y and Z; that'll show what the output's been set to in hardware, and if it matches the source that's playing this means no resampling is taking place (even Pulseaudio isn't that weird).

bobsuperjohnbobson
Level 1
Level 1
Posts: 21
Joined: Mon Oct 02, 2017 11:50 pm

Re: ALSA/PulseAudio mess/mystery

Post by bobsuperjohnbobson » Thu Nov 23, 2017 2:20 am

rene wrote:Pulseaudio is a mostly unnecessary layer of complication on top of ALSA. When playing something check ALSA's settings directly through e.g. cat /proc/asound/cardX/pcmYp/subZ/hw_params for the relevant values of X, Y and Z; that'll show what the output's been set to in hardware, and if it matches the source that's playing this means no resampling is taking place (even Pulseaudio isn't that weird).
Oh how I agree, I like things clean as they can get.
Also, why are there 2^521 settings files and how do I know which ones actually do anything?
I start up my computer and the alsa resampler is not set to 44100. I can tell because the edges of square-waves on my software scope are screwy. I restart pulseaudio and this corrects itself???
What are the ins and outs of what pulseaudio does, and can I get rid of it if I don't need it? I know that it SEEMS to allow mixing, but how can I get ALSA to do that instead?

User avatar
Flemur
Level 16
Level 16
Posts: 6205
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: ALSA/PulseAudio mess/mystery

Post by Flemur » Thu Nov 23, 2017 9:47 am

bobsuperjohnbobson wrote:Also, why are there 2^521 settings files and how do I know which ones actually do anything?
It's bizarre.
I start up my computer and the alsa resampler is not set to 44100. I can tell because the edges of square-waves on my software scope are screwy. I restart pulseaudio and this corrects itself???
Where/how is this scope monitoring the wave?
What are the ins and outs of what pulseaudio does, and can I get rid of it if I don't need it? I know that it SEEMS to allow mixing, but how can I get ALSA to do that instead?
Try uninstalling alsa - most stuff will continue to work, some things might need the sound IO changed.
Edit: firefox > v52 or so require pulse, or see my post about "apulse" replace pulseaudio.

Mixing and "record what you hear" without pulseaudio depend on your sound card. With my built-in card, neither were possible; with an old SoundBlaster I can do both w/o pulse (mixing = transparent; 'what-you-hear' = record from mix, which wasn't present with the built-in card).

Also, install "qasmixer" to replace alsamixer.
Last edited by Flemur on Thu Nov 23, 2017 11:18 am, edited 1 time in total.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 18.3 Xfce/fluxbox/pulse-less
Xubuntu 17.10/fluxbox/pulse-less

User avatar
MintBean
Level 9
Level 9
Posts: 2968
Joined: Fri Aug 07, 2015 6:54 am
Location: Blighty

Re: ALSA/PulseAudio mess/mystery

Post by MintBean » Thu Nov 23, 2017 9:55 am

So Pulseaudio sounds like a bit of a mess, which begs the question- why has it quickly become the de-facto standard in Linux?

Hoser Rob
Level 12
Level 12
Posts: 4344
Joined: Sat Dec 15, 2012 8:57 am

Re: ALSA/PulseAudio mess/mystery

Post by Hoser Rob » Thu Nov 23, 2017 2:37 pm

Showing the sample rate of what's being played at the moment is simple ... execute this in the terminal:

Code: Select all

cat /proc/asound/card?/stream0 | grep Momentary
This is important to me because I want to avoid resampling at all times ... that's the biggest sound quality issue with computers as long as everything works ... and I'll happily sacrifice system sounds and software mixing to get it.

I don't think uninstalling pulsoaudio is a good idea because it has too many system dependencies. But I use a USB sound card and just set my media players to output audio as a bit stream directly through ALSA. The players I use support this (SMplayer, VLC (though rarely), Clementine, Audacious). IMO any player that won't do that is useless. So I don't really use pulse either.

Yes, Linux audio can be convoluted, but I've never had problems.

bobsuperjohnbobson
Level 1
Level 1
Posts: 21
Joined: Mon Oct 02, 2017 11:50 pm

Re: ALSA/PulseAudio mess/mystery

Post by bobsuperjohnbobson » Sun Nov 26, 2017 2:49 am

The problem is I feel that this is so complex, that I cannot be sure that my audio isn't being processed and reprocessed many times before actually playing to me?
How many times could it resample it? And how many things does this audio go through before it hits my speakers? Can this be mapped visually?

bobsuperjohnbobson
Level 1
Level 1
Posts: 21
Joined: Mon Oct 02, 2017 11:50 pm

Re: ALSA/PulseAudio mess/mystery

Post by bobsuperjohnbobson » Sun Nov 26, 2017 2:52 am

I start up my computer and the alsa resampler is not set to 44100. I can tell because the edges of square-waves on my software scope are screwy. I restart pulseaudio and this corrects itself???
Where/how is this scope monitoring the wave?

I wrote it with python 3.5 using pyaudio set to loopback through the pulseaudio volume control (recording section).
I could not find a suitable scope of someone else's work.

I can tell that alsa/pulseaudio is resampling because a squarewave oscillator will look crusty around the edges, restarting pulseaudio fixes this.
I assume that for some reason it is defaulting to 48000, but when I restart it, it reads the config file and sees my 44100 setting. Is this a bug?

User avatar
greerd
Level 5
Level 5
Posts: 986
Joined: Sat Jul 31, 2010 10:58 am
Location: Nova Scotia, Canada

Re: ALSA/PulseAudio mess/mystery

Post by greerd » Sun Nov 26, 2017 7:55 am

Maybe this post will give some hints? viewtopic.php?f=48&t=253225

czeekaj
Level 1
Level 1
Posts: 20
Joined: Thu Jan 11, 2018 6:48 am

Re: ALSA/PulseAudio mess/mystery

Post by czeekaj » Fri Jan 12, 2018 8:06 am

MintBean wrote:So Pulseaudio sounds like a bit of a mess, which begs the question- why has it quickly become the de-facto standard in Linux?
Dunno but there are not many options it seems. I like more legacy stuff that still works but whatever is lightest still gives good quality audio. It works good on firefox sure . However so does Alsa playing Flac files and on legacy browsers shame, I like Firejail and no dependancies. :). They both work but Alsa is older probably self dependant however now there is layering with pulse which is going to get fustrating., Maybe it's just because pulse is 'new'. Or the developers find it easier to work with or just repackage. Either way it is setting up a longer dependancy tree, I'd rather have a single program take care of the whole thing instead of layers of absraction and dependancies.

Post Reply

Return to “Software & Applications”