You are not logged in.
I have a bizarre issue I can't figure out. I installed fluidsynth and the soundfont recommended from the wiki page. It's great, I can play midi files fine when I use aplaymidi -p128:0 FILE. I can also start the fluidsynth daemon by running the command:
fluidsynth -a pulseaudio -c2 -i -l -s /usr/share/soundfonts/fluidr3/FluidR3GM.SF2
I can also run that as root (sudo) with no issues.
But here is the strange thing, the /etc/rc.d/fluidsynth init script fails to start with that exact command in it. (I changed the original script so that fluidsynth uses pulseaudio instead of alsa). When I type:
rc.d start fluidsynth
It will work as a normal user, but it will NOT work as sudo or when I am su'd into the root account. I can't for the life of me figure it out. I have ensured that before starting fluidsynth each time, that it has already been terminated cleanly, so it's not that. I've even tried changing the shell the script runs as, no luck.
Below is the init script (cut down to the bare bones as I was debugging this).
#!/bin/bash
fluidsynth -a pulseaudio -c2 -i -l -s /usr/share/soundfonts/fluidr3/FluidR3GM.SF2
The error I get when I run this as root is:
FluidSynth version 1.1.5
Copyright (C) 2000-2011 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.
fluidsynth: error: Failed to create PulseAudio connection
Failed to create the audio driver
Does anyone have a clue why this is the case? PLEASE!
The original init script works fine (using alsa), but I don't want that because it hogs the sound card. I don't want to use Jack because it's stupid and hard to setup properly when you just want to play sound.
Last edited by Garfunkel (2012-02-05 14:09:32)
Offline
Anybody?
Offline
I have the exact same problem...it is very very frustrating. fluidsynth works perfectly as long as I don't try to start it at boot time. I have no idea why this is the case. It can't seriously be that PulseAudio somehow requires a tty, because that would be well, simply absurd and ridonkulous.
Did you ever figure out what it was? Logs and google are turning up with no results.
Offline
Does it work if you invoke sudo from within the rc script? I get the same problem trying to start your script as root. But I can start it if I login as root and run "sudo -u connor ./fluidsynth" or "su connor -c ./fluidsynth".
6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.
Offline
For me it seems to work when run manually, using sudo or running as root from a shell. Thus the statement about how ridiculous it is that a shell is required although I neither know or believe if that is actually the restriction/problem. It may just be a symptom of a different problem. I can't recall the results when a legacy fluidsynth init script is used in /etc/init.d but Anytime I try to start it using the following systemd file or any variation of it, I get the status listed below:
----------------- SYSTEMD FILE ----------------------
[Unit]
Description=FluidSynth software sound synthesizer
[Service]
Type=simple
ExecStart=/usr/bin/fluidsynth -g 0.7 -m alsa_seq -a pulseaudio -l -R no -i -s /home/sim/vection/system/sounds/synthgm.sf2
[Install]
WantedBy=multi-user.target
-----------------------------------------------------------------------------
Here is what systemctl status fluidsynth provides:
-------------------------------------------------------------------------------------
fluidsynth.service - FluidSynth software sound synthesizer
Loaded: loaded (/etc/systemd/system/fluidsynth.service; enabled)
Active: inactive (dead) since Wed, 18 Jul 2012 03:05:46 -0600; 1 day and 23h ago
Main PID: 449 (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/fluidsynth.service
Jul 18 03:05:45 localhost.localdomain fluidsynth[449]: fluidsynth: warning: No preset found on channel 9 [bank=128 prog=0]
Jul 18 03:05:46 localhost.localdomain fluidsynth[449]: fluidsynth: error: Failed to create PulseAudio connection
Jul 18 03:05:46 localhost.localdomain fluidsynth[449]: Failed to create the audio driver
Jul 18 03:05:46 localhost.localdomain fluidsynth[449]: FluidSynth version 1.1.5
Jul 18 03:05:46 localhost.localdomain fluidsynth[449]: Copyright (C) 2000-2011 Peter Hanappe and others.
Jul 18 03:05:46 localhost.localdomain fluidsynth[449]: Distributed under the LGPL license.
Jul 18 03:05:46 localhost.localdomain fluidsynth[449]: SoundFont(R) is a registered trademark of E-mu Systems, Inc.
-------------------------------------------------------------------------------------
I just cannot figure out why pulseaudio cares whether it's the system starting it or me at the keyboard. It simply does not accept starting up at boot time. I also take issue with it's -s flag. It never actually turns itself into a daemon/server. Instead it just sits there when it should really fork, reopen stdio, detach from the terminal, and do all the rest of the right stuff associated with daemonizing one's self. Then simply exit from the original process that called fork returning control on the main process back to the terminal like any self respecting daemon
I've disabled selinux, checked local firewall rulesets (none) and none of the obvious stuff is jumping out at me here.
Last edited by exedor (2012-07-20 09:24:18)
Offline
Sorry for the necropost - I ran into this issue before I realized the caveats below, and this was one of the top google results.
Problem: A pulseaudio user wants to start fluidsynth as a standard daemon using either rc.d or systemd.
Solution: As far as I can tell, you pretty much don't.
There are some characteristics of both pulse and fluidsynth that prevent this from working easily:
pulseaudio
pulseaudio does NOT like different users connecting directly to the pulse server at all (unless you're running it in system-wide mode, strongly discouraged by upstream for general desktop use). This includes root to a user's pulse server.
Because of this, pulse is not started during the boot process - it's usually started after user login, either explicitly or when something asks specifically for it via a pulse output or via ALSA with a proper asound.conf
One workaround to bypass the different user issue is to have programs run by a different user output sound to localhost via pulse's tcp output; in this case, however, there has to be a working pulse server already running for the connection to be made.
fluidsynth
If started with -a alsa before pulse, it will happily grab the soundcard.
If using the pulse output, it will attempt to connect at startup and maintain a constant active source. This is the biggie - if started with any form of pulse output, pulse must be ready when fluidsynth starts. This is in contrast to programs like mpd, which only open a source during actual playback. If not for this caveat, we wouldn't be having this discussion --;
If started using the alsa output AFTER pulse is running, it works fine via pulse's alsa-playback plugin. This doesn't help us boot with fluidsynth running, though.
In the end, I just added a start and stop alias to my bashrc - this seemed to be the easiest way to ensure it only started after pulse. This also saves a smidgen of cpu by getting rid of the always-on pulse source :p
Offline