Editing System-wide speakup
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 26: | Line 26: | ||
# Linux boots | # Linux boots | ||
# systemd gives root the current audio device | # systemd gives root the current audio device | ||
# systemd starts espeakup as root | # systemd starts starts espeakup as root | ||
# You can read the login prompt or login as root | # You can read the login prompt or login as root | ||
# You log in as your own user | # You log in as your own user | ||
Line 57: | Line 57: | ||
Running PipeWire system-wide is a little more complicated: You need to run both the PipeWire daemon and a session manager system-wide. This session manager needs to lock hardware and not give it up on seat switch. | Running PipeWire system-wide is a little more complicated: You need to run both the PipeWire daemon and a session manager system-wide. This session manager needs to lock hardware and not give it up on seat switch. | ||
=== Running espeakup as your user === | |||
TODO: formatting? | |||
It's possible to run espeakup as your own user by: | It's possible to run espeakup as your own user by: | ||
Line 68: | Line 68: | ||
* Running espeakup at boot as your user | * Running espeakup at boot as your user | ||
Follow these steps to do it. | |||
Step 1: Put this in /etc/modules-load.d/speakup.conf: | |||
<code>speakup</code> | |||
<code>speakup_soft</code> | |||
This will cause the speakup kernel modules to load at boot. | This will cause the speakup kernel modules to load at boot. | ||
Step 2: Put this in | Step 2: Put this in /etc/udev/rule.d/99-speakup.conf: | ||
<code>SUBSYSTEM=="sound", TAG-="seat", GROUP="audio"</code> | |||
<code>KERNEL=="softsynth*", GROUP="audio"</code> | |||
This will will do three things: | This will will do three things: | ||
Line 94: | Line 90: | ||
# Give users in the audio group access to Speakup | # Give users in the audio group access to Speakup | ||
Step 3: Put this in | Step 3: Put this in ~/.config/systemd/user/espeakup.service: | ||
<code>[Unit]</code> | |||
<code>Description=Software speech output for Speakup</code> | |||
<code>[Service]</code> | |||
<code>Environment="default_voice= ALSA_CARD="</code> | |||
<code>ExecStart=/usr/bin/espeakup -d --default-voice=${default_voice}</code> | |||
<code>Restart=always</code> | |||
<code>Nice=-10</code> | |||
<code>OOMScoreAdjust=-900</code> | |||
<code>[Install]</code> | |||
<code>After=pulseaudio.service</code> | |||
<code>WantedBy=default.target</code> | |||
This is a service that just runs the espeakup daemon. It is set to start after pulseaudio. | This is a service that just runs the espeakup daemon. It is set to start after pulseaudio. | ||
Change | Change 'pulseaudio.service' to 'pipewire.service' if on PipeWire. | ||
Step 4: Run these commands | Step 4: Run these commands: | ||
<code>systemctl --user enable espeakup</code> | |||
<code>loginctl enable-linger</code> | |||
<code>sudo gpasswd -a $USER audio</code> | |||
This does three things: | This does three things: | ||
Line 128: | Line 132: | ||
# Add your user to the audio group | # Add your user to the audio group | ||
Step 5: Reboot and | Step 5: Reboot and run espeakup as your user. | ||
There's two downsides to this method: | There's two downsides to this method: | ||
# Your user can see what other users are reading | # Your user can see what other users are reading | ||
# Other users can't play audio | # Other users can't play audio | ||
Line 138: | Line 142: | ||
There are some ideas I've considered to solve this problem. | There are some ideas I've considered to solve this problem. | ||
=== | === Locking PulseAudio after boot === | ||
TODO: ... | |||
=== Sharing Speakup === | |||
- logind can proxy/share fds | |||
- have a proxy that sits between speakup and espeak | |||
- send messages to espeakup instances based on current active UID | |||
- during a switch between instances, wait for the current instance to finish talking OR the stop talking control is sent. then start feeding the new instance data | |||
- have a shim that blocks pulseaudio from starting until it has permission, but also don't consume the buffer | |||
i do not like how i'm basically reinventing flow control but poorly | |||
ok so it turns out i was WRONG: you can't share speakup protocol between multiple synths! the protocol is stateful! ie if you tell it to change voice and switch synth the voice change won't be applied. YAY | |||
=== Sharing espeakup | === Sharing espeakup === | ||
so this makes the only viable solution to send PCM data from a root espeakup instance. | |||
on top of that this also means i have to modify espeakup to handle some flow control AND output to a buffer instead of the sound card | |||
=== Loaning PulseAudio to root === | |||
- the main case here is with root who doesn't have a pulseaudio setup | |||
- doesn't solve sharing speakup but maybe things could take turns? | |||