Re: [orca-list] Semi-OT: Selecting Pulse device/profile from the command line



Hello,


I am not sure I can answer all of your question but I'll try:


I don't know how to make pacmd output less verbose other than grepping it

For example I guess for what we are diagnosing here you might like to start with something like this when SSH-ing in to troubleshoot your situation:


$ pacmd list-sink-inputs | grep -E "(index)|(name: <)|(sink: )|(state)|(muted)|(application.process.binary)"
    index: 0
    state: DRAINED
    sink: 0 <alsa_output.pci-0000_00_1b.0.analog-stereo>
    muted: no
        application.process.binary = "sd_dummy"
    index: 1
    state: DRAINED
    sink: 0 <alsa_output.pci-0000_00_1b.0.analog-stereo>
    muted: no
        application.process.binary = "sd_generic"
    index: 3
    state: RUNNING
    sink: 0 <alsa_output.pci-0000_00_1b.0.analog-stereo>
    muted: no
        application.process.binary = "sd_espeak"
$ pacmd list-sinks | grep -E "(index)|(name: <)|(sink: )|(state)
|(muted)|(application.process.binary)"
  * index: 0
    name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
    state: RUNNING
    muted: no



If you would like to exclude certain sound device the easiest would be blacklisting its module in /etc/modules-load.d . If you have more hardware for example all of these are snd_hda_intel devices then perhaps blacklisting at the pulseaudio level is an option.


Get all your sound cards as pulseaudio can see them:

$ pacmd list-cards | grep -A 1 index

Copy and paste the name from the list and disable by calling

$ pacmd set-card-profile <card-name> off


To see all the profiles a card supports view the full output of

$ pacmd list-cards


This should get automagically preserved accross pulseaudio restarts. If not you might be able to add the set-card-profile command into ~/.config/pulse/default.pa I think .



I am not an expert on pulseaudio naming conventions but I do understand it as follows:

pulse communicates with audio drivers representing actual audio devices. Each such device is a card by turning into pulseaudio naming conventions.

Cards do have certain properties such as speaker setup, port assigments and similar. Pulseaudio has presets for this for most common devices. These are known as profiles.

Most of the sound devices can play audio through single channel however there are some high end audio devices with multiple device paths. These are sinks by the pulseaudio naming conventions.

Consider such a sing to be something like a pipe. When playing audio you do need a sink-input (a client, another sink, or a file) and the output (speakers, headphones etc). According to this analogy output from a client is named sink-input and input to an application such as line in for recording audio is called source-output.


By knowing all this you can say for example client speech dispatcher has created a sink input which is playing through sink <alsa_output.pci-0000_00_1b.0.analog-stereo> on the only card available on the laptop.




pacmd is a console app and there is also a graphical tool called pavucontrol and a while ago there was pulseaudio device chooser padevchooser although I don't know if this is still available.


Hopefully this is somewhat helpfull.


Thanks and greetings


Peter








On 05.09.2016 at 20:24 Nolan Darilek wrote:
Man, I know this isn't your fault, and this rant isn't aimed at you, but this morning I experienced a brown-out and came back to find my sound dead. I couldn't configure via the GUI because I then can't arrow back up to internal speakers and get Orca back like I once could. This is the first time in a while I've seriously considered a switch back to Windows.


I'll probably do some research on this eventually, but in looking at pacmd I see sinks, sources and clients, all of which seem to have inputs and outputs. What the hell are these? I don't see this terminology used anywhere else. Thanks to your message I have a vague idea what's what but I can't seem to figure out what commands to care about when I'm SSH'd in from a remote laptop to debug this (argh, I can't believe we're still in those days.) I assume that a client is something like speech-dispatcher, which makes sense, but that's the only bit of their naming choice that makes any sense whatsoever. Sinks and sources give me similar output when I list them via pacmd.


Also, is there a way to get less output with commands like list-sinks? I'm sure it's visually obvious for someone who can see, but I get screen upon screen upon screen of output, and I have to flat review most of a screen to figure out a) what device given details are relevant to b) the state of said device and c) the index. If I start at the top of the screen I'm unsure what device details are relevant to, and if I start near the bottom I have to remember things that may or may not be of interest until I reach the device name, which may or may not be on this screen. I wish there was something like the GNOME sound settings, but for Pulse, and for the console so I could use it via SSH. pacmd gives me so many knobs I don't know which to care about.


Another thing I'm unclear on, assuming I don't want to move a bunch of sources or whatever to a new sink once I set it as default with pacmd, what is the one thing I can do that will get everything accessibility-related using whatever I set as default? Should I just killall speech-dispatcher, and will it get restarted when Orca fails to connect? Should I restart Orca, and will it launch new SD clients that, since they're new, will get whatever sink I set up as the default? Just trying to figure out what action is guaranteed to get speech back if I've SSH'd in and set a new default device. Destructive is fine, though I'd rather not reboot.


