Re: [orca-list] ALSA Card Ordering [Was: I hate pulse]



Hi, Peter:

Yes, I'm happy to explain how I use my 5 audio devices. First, though, a
couple comments on your other questions.

Yes, I believe you can achieve the results you describe with just ALSA.
The reason it is possible, really, is that pulse itself doesn't replace
alsa, it simply provides another layer of management on top of alsa. In
other words, without the alsa libraries, pulse wouldn't work at all.
Pulse has a dependency on alsa.

I believe the strong reason for using pulse is that it's easier to
configure and control for various kinds of situations, but you can also
do those things, howbeit with more config effort, directly.

Here are two explanations I found in a quick search:

1.)     Directing multiple streams to one audio device:
https://stackoverflow.com/questions/7002423/how-to-mix-multiple-pcm-streams-using-alsa

2.)     Sending one source stream to multiple alsa devices:
http://www.6by9.net/output-to-multiple-audio-devices-with-alsa/


OK, now to answer you about how I use my multiple devices ... Note that
these are on a tower system that sits under my desk out of the way, but
where I can easily reach it when I need to do something like mount a USB
stick.

First, before talking about each device that alsa sees, I should explain
that I have all alsa outputs routed into a desktop Mackie 1202 audio
mixer. This is a physical unit that sits on a low shelf on my desk just
behind and a bit above my typing keyboard. It sits where sighted people
might put a display monitor.

This Mackie mixer has physical knobs and switches that I can quickly reach and
adjust as I go through my working day. I can quickly tweak the volume of
any given input, it's pan location, and what output device I want the
sound to go to. I have two sets of speakers in my office and a
Sennheiser headset as potential output for any alsa sound stream from my
computer.

And, yes, I do indeed listen to more than one device simoultaneously in
several situations.

Now to the devices alsa sees.

1.) I have a RME Multiface card--actually one of the very old ones, but it
still works well for what it does. This is my high end audio device that
I use for serious audio work, when I'm creating, editing, or mixing
sound. It's directed to my highest quality speakers generally, though I
can route it's output differently using my Mackie. This device was more
expensive to purchase than the rest of my computer setup combined at the
time I acquired it.

Because the Multiface also sits on my desk, though on a higher shelf,
I'm able to use a different pair of headphones connected directly to it
when useful to do that. My very best headphones tend to be attached to
the Multiface. I can simply reach up with my left hand whenever I want
them.

When I work with ecasound or with sox, I'm generally using the
Multiface. Were audacity on Linux more accessible, I would use audacity
with jack and the Multiface.

I do also just send output there, usually from mplayer, when I want to
enjoy my very best sound.

Here's the appropriate section from /etc/modprobe.d/alsa.conf for the
Multiface:
<begin code>
alias snd-card-4 hdsp
options snd-card-4 index=4
options snd-hdsp index=4
<end code>

Every time I boot I also run a script that sets appropriate routing and
appropriate volume levels for all the inputs and outputs on the
Multiface. It has 8 analog ins and outs of which I generally use at
least 4, plus digital in and out. I do use the sp/dif, too, but not the
coax.

My $HOME/.asoundrc gives me keyword access to subdevices on this card,
e.g. the Y of plughw:4,Y might be spdif, or tapedeck.

2.)     I have an old PCI Chaintech sound card that I picked up years
ago for about $25.  I love the sound I hear from this card, though I
only use it for output. I send my midi to this device. And I send
mplayer output here in situations where I the Multiface may be
unavailable, e.g. when the Multiface is paused in the middle of
something complex in ecasound, so unavailable for general audio
playback.

This card uses the ICE1724 driver. It's my general purpose output
device. Here's it's config:
<begin code>
alias snd-card-3 ice
options snd-card-3 index=3
options snd-ice1724 index=3
<end code>

3.)     I have a CE-Media USB sound card permanently attached that I
currently use for speech-dispatcher mediated espeak output for Orca.
This is another cheap device, I believe I paid less than $15 for it. I
use a separate card for speech-dispatcher because speech-dispatcher
hasn't been happy sharing the device I use for Speakup. More on that
below.

Here's it's config. Note the VID= and PID= code:
<begin code>
alias snd-card-2 cmedia
options snd-card-2 index=2
options snd-usb-audio index=2 vid=0x0d8c pid=0x000c
<end code>

