-
Notifications
You must be signed in to change notification settings - Fork 193
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
Switch from ALSA to PulseAudio #153
base: buster
Are you sure you want to change the base?
Conversation
Reading through the code everything looks great. I'm wondering if the audio_setup.sh script should be updated as well to refer to pactl / pacmd in the comments instead of the alsa / amixer ones? |
Thanks - I didn't see those. I've put both this and PR #154 into a release candidate image available here: It doesn't include these comment updates, and still has the mycroft-setup-wizard alias. But is functionally equivalent. If anyone is watching along it would be great to get some independent validation of these updates. |
Couple of things as feedback, from going through the same process for OVOS a while ago; Did you recompile mimic1 with pulse support? As the default uses ALSA. Quickest solution is to also force ALSA through Pulse by; |
Thanks @j1nx - great feedback! I haven't recompiled Mimic - TBH I just switched it over, it seemed to work so I called it a day. I have added an issue to Mimic for us to do this properly as I think we should be moving more consistently over to PA. For the moment I'll add the OVOS The ALSA stuff in the Volume Skill has also been on my radar to tackle for a while. I started to extract things out yesterday - see the WIP PR above. Interested in any thoughts on this approach as a bridge to these moving to the HAL. |
Mycroft doesn't use mimic to output the audio so for "normal" usage it won't really affect anything that it's currently built with alsa, running from the commandline may be affected. |
Last tip which is the default within OVOS (less sensitive for; no output issues)
This will send the sound output to all found sinks. So with that you will have sound output to both 3.5mm jack and HDMI (and any other attached sinks for that matter) |
Oh, that is really cool! |
mimic appears to already be compiled for pulseaudio, or at least an strace of the output of "mimic -t hello" shows it looking up pulseaudio config files and libraries? |
Could be, but the linked library is wrong. I then configure it with "--prefix="/usr/local" --with-audio=pulseaudio" However like Ake said, if it is only used to generate WAV files it should be fine regardsless, but perhaps your chop off issue is related. |
Right. (@jinx is talking about my woes at https://community.mycroft.ai/t/picroft-headphones-no-output-sound/10852/16) It appears that the "speak" command calls the mimic command-line executable, so it doesn't take the same codepath as the mycroft audio process does when it does TTS, it seems. That said, even if I do In any case, here's
|
This is painful and insane but the solution at https://askubuntu.com/a/1310141 works. Play a 5 minute inaudible 20khz wav file via paplay over and over in the background while mycroft runs. It keeps the usb speaker from idling. Every syllable uttered by Mycroft is played while this is happening. I wish disabling suspend-on-idle worked instead, but it does not. I don't have a dog. I'm sure he would not like it. |
home/pi/auto_run.sh
Outdated
read -N1 -s card_num | ||
card_name=$(pactl list sinks short | awk '{print$2}' | sed -n ${card_num}p) | ||
pactl set-default-sink ${card_name} | ||
echo 'pactl set-default-sink ${card_name}' >> ~/audio_setup.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of wonder if it would behoove us here to emit pactl unload-module module-suspend-on-idle
by default here, given that we know that suspension is a problem with many devices. If that doesn't sound reasonable, maybe we could add it as a comment to the sample audio_setup.sh above?
wavcmd=$( jq -r ".play_wav_cmdline" /etc/mycroft/mycroft.conf ) | ||
wavcmd="${wavcmd/\%1/\/tmp\/speak.wav}" | ||
$( $wavcmd >/dev/null 2>&1 ) | ||
~/mycroft-core/mimic/bin/mimic -t $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good that the user may hear some output as a result of this being called, but using mimic esp when it is not compiled for pulseaudio doesn't tell us much about whether e.g. mycroft-speak or the codepath that mycroft actually uses to do TTS will work for them, will it?
I have been following this issue lately for a picroft with the AIY v1 voice hat. All is working, except for sound. Mycroft is constantly "yelling" (it is embarrasing when I am in a work call and all of a sudden mycroft pipes in with "I'm sorry I don't understand". I am curious whether we would expect the AIY-asound.conf file or the OVOS asound.conf to reside at /etc (though I didn't really find either helped volume). Is this a quirk of the hardware, or am I missing a step somewhere? |
Hey, I don't have an AIY kit so can't help there, but for the ALSA config (asound.conf) |
fix pulseaudio cardname audio_setup.sh generation
Switches all ALSA commands to use PulseAudio
pactl info list sinks/sources short
play_type_cmdline
settings for each device, hence these mycroft.conf settings have been removed.This fixes the issues raised in PR #150 that are present in the newer RPi kernel.
Description of how to validate or test this PR
mycroft-wipe
If you need to run the wizard again as if it was fresh:
CLA