-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmusicmode.sh
More file actions
executable file
·73 lines (56 loc) · 2.05 KB
/
musicmode.sh
File metadata and controls
executable file
·73 lines (56 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# Script to launch audio servers for music making
# -----------------------------------------------
# Adapted from http://tedfelix.com/linux/linux-midi.html
# Archive: https://web.archive.org/web/20210805191244/http://tedfelix.com/linux/linux-midi.html
# Prerequisites:
# - jackd2 (tested w/ 1.9.12)
# - fluidsyth (tested w/ 2.1.1)
# - user membership in `audio` group
# (add user: `sudo gpasswd -a [user] audio`; log out & in)
# - lowlatency kernel *may* be needed on some systems
case $1 in
on )
echo Starting JACK...
# Start JACK
# NOTE: period 128 seems to be max for fluisynth not sucking
pasuspender -- \
jackd -d alsa --device hw:0 --rate 44100 --period 256 \
&>/tmp/jackd.out &
sleep .5
echo Starting fluidsynth...
# Start fluidsynth with GM soundfont
fluidsynth --server --no-shell -p "fluidsynth 1" --audio-driver=jack \
--connect-jack-outputs --reverb=0 --chorus=0 --gain=0.8 \
-o midi.autoconnect=false \
/usr/share/sounds/sf2/FluidR3_GM.sf2 \
&>/tmp/fluidsynth.out &
sleep .5
if pgrep -l jackd && pgrep -l fluidsynth
then
echo Audio servers running.
else
echo There was a problem starting audio servers.
fi
;;
off )
echo Stopping fluidsynth...
killall fluidsynth
[ $? == 0 ] || echo There was a problem stopping fluidsynth.
sleep .5
echo Stopping JACK...
killall jackd
[ $? == 0 ] || echo There was a problem stopping JACK.
sleep .5
pgrep -x fluidsyth,jackd && echo "There was a problem stopping audio servers." || echo "Audio servers stopped."
;;
status )
pgrep -x jackd && echo "JACK is running." || echo "JACK is stopped."
sleep .5
pgrep -x fluidsynth && echo "fluidsynth is running." || echo "fluidsynth is stopped."
sleep .5
;;
* )
echo Please specify on, off, or status...
;;
esac