You are not logged in.

#26 2015-10-05 19:47:39

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: PulseAudio vs. Alsa

tknomanzr wrote:
cat /proc/asound/cards

FTFY smile


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#27 2015-10-06 00:01:10

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: PulseAudio vs. Alsa

I was able to get everything working in volti with this configuration in ~/.config/volti/config

[card-0]
control = Master
mask_lock = 0

[global]
mixer_show_values = 1
scale_increment = 1.0
card_index = 1
icon_theme = Default
scale_show_value = 0
mixer = pavucontrol
show_tooltip = 1
notify_position = 0
keys = 1
toggle = mute
mixer_internal = 0
notify_body = <span font_desc="14" weight="bold">{volume}</span>
	<small>{card}</small>
	<small>{mixer}</small>
keys_backend = xlib
run_in_terminal = 0
notify_timeout = 2.0
show_notify = 1

[card-1]
control = Master
mask_lock = 0
mask_control = 2047

Relevant changes were: add control = Master to the [card-1] section. It was what was throwing the error when I attempted to access volti's preferences. Changed mixer to pavucontrol, mixer internal = 0, run in terminal = 0. With the preferences working again, I could have changed this all in the gui. I am providing  the file for reference as volti is not currently configured to use pavucontrol.

Offline

#28 2015-10-06 03:53:11

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,347
Website

Re: PulseAudio vs. Alsa

tknomanzr wrote:

wondering if it might not be wise to set the sound config up as a separate script, called bl-sound-config, say.

This sounds like the way to go, as it might take quite some tinkering to get it right. When it's all shiny and sparkling it can be triggered from bl-welcome as needed.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#29 2015-10-06 05:04:52

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: PulseAudio vs. Alsa

Anyway, I threw a ton at you. Sometimes in Linux you end up in a rabbit hole and sometimes you and up in an entire dang warren of them.

Offline

#30 2015-10-08 16:23:30

hhh
Meep!
Registered: 2015-09-17
Posts: 10,598
Website

Re: PulseAudio vs. Alsa

This bug affects me...
https://bugs.launchpad.net/xfce4-volumed/+bug/883485

My aplay -l...

