Fluidsynth, soundfonts, jack, and latency

View: New views
12 Messages — Rating Filter:   Alert me  

Fluidsynth, soundfonts, jack, and latency

by prasad_brg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everyone,
  So I've been trying out AVLinux. By the looks of it, quite impressive
- but I soon ran into a rather serious issue, but I doubt whether it has
anything to do with AVLinux or not. I need your help in this knowing for
sure.

My usual setup involves a piano sample on Linuxsampler and a strings
soundfont on qsynth. I had an unusual gig last week that required no
piano sounds, but instead use of multiple layered samples. I therefore
used only qsynth, with 3 engines running concurrently. So in my brand
new AVLinux setup, I loaded up my samples, and had sooperlooper running
2-3 loops concurrently, all on a core2-duo macbook.

Initially, all was ok. No noticeable latency, no xruns whatsoever.But
during the rehearsals, this happened: after sometime, specially at some
point when sooperlooper was running full steam, suddenly there was this
HUGE latency, coupled with lots of dropped notes. As in, I could hold
down a dozen keys simultaneously on the midi controller, and not all
notes could be heard; those that did, would  be heard  at various
instants upto about half a second later. Completely unuseable.

This would persist even after restarting the jack server, but dissappear
on rebooting the OS.

To me, what is scary and irksome, is not (only) that this glitch
happened consistently, but that there were no error messages in the
qjackctl window. No xruns. Nothing that suggested that something had
gone terribly wrong somewhere (which it had).

I actually compromised on my gig sound, by offloading a lot of samples
what I wanted layered. I don't know if it was because of this, but I
didn't notice this particular issue on the gig itself (but it gave me
sleepless nights prior). But then, 5 mins before the start of the
program, I was left with no audio out of my system! (again, no error
messages). Restarted jack server, and everything back to normal.

Again, no error messages/warnings. Not so much as a by-your-leave. ;)

I'm now intent on finding the source of the problem. I'm looking for
pointers... where do I begin? Where's the 'smoking gun'?
Thanks in advance!
Cheers,

Guru


_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Re: Fluidsynth, soundfonts, jack, and latency

by jurgen-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

did you check the AVLinux forum?

On Nov 2, 2009, at 4:03 PM, Guru Prasad B. R. wrote:

> Hello everyone,
>  So I've been trying out AVLinux. By the looks of it, quite impressive
> - but I soon ran into a rather serious issue, but I doubt whether it  
> has
> anything to do with AVLinux or not. I need your help in this knowing  
> for
> sure.
>
> My usual setup involves a piano sample on Linuxsampler and a strings
> soundfont on qsynth. I had an unusual gig last week that required no
> piano sounds, but instead use of multiple layered samples. I therefore
> used only qsynth, with 3 engines running concurrently. So in my brand
> new AVLinux setup, I loaded up my samples, and had sooperlooper  
> running
> 2-3 loops concurrently, all on a core2-duo macbook.
>
> Initially, all was ok. No noticeable latency, no xruns whatsoever.But
> during the rehearsals, this happened: after sometime, specially at  
> some
> point when sooperlooper was running full steam, suddenly there was  
> this
> HUGE latency, coupled with lots of dropped notes. As in, I could hold
> down a dozen keys simultaneously on the midi controller, and not all
> notes could be heard; those that did, would  be heard  at various
> instants upto about half a second later. Completely unuseable.
>
> This would persist even after restarting the jack server, but  
> dissappear
> on rebooting the OS.
>
> To me, what is scary and irksome, is not (only) that this glitch
> happened consistently, but that there were no error messages in the
> qjackctl window. No xruns. Nothing that suggested that something had
> gone terribly wrong somewhere (which it had).
>
> I actually compromised on my gig sound, by offloading a lot of samples
> what I wanted layered. I don't know if it was because of this, but I
> didn't notice this particular issue on the gig itself (but it gave me
> sleepless nights prior). But then, 5 mins before the start of the
> program, I was left with no audio out of my system! (again, no error
> messages). Restarted jack server, and everything back to normal.
>
> Again, no error messages/warnings. Not so much as a by-your-leave. ;)
>
> I'm now intent on finding the source of the problem. I'm looking for
> pointers... where do I begin? Where's the 'smoking gun'?
> Thanks in advance!
> Cheers,
>
> Guru
>
>
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user@...
> http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Re: Fluidsynth, soundfonts, jack, and latency

by prasad_brg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

jurgen wrote:
> did you check the AVLinux forum?
>

No, I haven't, as of yet....

This is because it wasn't clear to me whether this is an OS issue. The
tricky thing here is that I changed 2 major things at the same time: the
OS, and the way Qsynth was utilised (as in, 3 engines instead of 1, many
more soundfonts, some never tried before, sometimes 3 running
concurrently, in the backdrop of heavy CPU usage). And I've noticed this
new phenomenon, and don't know which change to attribute it to.

OTOH, even if the OS is doing something in the background and causing
the delay, isn't the onus of at least reporting it (as an xrun/lost
note/dropped packet... sorry,  don't know the right term) upon the
application (in this case, qjackctl/qsynth)?

One more thing: I noticed that with 3 qsynth engines running together,
not all would show up in the qjackctl connections window at startup. I'd
have to restart 1 or more, and this was a dicey thing: sometimes
happens, sometimes doesnt, for the same setup, upon restarting the jack
server.

Which is why I'm a little more suspicious about the apps rather than the
OS... but I am open about this. If it is a good idea, then I will check
on the AVLinux forums as well.
Cheers,

Guru

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Re: Fluidsynth, soundfonts, jack, and latency

by Jonathan E. Brickman-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Guru, do you know what was/is the CPU load during the episode?

J.E.B.

> Hello everyone,
>   So I've been trying out AVLinux. By the looks of it, quite impressive
> - but I soon ran into a rather serious issue, but I doubt whether it has
> anything to do with AVLinux or not. I need your help in this knowing for
> sure.
>
> My usual setup involves a piano sample on Linuxsampler and a strings
> soundfont on qsynth. I had an unusual gig last week that required no
> piano sounds, but instead use of multiple layered samples. I therefore
> used only qsynth, with 3 engines running concurrently. So in my brand
> new AVLinux setup, I loaded up my samples, and had sooperlooper running
> 2-3 loops concurrently, all on a core2-duo macbook.
>
> Initially, all was ok. No noticeable latency, no xruns whatsoever.But
> during the rehearsals, this happened: after sometime, specially at some
> point when sooperlooper was running full steam, suddenly there was this
> HUGE latency, coupled with lots of dropped notes. As in, I could hold
> down a dozen keys simultaneously on the midi controller, and not all
> notes could be heard; those that did, would  be heard  at various
> instants upto about half a second later. Completely unuseable.
>
> This would persist even after restarting the jack server, but dissappear
> on rebooting the OS.
>
> To me, what is scary and irksome, is not (only) that this glitch
> happened consistently, but that there were no error messages in the
> qjackctl window. No xruns. Nothing that suggested that something had
> gone terribly wrong somewhere (which it had).
>
> I actually compromised on my gig sound, by offloading a lot of samples
> what I wanted layered. I don't know if it was because of this, but I
> didn't notice this particular issue on the gig itself (but it gave me
> sleepless nights prior). But then, 5 mins before the start of the
> program, I was left with no audio out of my system! (again, no error
> messages). Restarted jack server, and everything back to normal.
>
> Again, no error messages/warnings. Not so much as a by-your-leave. ;)
>
> I'm now intent on finding the source of the problem. I'm looking for
> pointers... where do I begin? Where's the 'smoking gun'?
> Thanks in advance!
> Cheers,
>
> Guru
>
>
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user@...
> http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
>  

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Parent Message unknown Re: Fluidsynth, soundfonts, jack, and latency

by prasad_brg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jonathan E. Brickman wrote:

> Guru, do you know what was/is the CPU load during the episode?
>
> J.E.B.
>  

No, Jonathan, unfortunately I didn't check... was running behind
schedule before the gig, and haven't been near my system since. It may
take a while for me to get back to my system, and checking CPU load will
be the first thing I intend to do.

Couple of other things that I missed out in previous posts. Firstly,
before the gig I wanted to check whether it was a qsynth-specific or
general fluidsynth issue, so I installed ghostess, which can run
multiple instances simultaneously. I loaded the same soundfonts, and
experienced exactly the same issue - so if there's a bug in the app,
then it must be in the fluidsynth libraries.

Second issue of note: few weeks ago, while still running Ubuntu, I
wanted to find out what exactly caused the jack crash that I reported on
this list at the time (perhaps unrelated to the current issue) . I found
a "stress test" to replicate the problem: hitting a lot of notes while
keeping my sustain pedal down. Initially, the crash would happen within
20-30 seconds of banging the controller (!). When I changed the
polyphony settings from 256 to 64, it would be much more stable - for
more than 10-15 mins of banging! Again, I was able to replicate the same
thing with ghostess.

