2

I'm attempting to have pulseaudio running in system mode and timidity sitting on top pulseaudio's alsa layer.

But timidty starts before pulseaudio and locks the soundcard leaving the whole system without audio.

This is my timidity.service

[Unit]
Description=TiMidity++ Daemon
After=pulseaudio.service
Requires=pulseaudio.service

[Service]
User=timidity
ExecStartPre=/bin/sleep 60
ExecStart=/usr/bin/timidity -iA -Os

[Install]
WantedBy=default.target

I added the ExecStartPre and Requires lines, but the issue persists.

I don't know if timidty is staring before pulseaudio finishes it's initialization (and ExecStartPre isn't working as supposed), or if pulseaudio delays locking the alsa device.


I'm using Ubuntu 20.04.

I've tried fluidsynth, which has pulseaudio support, as a replacement. But it has high usage even when nothing is being played.

2
  • Guess: You start timidity as a user that's not logged in, while Pulseaudio is bound to the user session. So Timidity using ALSA doesn't map to Pulseaudio, but instead takes over the device. Google for "system-wide pulseaudio", and read this. Or possibly start Timidity per user session after Pulseaudio.
    – dirkt
    Jul 10, 2020 at 5:00
  • I'm already using pulseaudio in system mode.
    – xvan
    Jul 10, 2020 at 19:53

1 Answer 1

1

Add the file /etc/systemd/user/timidity.service (permissions 644) with the following content:

[Unit]
Description=TiMidity++ Daemon
After=pulseaudio.service

[Service]
ExecStart=/usr/bin/timidity -iA

[Install]
WantedBy=default.target

Run:

systemctl --user enable timidity
systemctl --user start timidity

To apply this to all newly created users, add the file /usr/local/sbin/adduser.local (permissions 755) with the following content:

#!/bin/bash -e
sudo -u "$1" systemctl --user enable timidity

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .