Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set-card-profile feature request #14

Closed
leifliddy opened this issue Jan 22, 2017 · 3 comments
Closed

set-card-profile feature request #14

leifliddy opened this issue Jan 22, 2017 · 3 comments

Comments

@leifliddy
Copy link

leifliddy commented Jan 22, 2017

I found your project extremely helpful --thank you!!!
I'd like to request that a set-card-profile feature be implemented that would allow you to change the audio profile on a bluetooth device {headset_head_unit, a2dp_sink, off}

https://github.com/GeorgeFilipkin/pulsemixer/
pulsemixer allows you to change the card-profile within the curses interface.
Since this project is forked from pulsemixer, perhaps it would be possible to port that feature over?

I'd like to use this feature in an AlexaPI fork I'm working on --so that the audio profile can change based on whether Alexa is speaking or listening.

@mk-fg
Copy link
Owner

mk-fg commented Jan 23, 2017

Thanks.
Yeah, should be easy to add a wrapper for it, will do in a bit.

@mk-fg
Copy link
Owner

mk-fg commented Jan 23, 2017

Added PulseCardProfileInfo objects, PulseCardInfo profile_list/profile_active attributes and pulse.card_profile_set(card, profile) wrapper to easily change these in aaafb10 (17.1.3).

You can use it like this (example from the README):

>>> from pulsectl import Pulse
>>> pulse = Pulse('profile-changer')

>>> card = pulse.card_list()[0]
>>> card.profile_list
[<PulseCardProfileInfo at 7f02e7e88ac8 - description='Analog Stereo Input', n_sinks=0, n_sources=1, name='input:analog-stereo', priority=60>,
 <PulseCardProfileInfo at 7f02e7e88b70 - description='Analog Stereo Output', n_sinks=1, n_sources=0, name='output:analog-stereo', priority=6000>,
 ...
 <PulseCardProfileInfo at 7f02e7e9a4e0 - description='Off', n_sinks=0, n_sources=0, name='off', priority=0>]

>>> pulse.card_profile_set(card, 'output:hdmi-stereo')

pulse.card_profile_set can be passed either PulseCardProfileInfo object or just profile name string (as per example above).

ctypes wrapper was indeed already there, copied from pulsemixer code, just needed to add high-level objects/methods to call it.

Please reopen if there'll be any issue there.
Thanks!

@mk-fg mk-fg closed this as completed Jan 23, 2017
@mk-fg
Copy link
Owner

mk-fg commented Jan 23, 2017

I'd like to use this feature in an AlexaPI fork I'm working on --so that the audio profile can change based on whether Alexa is speaking or listening.

Don't know what you're doing there of course, but looking at how AlexaPI works, don't really see why you'd need to be changing card profiles there.

On a generic system, default profile should be something like "output:analog-stereo+input:analog-stereo" or "output:hdmi-stereo+input:analog-stereo" depending on plugged cables, which should allow both sound input (to e.g. record and send to Alexa API) and sound output (any playback), creating both pulse sink and source for the card.

Not sure if analog-jack/hdmi detection and profile picking in pulse works well on RPi, but if it picks some "output only" profile by default, you can probably change it once to input+output and leave it at that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants