Linux/Ubuntu/MidiSoftwareSynthesiserFluidsynthWithPulseaudio: fluidsynth.sh

File fluidsynth.sh, 943 bytes (added by tj, 9 years ago)

Auto start/stop script

Line 
1#!/bin/bash
2# Toogle-script to start and stop fluidsynth in a user session.
3# Copyright 2008 TJ <ubuntu@tjworld.net>
4# Licensed on the terms of the General Public License, version 2 or later.
5#  See /usr/share/common-licenses/GPL-2
6#
7# Each time the script is called it will change the state of fluidsynth. If it is currently running,
8# it will be stopped. If it isn't running it will be started.
9#
10# When using Pulse Audio many applications will use the libao library. To ensure audio output from
11# fluidsynth is directed to pulseaudio, edit /etc/libao.conf:
12#
13# default_driver=pulse
14#
15# Refer to http://www.pulseaudio.org/wiki/PerfectSetup
16#
17# Ensure sound fonts are installed
18#  sudo apt-get install fluid-soundfont-gm fluid-soundfont-gs
19
20PID=$(pidof fluidsynth)
21if [ $? -eq 1 ]; then
22        # start
23        fluidsynth -s -i /usr/share/sounds/sf2/FluidR3_GM.sf2 /usr/share/sounds/sf2/FluidR3_GS.sf2 >/dev/null 2>&1 &
24else
25        # stop
26        kill -s TERM $PID
27fi
28