Also, is there a way via the command line that I can tell PA that I don't care at all about certain devices? I suspect it's trying to launch the sound device built into my dock, but I don't have speakers hooked up to that. I'd like to just blacklist it entirely.


Thanks. And now I need a beer.



On 09/05/2016 02:57 AM, Peter Vágner wrote:
Hello,

I have originally missed this discussion.
I think since pulseaudio 8.0 or gnome 3.20 I am not sure which one, it is not possible to get the audio back by using the keyboard in the sound gnome control center applet. For example If I activate device which is not connected to any output I can't just arrow back to restore the previous configuration.

pacmd is the commandline interface to pulseaudio and it is really possible to do neat funky stuff with it. For example on my laptop I do have internal speakers I either connect simple headphones to it in such case everything plays through this single pulseaudio device. Or I am connecting external usb sound card. Through that external soundcard I am only playing speech dispatcher output. I had to setup this only once i.e. first when I have connected the USB device pulseaudio did nothing in the previous versions now it automagically switches to that similar to what Windows does. So to get the setup I would like to have once the USB is connected I use the sound gnome control center preferences to configure my internal speakers as the default output device and then using pacmd I'll manually route speech dispatcher to the usb device. Next time this usb device is plugged in pulseaudio automagically routes speech-dispatcher to it with no other tweaks for me.

for example here are some pacmd commands
pacmd list-sinks - print outs all the devices with their profiles, properties and similar You may just SSH in when the sound is lost and troubleshoot whether something is not accessing alsa directly locking pulseaudio instance.

pacmd list-sink-inputs - lists all streams with properties. For example you will see speech-dispatcher in this list all the time.

pacmd move-sink-input #n sink - moves sink-input #n to the specified sink. You can either enter its index or its name e.g. I do have the only one sink on the laptop currently.... <alsa_output.pci-0000_00_1b.0.analog-stereo>

pacmd set-default-sink <index or name> - sets what will be the default sound output device. No streams are moved when doing this. New streams start to play on the new default sink.

There are many more commands, this is what I think you might need for this.

Greetings

Peter



On 05.09.2016 at 07:44 Willem van der Walt wrote:
Hi Nolan,
I do not have a direct/detailled answer, but, as your devices are USB, plugging and unplugging will be picked up as events.
Udev is the system that creates device entries on the fly in /dev.
One can set up udev rules to ensure that a particular device will always be created with the same name and in the same way. As I understand it, one can also have a script run when a particular event occurs, with which I suppose, one should be able to set the default sound device automatically.
This might just give you a pointer where to start looking.
Regards, Willem


On Fri, 2 Sep 2016, Nolan Darilek wrote:

I have a semi-complicated soundsetup. My laptop has crappy internal speakers that I don't use unless I have to. It plugs in via USB to a dock, which has an internal sound device that I don't use. To the dock I've connected a Creative USB 5.1 surround system to which my desktop speakers connect, and which sees most of my use. I also run a set of wireless headphones, also connected via USB, which are only occasionally connected and in use.

This complicated setup never gave Windows any issues, but Linux/Pulse just can't handle it. At the moment I have the correct sound setup configured, but if I disconnect my hub then I often don't get sound back when I reconnect it. I've taken to pulling the hub connection, which causes fallback to the internal speakers, at which point I navigate to Settings and reconfigure the right connections.

But lately something is horribly broken and I don't know what. Sometimes, despite arrowing up and down on the device selection combo box, sound goes away and never comes back (I.e. I'd expect it to return at some point if my selection lands back on Internal Speakers, but it never does.) Sometimes, plugging back in the hub doesn't bring back my USB devices (as in, even my USB keyboard doesn't come back) and I can only conclude that rapidly cycling devices is confusing some subsystem or other.

Does anyone have any experience configuring this mess via the command line? It would be useful if I could dump my configuration as it is now, run a terminal command, and restore my preferred configuration without using the GUI. I also want to restore my sound profile to 5.0 Surround, which lately seems to be causing crashes as well. I seem to be locking up Linux entirely such that I can't even switch to another TTY and reboot.

As a semi-related aside, is there a way to navigate settings in combo boxes without selecting them? I'm wondering if I can navigate directly to the device I want and activate it without navigating through, and presumably rapidly cycling, a whole bunch of other devices between my current choice and the one I want. I don't know if that might be causing anything, I'm just annoyed at having to hard shutdown this laptop all of a sudden because I've lost all but my internal speakers.

Thanks.
_______________________________________________
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



--

This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. Please consider the environment before printing this email. _______________________________________________
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



_______________________________________________
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



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