Bug 252 - Note pool empty
Summary: Note pool empty
Status: RESOLVED FIXED
Alias: None
Product: LinuxSampler
Classification: Unclassified
Component: other (show other bugs)
Version: SVN Trunk
Hardware: PC Linux
: P5 normal
Assignee: Christian Schoenebeck
URL:
Depends on:
Blocks:
 
Reported: 2016-09-14 16:20 CEST by Nicola Pandini
Modified: 2017-07-13 16:25 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicola Pandini 2016-09-14 16:20:11 CEST
Hi,
if I play for a while with LinuxSampler SVN, it starts to display this message for almost every note I play:
"Engine: Could not launch new note; Note pool empty!"

when the message appears, I don't hear any sound from LinuxSampler.

I compile LS with this additions:
CXXFLAGS="-O3 -msse -march=core2 -mfpmath=sse -ffast-math -fomit-frame-pointer -funroll-loops" ./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --enable-stream-size=320000 --enable-preload-samples=262144 --enable-max-voices=200 --enable-max-streams=220
(mostly because of the poor disk performances).

Thanks

Nicola
Comment 1 Christian Schoenebeck 2016-09-21 00:20:33 CEST
More informations are required. For example which engine did you use (gig, sfz, sf2), does this only happen with certain instruments or with all instruments, if only with certain instruments, do you see what they have in common?
Comment 2 Nicola Pandini 2016-09-23 10:21:21 CEST
Hi Christian, 
I'm sorry, forgot to mention that I use only sfz engine.
The problem seems to happen more frequently on big instruments.
I notice the problem because I use LinuxSampler mostly with percussions samples, when I fast trigger a sequence of 10-12 notes for more than 20 seconds.

The problem is not present on a SVN version that I compiled on 7th of July
Comment 3 Nicola Pandini 2016-10-20 13:28:12 CEST
Hi,
I made some tests.
The problem is present even in the LV2 plugin.
So, for example, if I load one or more SFZ in Ardour and I trigger them with a MIDI track, after some minutes of playing it begins to skip some notes, until every note is skipped.
I reproduced this problem in linuxsampler svn17 and svn10.
The problem is not present in the revision ~2800 (the first release of linuxsampler 2.0.0).
Comment 4 Christian Schoenebeck 2016-10-20 13:57:14 CEST
My guess is this issue exists since SVN r2879:

http://svn.linuxsampler.org/cgi-bin/viewvc.cgi?view=revision&revision=2879

That revision introduced a fundamental design change within the engines: all voices are grouped to "Notes" since then (see Note.h). This was necessary to implement synthesis parameter changes in real-time on a per note level. Many sound presets are i.e. using layers, and thus when you trigger a key on your keyboard those instrument presets spawn multiple voices simultaneously instead of just one voice. Now for certain sound manipulation purposes one needs the information that those voices actually belong together, since they were caused by the same key being triggered on the keyboard. This was not possible previously, because before that, all active voices were simply assigned to a keyboard key. That means when you trigger a note multiple times on the same keyboard key, you had dozens of voices sticked to that one keyboard key within the engine, and the engine had no way to distinguish all those voices regarding their note which caused them individually, and which voices were spawned together. So that is an important change we needed.

The voices themselves are pre-allocated and available from a "voice pool". So whenever a new voice is spawned, the engine takes a Voice object from the voice pool, and once a voice became inactive, the Voice object is released back to the voice pool. It was always like this. Now with the mentioned change above though, there is also now a Note pool, which works exactly the same. Whenever you trigger a key on your keyboard a Note object is taken from the Note pool, then Voices are taken from the Voice pool and assigned to that Note object. And once all voices turned inactive and were released to the voice pool, the respective empty Note object is then released back to the Note pool.

Now for some reason it seems that the engine is currently not always releasing a Note object back to its pool. Which eventually leads to the situation that too many Note objects were not released, the Note pool becomes completely empty, so there are no Note objects left to be spawned, and then no voices are spawned anymore.

Why a Note object is not always freed back to its pool has to be determined, ATM I have no suspicion yet, so this has to be debugged.
Comment 5 Christian Schoenebeck 2016-10-20 14:25:47 CEST
To make the actual data layout change more clear of that design change; before that revision the engine's internal data structuring was like this:

    MidiKey -> Voice