This incident has left me with a lurking suspicion about a possible bug
in the fluidsynth libraries. I'm curious, though... has anyone else
experienced similar issues?
Looking forward to pointers/feedback/suggestions.
Cheers,

Guru



_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Parent Message unknown Re: Fluidsynth, soundfonts, jack, and latency

by Jonathan E. Brickman-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, I use the same stress-test method :-)  I have seen your symptoms on
my setup.  I call it "ALSA confusion".  This happens as a result of
poorly written ALSA plugin code, or hardware which ALSA and/or the
kernel does not understand or work with very well.  I found the
following specific causes listed in WWW references:

1.  The ALSA Jack plugin.  Don't try to use it.  It is bad.  I saw this
one happen.

2.  Very heavy use of my motherboard sound system with ACPI engaged in
the kernel.  I turned off ACPI in the kernel, my latency dived,
performance rose, and ALSA confusion vanished.

3.  Sharing an IRQ between the motherboard sound and the video system.  
This can be tricky to solve, it can require BIOS changes and/or PCI card
position changes, and is not always possible for motherboard hardware.  
Happily, a very good quality PCI implementation should not exhibit this
problem at all.  I didn't see this one happen (my motherboard is new),
but read about it a lot in trying to solve my problems.

4.  Attempts to write to the same ALSA device by two different apps
simultaneously.  On AVLinux this shouldn't be too hard to spot, in many
desktop distro situations it might be considerably more difficult.  The
ALSA docs say the problem doesn't exist because the 'dmix' plugin is
automatically engaged, but it's simply not factual, the automatic
solution just does not happen in a great many cases, and my new
very-low-noise pro audio sound card is one of them.  I solved this one
by permitting only Jackd to output directly to the ALSA device;
everything else outputs either to ALSA's Pulse driver (thus far working
very well indeed) or to Pulse (itself designed to handle multiple
streams), which then hands the data to Jackd, which is tremendously good
at handling multiple streams, at the very low latencies which we need.

J.E.B.

> Jonathan E. Brickman wrote:
>> Guru, do you know what was/is the CPU load during the episode?
>> J.E.B.
>>  
>
> No, Jonathan, unfortunately I didn't check... was running behind
> schedule before the gig, and haven't been near my system since. It may
> take a while for me to get back to my system, and checking CPU load
> will be the first thing I intend to do.
>
> Couple of other things that I missed out in previous posts. Firstly,
> before the gig I wanted to check whether it was a qsynth-specific or
> general fluidsynth issue, so I installed ghostess, which can run
> multiple instances simultaneously. I loaded the same soundfonts, and
> experienced exactly the same issue - so if there's a bug in the app,
> then it must be in the fluidsynth libraries.
>
> Second issue of note: few weeks ago, while still running Ubuntu, I
> wanted to find out what exactly caused the jack crash that I reported
> on this list at the time (perhaps unrelated to the current issue) . I
> found a "stress test" to replicate the problem: hitting a lot of notes
> while keeping my sustain pedal down. Initially, the crash would happen
> within 20-30 seconds of banging the controller (!). When I changed the
> polyphony settings from 256 to 64, it would be much more stable - for
> more than 10-15 mins of banging! Again, I was able to replicate the
> same thing with ghostess.
>
> This incident has left me with a lurking suspicion about a possible
> bug in the fluidsynth libraries. I'm curious, though... has anyone
> else experienced similar issues?
> Looking forward to pointers/feedback/suggestions.
> Cheers,
>
> Guru

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Re: Fluidsynth, soundfonts, jack, and latency

by Dominic Sacré :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 02 of November 2009 14:42:43 Guru Prasad B. R. wrote:

> Second issue of note: few weeks ago, while still running Ubuntu, I
> wanted to find out what exactly caused the jack crash that I reported
> on this list at the time (perhaps unrelated to the current issue) . I
> found a "stress test" to replicate the problem: hitting a lot of
> notes while keeping my sustain pedal down. Initially, the crash would
> happen within 20-30 seconds of banging the controller (!). When I
> changed the polyphony settings from 256 to 64, it would be much more
> stable - for more than 10-15 mins of banging! Again, I was able to
> replicate the same thing with ghostess.
>
> This incident has left me with a lurking suspicion about a possible
> bug in the fluidsynth libraries. I'm curious, though... has anyone
> else experienced similar issues?

