Reputation: 57
I’ve been toying around to create a functional bash script to solve my problem, but have’t been successful.
The problem:
I need to execute these two scripts from different terminals (or windows using screen
):
fluidsynth -a alsa -c 3 -g 3 /usr/share/sound/sf2/piano.sf2
aconnect 20:0 128:0
What I would do manually is launch screen
and execute the first command then ctrl+a+c
and execute the second.
The important part:
The second command can only be run after the fluidsynth
programs successfully powers-up, and must be run from a different terminal.
My attempt so far:
screen -S fluid /usr/midi/fluid.sh & sleep 10 aconnect 20:0 128:0
The fluid.sh file:
fluidsynth -a alsa -c 3 -g 3 /usr/share/sound/sf2/piano.sf2
Could anyone point out what I’m doing wrong here?
Upvotes: 2
Views: 651
Reputation: 6048
The simple answer would be:
screen -d -m -S fluid fluidsynth -a alsa -c 3 -g 3 /usr/share/sound/sf2/piano.sf2
screen -d -m -S connect bash -c "sleep 10; aconnect 20:0 128:0"
-d -m
tells screen to start in detached mode.
If you have a way to detect fluidsynth's powerup, e.g. there's a file that should be there, you can replace the sleep 10
with a loops that does sleep 1
until the file exists.
Upvotes: 2