There are 128 MIDI keys (as a MIDI note-on event may have a note number from 0 to 127), and each active voice was sticked to the respective "MidiKey" object (based on the note-on note number) it was triggered at.

Now the layout is like this:

   MidiKey -> Note -> Voice

So new voices spawned by a note-on MIDI event (still) cause one or more voices being spawned (depending on the instrument preset), but now those new "Voice" objects are sticked to a "Note" object, and that "Note" object is then sticked to the respective "MidiKey" object where the note-on MIDI event (MIDI note-on note number) was triggered at.
Comment 6 Christian Schoenebeck 2017-02-15 16:10:12 CET
Have you tried whether this bug still persists with latest SVN version of LinuxSampler? There had been numerous fixes to the engine in the meantime, and at least I did not encounter this issue anymore.
Comment 7 Nicola Pandini 2017-02-15 17:20:45 CET
Hi Christian,
I tried to compile the latest rev, but got those errors:

Makefile:918: set di istruzioni per l'obiettivo "install-data-local" non riuscito
make[3]: *** [install-data-local] Errore 1
make[3]: uscita dalla directory "/home/nicola/Progetti/AudioPRO/LinuxSampler/SVN/linuxsampler"
Makefile:797: set di istruzioni per l'obiettivo "install-am" non riuscito
make[2]: *** [install-am] Errore 2
make[2]: uscita dalla directory "/home/nicola/Progetti/AudioPRO/LinuxSampler/SVN/linuxsampler"
Makefile:497: set di istruzioni per l'obiettivo "install-recursive" non riuscito
make[1]: *** [install-recursive] Errore 1
make[1]: uscita dalla directory "/home/nicola/Progetti/AudioPRO/LinuxSampler/SVN/linuxsampler"
debian/rules:65: set di istruzioni per l'obiettivo "install" non riuscito
Comment 8 Nicola Pandini 2017-02-15 17:26:52 CET
forgot to mention that I'm compiling on a Debian Jessie
Comment 9 Christian Schoenebeck 2017-02-15 17:39:39 CET
That error is related to the "make install" step (after compilation succeeded). Forget about installing the sampler for now. You can run the sampler without installing it. Simply do:

make
src/linuxsampler

Then launch i.e. QSampler/Fantasia and setup the sampler with your sound.

BTW, in future it is always helpful to get error messages in English. That's quite simple to achieve. Simply do the following on the command line:

export LC_ALL=C

Then all programs you run from that terminal session will should print English messages.
Comment 10 Nicola Pandini 2017-02-15 20:02:24 CET
thanks for the hint, I've just compiled the revision 3112 (LinuxSampler 2.0.0.svn43) but the error is still present:

Engine: Could not launch new note; Note pool empty!
Comment 11 Christian Schoenebeck 2017-02-15 20:38:58 CET
Too bad. Ok, thanks for checking. I will investigate this issue when I find some time.
Comment 12 Christian Schoenebeck 2017-05-24 22:14:30 CEST
Hi Nicola,

I just fixed a bunch of bugs today which could be related to this bug. Could you please check if this issue still persists with latest SVN version of LS?

-Christian
Comment 13 Nicola Pandini 2017-06-07 11:51:35 CEST
Hi Christian,
I made a test today, and I'm still getting the "Note pool empty" error.
The behavior is the same of other versions, like rev. 3112.
Comment 14 Christian Schoenebeck 2017-06-07 12:38:42 CEST
Ok, since I was so far unable to reproduce this issue: you said this happens for you with the SFZ engine, and even after a relatively short time. Could you provide a simple demo sfz instrument that reproduces the issue for you? You can also send it to me by email if you want.

Also please check the MIDI output of the keyboard you are using whether there is any note worthy about what it sending exactly. For example whether the keyboard is sending any SysEx, RPN or NRPN messages before and/or when that problem occurs for you.
Comment 15 Christian Schoenebeck 2017-07-11 18:01:42 CEST
I just committed a fix for this bug (linuxsampler 2.0.0.svn69, svn r3306).

The problems were keys where no sample was mapped to, which caused a Note object leak when triggering such keys.

In all my tests it works now correctly. Let me know if you still have any issues with this new version.
Comment 16 Nicola Pandini 2017-07-13 16:25:06 CEST
I did my best to stress LinuxSampler: no more "note pool empty", stable as a rock, well done! :-)