I also have some problems with fluidsynth causing very high CPU load. I
normally run ghostess with fluidsynth-dssi, but I'm pretty sure it's the
same with other fluidsynth frontends. It's interesting that fluidsynth's
CPU load is in many cases much higher than that of linuxsampler, for
example.

Also, what exactly does the polyphony setting in fluidsynth mean? Do
soundfonts have multiple layers which all use up polyphony? That would
be the only explanation I have for how easily I can exceed the available
polyphony (without even using the sustain pedal). But on the other hand,
most soundfonts sound rather plain, so something doesn't seem right
there... Where are all my CPU cycles going?


Dominic

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Re: Fluidsynth, soundfonts, jack, and latency

by david-602 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jonathan E. Brickman wrote:

> 2.  Very heavy use of my motherboard sound system with ACPI engaged in
> the kernel.  I turned off ACPI in the kernel, my latency dived,
> performance rose, and ALSA confusion vanished.

Interesting, I decided I'd try that (turn off ACPI), but then I had
absolutely no sound. JACK saw the external sound card, but no sound came
from it. And the system didn't see the laptop's built-in Intel sound
hardware, either - so no sound there.

So it's back to ACPI on and 64msec latency. Probably the best I can get
without a RT kernel. When I tried this using the Music 2 beta DVD, which
runs a RT kernel, I got sound but any latency setting below 64msec
contributed overruns to the experience of playing Zyn.

--
David
gnome@...
authenticity, honesty, community
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Re: Fluidsynth, soundfonts, jack, and latency

by Lee Revell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 2, 2009 at 3:03 AM, Guru Prasad B. R. <prasadbrg@...> wrote:

> Hello everyone,
>  So I've been trying out AVLinux. By the looks of it, quite impressive
> - but I soon ran into a rather serious issue, but I doubt whether it has
> anything to do with AVLinux or not. I need your help in this knowing for
> sure.
>
> My usual setup involves a piano sample on Linuxsampler and a strings
> soundfont on qsynth. I had an unusual gig last week that required no
> piano sounds, but instead use of multiple layered samples. I therefore
> used only qsynth, with 3 engines running concurrently. So in my brand
> new AVLinux setup, I loaded up my samples, and had sooperlooper running
> 2-3 loops concurrently, all on a core2-duo macbook.

If it only happens when you run more than 1 fluidsynth app at once, a
locking bug in the fluidsynth shared library would explain those
symptoms.  Is it supposed to be thread safe?

Does the problem go away if you leave JACK running but restart all the
fluidsynth apps?

Lee
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Re: Fluidsynth, soundfonts, jack, and latency

by prasad_brg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry everyone, for keeping the thread hanging...
  I was away from my system for a few days, and just got back.
@J.E.B
Wow! That looks like a rather comprehensive list. Will try each
suggestion, perform the stress test, and get back to you.
@Lee
Interesting idea. If memory serves me right, restarting only fluidsynth
doesn't solve the problem, but I have to confirm this. Will do so soon...
Cheers,

Guru
Lee Revell wrote:

> On Mon, Nov 2, 2009 at 3:03 AM, Guru Prasad B. R. <prasadbrg@...> wrote:
>  
>> Hello everyone,
>>  So I've been trying out AVLinux. By the looks of it, quite impressive
>> - but I soon ran into a rather serious issue, but I doubt whether it has
>> anything to do with AVLinux or not. I need your help in this knowing for
>> sure.
>>
>> My usual setup involves a piano sample on Linuxsampler and a strings
>> soundfont on qsynth. I had an unusual gig last week that required no
>> piano sounds, but instead use of multiple layered samples. I therefore
>> used only qsynth, with 3 engines running concurrently. So in my brand
>> new AVLinux setup, I loaded up my samples, and had sooperlooper running
>> 2-3 loops concurrently, all on a core2-duo macbook.
>>    
>
> If it only happens when you run more than 1 fluidsynth app at once, a
> locking bug in the fluidsynth shared library would explain those
> symptoms.  Is it supposed to be thread safe?
>
> Does the problem go away if you leave JACK running but restart all the
> fluidsynth apps?
>
> Lee
>
>  


_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Re: Fluidsynth, soundfonts, jack, and latency

by prasad_brg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello everyone,
  Finally! Here's a quick update on my fluidsynth issues.
I figured there has to be a better way of stress testing the system than physically banging my midi controller. I created a simple file in rosegarden , equivalent of hitting 88(?)keys repeatedly in a loop, with the sustain pedal on; I've attached the rosegarden file. It would be nice if people could post results of using this file (or a more suitable one!).