4.)     I have a Sennheiser PC166 gamer headset that I use for
teleconferences. This is a very important sound card for me because I
spend a lot of time on teleconferences. My setup with the Sennheiser
headset is also preety complex, so there's much to say about this
device.

First my microphone. It goes directly to the 3.5 analog input jack of the
detachable DAC that comes with the Sennheiser. Over the years I've had a
couple Sennheisers that use this detachable DAC. I now carry one with my
laptop for use when I want better sound quality on the road for
music--and no screen reader in the music stream!

The input to the DAC comes from my Mackie's headphone output. That
allows me to have all my alsa devices available during a teleconference,
with no one else on the call any wiser. This way my screen reader never
interferes with a call. Yes, people on teleconferences are distracted
should a screen reader start chattering in the background.


It also does something else very useful. On some teleconferences I'm
mostly listening, and not talking much. I can take my headset off and
route the incoming teleconference audio to one of my loudspeaker sets.
That way I can go get another cup of coffee without missing what's being
said--and still have access to all the other devices mixed on the Mackie
when I need them. Very handy!

I'd love to move this functionality to a wireless headset, but I'd still
want all the other streams controlled by my Mackie available in that
wireless headset. So, this is an upgrade for some future date that
probably involves an upgraded Mackie, too.

I would note that adjusting the relative volume of screen reader and
teleconference audio is something I do frequently. The Mackie makes that
easy to do.

I should note also that I'm currently using FreeSwitch for my
teleconference calls. Among other benefits with FreeSwitch, I have Bill
Ackers bash functions available to me on any bash command line for mute,
unmute, call, hangup, send dtmf.

Here's its config. Note again the all important VID= and PiD= code:
<begin code>
alias snd-card-1 headset
options snd-card-1 index=1
options snd-usb-audio index=1 vid=0x1395 pid=0x3556
<end code>

5.)     Last is the builtin audio chip on my motherboard. This is used
for Speakup output driving espeak via espeakup. It also plays other
sound events, such as various ogg files I use as earcons in scripts.
Mplayer is happy to play to this card, but I have Speakup to contend
with when I do that, so I tend to not just listen to music via this device. But, it is handy for earcons. 
I've not investigated why
speech-dispatcher is unwilling to send output there, I just know it
won't, unless Speakup and espeakup aren't loaded.

Here's it's config:
<begin code>
alias snd-card-0 snd-hda-intel
options snd-card-0 index=0
options snd-hda-intel id=PCH index=0
<end code>

This is the only card that gives me trouble, and it only gives me
trouble on boot. Sometimes, with today's multithreaded booting, the card
isn't discovered in time, and alsa moves forward configuring the
remaining cards in correct order, but shifted down by one card device
number. Obviously, that won't work for my situation as described here,
especially because of the headset and because of my need to have
speech-dispatcher on a separate device! I'd love to learn how I can
force alsa to wait until this device is definitely loaded by udev.
Rebooting for this reason is a pain!

Hope this is helpful,

Janina







Peter Vágner writes:
Hey guys and girls,

I believe both approaches are awesome and good to know for advanced linux
users.
Some 10 to 13 years ago when pulseaudio was entirely new thing, alsas
device ordering was the only usefull setup for these kinds of configs. I
happily used that and it worked. I can imagine Janina is setting up her
devices this way even for many more years.
Pulseaudio changed this in a way that ordering is no longer important. It
allows us to choose the default audio device and it then allows using other
devices for different purposes by moving streams from the default to the
desired devices.
Currently I'm using laptop with its built-in loud speakers as the default
and I also use bluetooth headset to listen to the sound output of
speech-dispatcher. Pulseaudio remembers my choice that I wish to play
speech-dispatcher audio through the headset so whenever it's connected it
respects my choice. When the headset is disconnected I am not left with no
speech-dispatcher audio as pulseaudio is smart enough in this particular
case that it keeps speech-dispatcher audio playing through the default
audio device.
I'm not sure how would I go about setting this with alsa exclusivelly. Just
to make this discussion even more interesting, do you know if something
like this would be doable? Is alsas dmix a way to go? If two devices are
sharing the same audio path in order to allow stream routing like I have
just described, are multiple devices playing the same sound when they are
all connected?
Janina, can you plese explain a bit more of your setup. Are you using up to
5 devices simultaneously or are you switching between them?
I would understand 2 or perhaps 3 devices: one for music, movies and
general audio, second for accessibility aka TTS, third for phone calls for
example.

