fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Dealing with startup


From: Edenyard
Subject: Re: [fluid-dev] Dealing with startup
Date: Tue, 14 Oct 2008 11:18:06 +0100
User-agent: Thunderbird 2.0.0.12 (X11/20080213)

John O'Hagan wrote:
Ben Leggett wrote:

[...]
Currently, I start fluidsynth in a shell script in conjunction with
Dosbox, as opposed to systemwide, since the soundfont I use makes
fluidsynth take up quite a lot of memory.

Because this soundfont is large, fluidsynth startup time can take quite
a while, and can vary depending on whether it's a cold start or not.

Is there a way in a shell script to tell if fluidsynth has finished
loading a font? Using "sleep" doesn't always produce the desired
effects, since the load time is, as I said, quite variable. To recap, I
need a way to wait for fluidsynth to finish loading before I start
anything else.

I recently came across the same issue; I dealt with it (in Python) by using a while loop to keep trying to connect to fluidsynth server at its "localhost 9800" address:

I had the same problem when putting together a system using Fluid and Jorgan and I devised a Bash script to make the necessary connections after loading Fluid but before loading Jorgan. (I've shown the script below between the lines of #####s).

However, although it works, it seems to cause another problem: it seems to slow down the loading of my soundfont considerably. I wondered whether that was something to do with the testing loop taking up too many CPU cycles that should have been used on Fluidsynth's loading. I'm not much of a programmer (as my script probably reveals) and I'm somewhat stuck to know what the solution is. For now, I've resigned myself to accepting the very l-o-n-g SF load time but it would be nice to be able to speed it up a bit. For reference, the SF2 file is about 275 Mb in size.

Any clues would be very gratefully received. I only just cope with Bash scripts so I don't think that I could handle anything of a higher nature!

Cheers,
Gerald

##### Script to connect Fluidsynth once it's running ####

#!/bin/bash
###
### Connect Fluidsynth to VirMIDI.
### 7/9/2005.
###
echo "Waiting for Fluidsynth . . ."
while true
do
  aconnect -o | grep "Synth input port" > /dev/null
  FINDFLUID=$?
  if [ $FINDFLUID -eq 0 ]
  then
    echo "Fluidsynth running!"
    break
  fi
done
echo "Connecting Fluidsynth to Virtual MIDI . . ."
sleep 0.2
aconnect "Virtual Raw MIDI 1-0":0 FLUID:0
aconnect "Virtual Raw MIDI 1-1":0 FLUID:1
aconnect "Virtual Raw MIDI 1-2":0 FLUID:2
CONNECTFLUID=$?
if  [ $CONNECTFLUID = 0 ]
then
  echo "Fluidsynth connected!"
fi


#########################################################




reply via email to

[Prev in Thread] Current Thread [Next in Thread]