~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: CX20561 Analog [CX20561 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: CX20561 Digital [CX20561 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

On my hardware (Lenovo T500), uninsalling pulseaudio and pavucontrol and installing alsa-base (kmod) is the easiest solution. The other solution is to install the BL backport of xfce4-volumed, but this hasn't been tested by us enough...
http://pkg.bunsenlabs.org/debian/pool/m … 4-volumed/

Offline

#31 2015-10-13 14:03:10

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: PulseAudio vs. Alsa

I have done quite a bit of research on this in the past few days and have some things to report. It should in theory be possible to properly have more automated sound setup by allowing PA to handle the configuration. This would conform to behavior we have come to expect where stuff "just works" with sound.
The relevant stuff that needs to be setup will be in /etc/asound.conf and should look like this per PA's wiki:

pcm.!default {
    type pulse
    # If defaults.namehint.showall is set to off in alsa.conf, then this is
    # necessary to make this pcm show up in the list returned by
    # snd_device_name_hint or aplay -L
    hint.description "Default Audio Device"
}
ctl.!default {
    type pulse
}
pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}

However, when I attempt to start volti by intentionally starting it with a config setup to the default card, which in Alsa would  be card 0, I get this error:

tknomanzr@test:~$ [alsactrl.py:__init__:41] can't open Master control for card HDMI, trying to select first available mixer channel

[alsactrl.py:__init__:49] can't open first available control for card HDMI
error: list index out of range
[main.py:init_keys_events:142] org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Hal was not provided by any .service files
Traceback (most recent call last):
  File "/usr/bin/volti", line 53, in <module>
    volti = main.VolumeTray()
  File "/usr/lib/volti/volti/main.py", line 124, in __init__
    self.watchid = gobject.io_add_watch(fd, eventmask, self.update)
TypeError: an integer is required

The part that interested me most was this:

The name org.freedesktop.Hal was not provided by any .service files

Now, when I start volti up with what I know to be the proper card, I don't get an assertion error but do get the same warning about HAL.

As a quick test I tested volumeicon-alsa out with the same process. volumeicon allows you to either specify card = default or an integer. I left it set to card = default. It fired up and threw no warnings about HAL in its output, which tells me that the fault is not with PA, it is with volti's code.

We have three ways to go about this:
1. Fix volti so that it uses dbus calls instead of HAL. HAL is deprecated in Jessie and HAL's packages are not available in the repos.
2. Script around the problem as we have been talking about.
3. Switch to volumeicon-alsa.

I can definitely tell you that setting /etc/asound.conf to be what I listed above resulted in me having proper sound without having to touch volumeicon's config file.

I was actually quite surprised that volti made it into Jessie considering how close to the deadline it was running. It looks to me like it escaped tester's attention if it was referring to libraries that are no longer in use in Debian. I will leave it up to the dev team to figure out how you all want to proceed.

Offline

#32 2015-10-13 19:08:38

db2dba
Member
From: Edmonton, Canada
Registered: 2015-10-13
Posts: 5

Re: PulseAudio vs. Alsa

The idea of automagically trying to configure BL users' audio during installation is a noble one, but I suspect it is not worth the effort. Is audio setup really a problem for many people? I doubt it. I know from experience if the defaults don't work on a given installation, it can be a big pain in the butt to get audio working (in both Linux and Windows). But it seems to work pretty well out of the box for most people.

Also... the thread title "pulseaudio vs alsa" is a bit misleading. Pulseaudio sits above alsa in the audio stack, i.e., if you're going to use pulseaudio, you need alsa running. It's not a case of one versus the other.

Also(2)... one comment in this thread mentioned pulseaudio as being installed by default in Debian, suggesting that as an argument for including it as part of BL. But I'm fairly sure it is not installed in a bare-bones Debian install, so that particular argument is invalid.

Ben

Offline

#33 2015-10-14 02:27:46

hhh
Meep!
Registered: 2015-09-17
Posts: 10,598
Website

Re: PulseAudio vs. Alsa

Yay, your first post. We get reports of sound issues, yes, and I wanted some feedback. Pulse is installed by default in jessie GNOME, but that wasn't the point. We're discussing how to best implement a default sound configuration.

Also... the thread title "pulseaudio vs alsa" is a bit misleading. Pulseaudio sits above alsa in the audio stack, i.e., if you're going to use pulseaudio, you need alsa running. It's not a case of one versus the other.

Yeah yeah, professor, I'm aware, Alsa vs. Alsa+PulseAudio. I needed a brief title.  tongue

Offline

#34 2015-10-14 07:37:55

Snap
Member
Registered: 2015-10-02
Posts: 465

Re: PulseAudio vs. Alsa

Pulseaudio sits above alsa in the audio stack, i.e., if you're going to use pulseaudio, you need alsa running.

Yes and no. If you are using pulse on top of OSS or FFADO you don't need ALSA. It all depends on your soundcard and setup.

Last edited by Snap (2015-10-14 07:42:42)

Offline

#35 2015-10-14 09:02:18

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,347
Website

Re: PulseAudio vs. Alsa

db2dba wrote:

one comment in this thread mentioned pulseaudio as being installed by default in Debian, suggesting that as an argument for including it as part of BL. But I'm fairly sure it is not installed in a bare-bones Debian install, so that particular argument is invalid.

Quite correct. Pulse Audio was default in the last CrunchBang release, but of course there's nothing so basic about it as to consider it a Debian default. (Comment edited.)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#36 2015-10-15 11:05:48

beerstein
New Member
Registered: 2015-10-14
Posts: 4

Re: PulseAudio vs. Alsa

Hi: I thought that ALSA or OSS is always needed to work together with the sound card.
I did not know that PA can take over the tasks from ALSA?
Please help me to understand- thanx

Offline

#37 2015-10-15 12:21:02

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,444

Re: PulseAudio vs. Alsa

@beerstein - To my understanding:

  • ALSA does not depend on PulseAudio to work.

  • PusleAudio is dependant on ALSA to work.

PA adds features to ALSA that not all people need.

However I may be wrong.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#38 2015-10-15 13:25:38

db2dba
Member
From: Edmonton, Canada
Registered: 2015-10-13
Posts: 5

Re: PulseAudio vs. Alsa

Also discussed yesterday in a nice explanation by snap, see link

Ben

Offline

#39 2015-10-15 13:34:33

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: PulseAudio vs. Alsa

PA is capable of dynamically determining available audio sinks and changes to them. Basically, ALSA is your low level interface to the kernel and PA is your higher level interface to user space. It is supposed to make things more user friendly, which I think it accomplishes once it's up and running. The issue with users no having working sound ootb arises from how Volti's code is structured which is something I will approach in my next post.

Offline

#40 2015-10-15 14:01:26

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: PulseAudio vs. Alsa

I took apart volti's source the other day to have a look at what it is really doing. Here is a rough draft of what it actually does. Please note it is very simplified as I don't at this point 100% understand the gtk calls:

1. Gets a list of available audio sinks from aplay -l
2. Binds to the card specified in ~/.config/volti/config as the card_index.
3. It then tries to set everything up for that particular card. If it fails to set anything up, it simply throws an assertion and fails to start.

I would love to see this code improved up on because it is already pulling the list from aplay -l, then most unfortunately not making use of that list, instead making use of a static config file. The HAL stuff is a red herring. That stuff has to do with multimedia key mapping.

What I would suggest is a script that would run at first  boot  that would do the following things unless somebody can fix volti's behavior:

PSEUDO CODE:

1. Grab the list of audio sinks from aplay -l
2. Open and read ~/.config/volti/config. In particular, card_index, which should default to 0. <-- Back this file up in case changes get made to it.

LOOP: 
3. Build a try/catch statement and attempt to start volti. 
4. If volti throws an assertion, catch it, up the card_index variable by one, write that value back into the card_index value in ~/.config/volti/config, then save it.
Once you have saved a card index other than zero, an entry to the config should be added that looks like this:

[card-1]
control = Master

That is all that is needed. Volti will write the rest of the values in this section that  it needs once it successfully starts.

5. REPEAT unti volti starts successfully.

Since we are already managing the file programmatically, we might also check the following values are correct before ending the script:
icon_theme: set it to BL defaults. Mine says Faenza.
mixer = pavucontrol
mixer_internal = 0
keys_backend = xlib : <-- Don't set to HAL

Or anything else you feel is needed to ensure a default running behavior for volti in BunsenLabs.

6. Possibly run some tests for audio out to make sure you can hear stuff.

7. Clean up.

Once volti is up and running, pavucontrol should manage audio sinks dynamically. Any issues from there for 95% of sound systems could probably be accomplished by tweaking volti's config. For instance, I have not touched upon audio inputs yet. However, I am fairly sure they will work as I have been known to use my phone as an audio out device on this machine.

I could probably accomplish all of this in python and this would be much easier on me than interpreting all of the gtk stuff that volti has built into it. Unfortunately, the kids are out for fall break so it may take me some time before I can sit down and really focus on this again.

Offline

#41 2015-10-16 04:18:48

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,347
Website

Re: PulseAudio vs. Alsa

@tknomanzr If we end up staying with volti (there has been some talk of switching to volumeicon-alsa or pnmixer) that loop looks like a handy way of at least trying to get the right card set up, and wouldn't be hard to do in bash. Maybe a bl-configure-volti script that could run from bl-welcome if the user agrees. There's no need for it to enter any static values in ~/.config/volti/config, though, as we're already shipping a configured version of that file in bunsen-configs. If anything is different from default it can only mean the user changed it him/herself, so we should leave it alone.

Last edited by johnraff (2015-10-16 04:19:15)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#42 2015-10-16 05:59:46

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: PulseAudio vs. Alsa

OK. Just so I understand...you would still need to write in the card_index and control = Master value under the appropriate card and the rest would be setup already?

I can say, volumeicon-alsa did set stuff up on my laptop correctly. I qualify that with the fact that I did not see the double notification bug that has been reported. Of course, I haven't seen it yet. I have not yet tested pnmixer at all. I'll leave it up to you all what you want to do.

I just know wrapping volti would be a ton easier than running through stack traces 4 modules deep in volti. I can actually get it to fire up briefly by upping the card_index value by 1 in its source. Then all the gtk stuff throws another assertion. I just have to admit, that would be a bit beyond me at this point to fix. I might just pop over to its github and put in a request to actually use aplay -l since he is already gathering the variables, instead of depending on a static config for the card index. It's the only thing preventing it from being everything needed.

I understand all the rest being static as it can be changed via the gui once you have volti running. I just feel like automating that process would be a far better approach to a piece of software, than just throwing an assert and exiting the script, particularly when you consider the data is already there to be worked with.

Offline

#43 2015-10-16 08:26:11

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,347
Website

Re: PulseAudio vs. Alsa

Here's what we have in volti's config file at the moment:

[card-0]
control = Master

[global]
mixer_show_values = 1
scale_increment = 1.0
card_index = 0
icon_theme = Faenza
scale_show_value = 0
mixer = pavucontrol
show_tooltip = 1
notify_position = 0
keys = 0
toggle = mute
mixer_internal = 0
notify_body = <span font_desc="14" weight="bold">{volume}</span>
	<small>{card}</small>
	<small>{mixer}</small>
keys_backend = xlib
run_in_terminal = 0
notify_timeout = 2.0
show_notify = 0

So I think we've already got the other things you mentioned covered. It would just remain to change the Card-0 to Card-1 if necessary, right?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#44 2015-10-16 14:16:28

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: PulseAudio vs. Alsa

Right, otherwise the Master channel in the mixer won't be set up right.

Offline

#45 2015-10-17 11:10:41

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: PulseAudio vs. Alsa

Surely the Master channel should be selected from pavucontrol?

I thought the whole point of PA/pavucontrol was to eliminate the need for individual text-file configuration and replace it with an end-user GUI.

Editing the volti configuration file may work for cases in which the user just wants the analogue (or headphone) output but doesn't work for multimedia or other set ups.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#46 2015-10-17 13:47:24

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: PulseAudio vs. Alsa

Correct, once you actually get Volti to run, pavucontrol should handle it all. The difficulty lies in the unfortunate decision by volti's developer to NOT use the information he grabs from aplay -l to automate the whole thing. He chose to read the audio sink info from that configuration file for whatever reason.

It may come down to deciding not to use volti. However, if we should continue with it, the easiest way I can see to override its unfortunate behavior on certain sound sets is to wrap the whole thing up in a script that overrides it's assertion behavior (which is to print the assertion then exit), if it doesn't find a correct audio sink on whatever card is specified in it's configuration file by default. We have no way to guarantee what sound setup a user has. The correct way to have programmed it would be to start at card_index = 0 and keep trying to start, if fails then up card_index by 1 and try again until all available card_indexes are exhausted, and only then exit the program.

It is easy enough to edit that configuration file by hand. However, it is also rather not elegant in the fact that all the info that is needed is already there and instead of automating the whole thing for the user, it depends on user intervention for the fix.

Note, in most cases, the script would only ever need to run once, at first boot. It should be able to determine which audio sink the user is using and get volti to start up. Once set, and volti successfully run, it's configuration would be set and would not ever be needed again, provided the user doesn't change up their audio configuration significantly. However, if I were to choose to use, say HDMI speakers on a new monitor, I could simply run the script again to fix it.

Once volti is running, pavucontrol will handle things like it should. This is only about getting volti to start that first time successfully.

Offline

#47 2015-10-17 15:55:28

hhh
Meep!
Registered: 2015-09-17
Posts: 10,598
Website

Re: PulseAudio vs. Alsa

tknomanzr wrote:

It may come down to deciding not to use volti.

This. We used Volti in the last ISO release because it is part of Debian stable and volumeicon-alsa in jessie has a visual bug when using xfce4-notifyd, but it has not been a success. #! used pnmixer and I see little reason not to go back to that...
https://forums.bunsenlabs.org/viewtopic.php?id=315

Hopefully your work on this will be applicable to sound in general and will not have been a waste of your time. smile

Offline

#48 2015-10-17 16:22:10

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,029

Re: PulseAudio vs. Alsa

Nah. It has been fun and I learned. That's what matters. Plus, I finally reached the point where maybe I can't fix the code but at least I could dissect it and figure out why it wasn't working out for us. And one day, when I decide to do my own coding thing, I will keep in mind how important automation and UX design is.

I had a mentor some years back in programming. His thing was industrial automation and he really drilled into me the importance of using the machine for what is was built for, and automating everything that you can. Machines don't make mistakes. People can and do. If you have already gathered the needed info, then there is no longer a reason to depend on user input. Just automate it and make it work.

It still gives me something to do because I can learn python-gtk and see if I can figure out how to make the darn thing work the way I think it should.

Offline

#49 2015-10-20 23:39:31

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: PulseAudio vs. Alsa

Audio is something I never really paid much attention to but now that mine isn't working (BL in Virtualbox), I now have a very healthy interest! big_smile 

Can someone give a brief rundown of the issues here? How / what are the players in this? What is the difference between pulseaudio, ALSA, volti etc.. Are these graphical tools for audio drivers? Which are the underlying Audio drivers themselves?


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#50 2015-10-20 23:42:48

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: PulseAudio vs. Alsa

Actually I found a great article that answers a lot of my questions..
How Linux Audio Works


Nice image of the abstraction


I'm trying to get a more fundamental level of knowledge of how the Linux/UNIX OS works...

How does this Volti fit into this? What's the main issue at hand here?

Last edited by Horizon_Brave (2015-10-20 23:54:53)


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

Board footer

Powered by FluxBB