I'm sorry for drifting a bit off topic here however audio and its setup has
always been interesting for me.

Greetings

Peter

Dňa 19. 8. 2017 8:40 PM používateľ "chrys" <chrys linux-a11y org> napísal:

Howdy,

sorry but that is just bullshit lol. Also PA does not choose an random
sound card. it uses that one that you defined as default.
You also can set output devices and prioritys by scripting or
configuration like in alsa... so that argument is just wrong.
 cheers chrys
Am 19.08.2017 um 20:24 schrieb Janina Sajka via orca-list:

Micha:

For me this is yet another reason to stay away from pulse. The last
thing I need with 5 sound cards is having some bot deciding which ones
should do what, and in what order. I have no use for machines that
ignore my specified configurations to make up their own.


In other words, this is just another way for things to break.

Janina

Michał Zegan writes:

actually from what i know, pulseaudio does not go by ordering, but it
prioritizes cards based on type like internal card vs usb card vs
whatever... etc

W dniu 19.08.2017 o 19:56, Janina Sajka via orca-list pisze:

Hi, John:

I noted one comment in your post re pulseaudio that I want to respond
to.

John G Heim writes:

... you can never guarantee that hardware
devices are discovered in the same order. ...

No, but you can control the card order they're assigned, e.g. via
/etc/modprobe.d/alsa.conf using vid= and pid= params for multiple USB
sound cards.

The best on line summary of available approaches I've found to date is
at:

http://alsa.opensrc.org/MultipleCards

I'm currently working through the above as I have a nagging problem
every time I'm forced to reboot, e.g. after installing a new Linux
kernel.

My problem is that my hda device isn't always discovered. This morning I
ran a system update and had to reboot some 30 times before my Intel-810
hda device was discovered. I've looked in the logs. The problem is the
system is literally not seeing the device on most boots, yet once
loaded, it runs perfectly for days and weeks.

According to the above referenced article, there are approaches I might
try to resolve my problem without rebooting. And, it seems my current
ordering config code could be updated, too.

Nevertheless, I offer my current code because it does work to reliably
order my 5 sound devices. The always come up in the order defined below.
My only issue is whether, or not card 0 has been found, else the
remaining devices are shifted by 1--which doesn't help my situation as I
need the headset to match my configured FreeSwitch config, just as one
example.

<begin config file code>
alias snd-card-0 snd-hd-intel
options snd-card-0 index=0
options snd-hda-intel id=PCH index=0
alias snd-card-1 headset
options snd-card-1 index=1
options snd-usb-audio index=1 vid=0x1395 pid=0x3556
alias snd-card-2 cmedia
options snd-card-2 index=2
options snd-usb-audio index=2 vid=0x0d8c pid=0x000c
alias snd-card-3 ice
options snd-card-3 index=3
options snd-ice1724 index=3
alias snd-card-4 hdsp
options snd-card-4 index=4
options snd-hdsp index=4
<end config file code>

_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Orca wiki: https://wiki.gnome.org/Projects/Orca
Orca documentation: https://help.gnome.org/users/orca/stable/
GNOME Universal Access guide: https://help.gnome.org/users/g
nome-help/stable/a11y.html
Log bugs and feature requests at http://bugzilla.gnome.org





_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Orca wiki: https://wiki.gnome.org/Projects/Orca
Orca documentation: https://help.gnome.org/users/orca/stable/
GNOME Universal Access guide: https://help.gnome.org/users/g
nome-help/stable/a11y.html
Log bugs and feature requests at http://bugzilla.gnome.org

_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Orca wiki: https://wiki.gnome.org/Projects/Orca
Orca documentation: https://help.gnome.org/users/orca/stable/
GNOME Universal Access guide: https://help.gnome.org/users/gnome-help/stable/a11y.html
Log bugs and feature requests at http://bugzilla.gnome.org


-- 

Janina Sajka,   Phone:  +1.443.300.2200
                        sip:janina asterisk rednote net
                Email:  janina rednote net

Linux Foundation Fellow
Executive Chair, Accessibility Workgroup:       http://a11y.org

The World Wide Web Consortium (W3C), Web Accessibility Initiative (WAI)
Chair, Accessible Platform Architectures        http://www.w3.org/wai/apa



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]