Here are some of the initial (and very interesting) results (core 2 macbook running AVLinux):
Using 2 qsynth engines, each containting multiple soundfonts (around ~200 MB), at higher speeds (above 360 BPM), fluidsynth (qsynth in this case) crashes with this error in the qjackctl messages window:

subgraph starting at qsynth timed out (subgraph_wait_fd=32, status = 0, state = Finished, pollret = 0 revents = 0x0)

Sometimes, not just qsynth, but other applications, such as jack-rack or rosegarden also crash with the same error.

So not only does fluidsynth itself crash, it can potentially drag down the whole ship with it!

To answer Lee's question, yes and no. Most of the times, I can restart the qsynth engines and everything's back to normal, but occasionally, I have to restart jackd itself.


For some soundfonts (including my "bread and butter" ones :( ), running the loop at 720 BPM guarantees an (almost) instant crash, within around a second.


Yes, the crash corresponds to cpu usage spikes of ~50% (at least).


Of course, the stress test is unreasonably demanding, but eventually, that kind of extreme stress will be encountered. For a live musician, an application that cannot deal with it is simply unreliable. Bottomline: Using soundfonts on linux system for a live performance is a bad idea.

On the other hand, I ran the same thing against ~900 MB piano sample on Linuxsampler. Perfectly stable at 720 BPM.
Of course, I can't percieve dropped notes, and there are no xruns reported, but still.. it doesn't crash!!! (This ties in with Dominic's observation of 'better' performance of LInuxsampler vis-a-vis Fluidsynth).

Which brings me to ask: what does it mean for a subgraph to "time out"? Understandably, a given audio application can't be expected to perform under any cpu load. But why can't fluidsynth just drop notes and move on? Are there any simple workarounds for subgraphs timing out, or is it an inherent bug in the fluidsynth libraries? The strong feeling that one gets is that fluidsynth has simply not been designed with failsafes in mind, for extreme situations.

Also, are there fluidsynth developers who are on this list? If not, is there a better forum to give them feedback regarding these issues? Given the availability of decent to good soundfonts, and the number of man-hours put in by various developers on applications like qsynth and ghostess, it is truly unfortunate that the base fluidsynth library itself is inherently unusable in live contexts.
Cheers,

Guru


(P.S. I do hope I'm not jumping to conclusions here. If someone can show that the problem lies not with fluidsynth but some other application, I'd be happy to be corrected. But that there is a serious problem somewhere, there is little doubt!)



On Sun, Nov 8, 2009 at 12:38 PM, Guru Prasad B. R. <prasadbrg@...> wrote:
Sorry everyone, for keeping the thread hanging...
 I was away from my system for a few days, and just got back.
@J.E.B
Wow! That looks like a rather comprehensive list. Will try each suggestion, perform the stress test, and get back to you.
@Lee
Interesting idea. If memory serves me right, restarting only fluidsynth doesn't solve the problem, but I have to confirm this. Will do so soon...
Cheers,

Guru





_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

stresstest.rg (16K) Download Attachment

Re: Fluidsynth, soundfonts, jack, and latency

by Pedro Lopez-Cabanillas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I've forwarded your message to the FluidSynth-dev mailing list.

On Saturday, November 14, 2009, Guru Prasad wrote:
> Also, are there fluidsynth developers who are on this list? If not, is
> there a better forum to give them feedback regarding these issues? Given
> the availability of decent to good soundfonts, and the number of man-hours
> put in by various developers on applications like qsynth and ghostess, it
> is truly unfortunate that the base fluidsynth library itself is inherently
> unusable in live contexts.

To subscribe to the FluidSynth-dev mailing list:
http://lists.nongnu.org/mailman/listinfo/fluid-dev

Please take a look to the existing bug reports, and file a new one if you
wish: http://fluidsynth.resonance.org/trac/report/6

BTW: are you testing the recently released fluidsynth-1.1.0, or an older  
1.0.x ?

I recommend you to also try the simplest possible scenario: using the ALSA
audio driver instead of Jack, the command line interface fluidsynth client
instead of QSynth, and aplaymidi instead of Rosegarden. Provide the full
command line(s) used to perform the test, and the MIDI/SF2 files (URLs to
download, if they are published somewhere). Please include in the bug report
the exact version numbers of every program involved, and the origin of the
programs (if you compiled it yourself or installed from a distro's
repository).

Regards,
Pedro
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user