Linuxsampler playback has high jitter

Link to good samples/soundfonts at http://wiki.linuxaudio.org/wiki/free_audio_data

Moderators: MattKingUSA, khz

Post Reply
voodoosound
Established Member
Posts: 8
Joined: Mon Dec 02, 2013 10:27 am

Linuxsampler playback has high jitter

Post by voodoosound »

Hi *,

I am new to linuxsampler. I use Linux Mint 18 with preempt kernel on the host system and a VirtualBox VM, Mint 18 generic kernel, to run Sequencer and Sampler. I compiled linuxsampler from source together with qsampler. I use muse as MIDI sequencer, all connected via Jack.

I recorded my own bass guitar SFZ library, with 4 different velocities over 4 octaves, starting with B1.
Everythings working fine so far. Sequencer notes trigger the correct samples and they are played back.

Now I encountered an unpleasent behavior and I wanted to ask for some help to overcome this.

When one note is played very fast ( e.g. 32th) twice in a row, no sample is played.
Quickfix: 4 instrument channels in sequencer and sampler responding to different MIDI channels. The MIDI notes have the same fast onset, but are in different instrument channels with much later note off.
works...
At least the notes are played, but the playback has very high jitter/variation in exact playback time. Not only with fast notes.

My next step is to crop the samples more accurately.

Are there any other suggestions?
Perhapes some compile time options?

BR,
Ck
User avatar
Michael Willis
Established Member
Posts: 1450
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Re: Linuxsampler playback has high jitter

Post by Michael Willis »

I'm curious about what you are doing with virtual box, and if you have an idea of how much CPU it is using, or are you running mint with your audio software inside of the VM? Either way, it sounds like it's not ideal for a computer intended for audio production.

Second, do your fast midi notes overlap? I think that overlapping the same note can lead to unexpected behavior in some midi software, so you could try shortening the notes slightly to make sure that one ends before the next begins.

Edit: one other thought I had, if you tried to set up round-robin samples, it's possible that something is messed up on the second step of your round robin, such that you can hear the first sample but not the second one.
voodoosound
Established Member
Posts: 8
Joined: Mon Dec 02, 2013 10:27 am

Re: Linuxsampler playback has high jitter

Post by voodoosound »

Hi Michael,

thanks for the reply!
Michael Willis wrote:I'm curious about what you are doing with virtual box, and if you have an idea of how much CPU it is using, or are you running mint with your audio software inside of the VM? Either way, it sounds like it's not ideal for a computer intended for audio production.
VirtualBox is running LinuxSampler and Hydrogen in Mint18.
Since you can tell VB to use the host system SSD cache, it is actually pretty fast. It takes about 30% of a single CPU Core (i7 6880HQ).
Hydrogen for example plays perfectly.
The latency of live MIDI keyboard input however, is pretty high. But that does not bother me too much, because I can't play it anyway. :)
Second, do your fast midi notes overlap? I think that overlapping the same note can lead to unexpected behavior in some midi software, so you could try shortening the notes slightly to make sure that one ends before the next begins.
When I used a single sampler channel, they did not overlap. Seemed to me like the midi note was not long enough to trigger the attack of the sample.
With 4 sampler channels, the midi notes in the layered channels overlap, but each sampler channel listens to a another MIDI channel. Thus, a note off can be received after a second note on event.

Edit: one other thought I had, if you tried to set up round-robin samples, it's possible that something is messed up on the second step of your round robin, such that you can hear the first sample but not the second one.
Could this be causing jitter as well?
Where can I find/adjust RR?
Compile time of linuxsampler?
sfz file?

BR,
Ck
User avatar
Michael Willis
Established Member
Posts: 1450
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Re: Linuxsampler playback has high jitter

Post by Michael Willis »

voodoosound wrote: VirtualBox is running LinuxSampler and Hydrogen in Mint18.
Tell me more about this setup, I'm not sure I fully understand.

1. What memory, CPU, and sound interface does the host system have?
2. What resources do you allocate to the VM?
3. Are you running JACK in the host system, or in the VM, or both?
4. How do you set up your audio routing, both on the host and on the VM?
5. Did I understand correctly that you're running Mint 18 on both the host and the VM, but with different kernels?

I'm still confused as to why you're running your sequencer and sampler in the VM. Is it so that you can easily save and restore state? I really think you would have better results running them on your host system, particularly because generic kernel is not recommended for audio work.
voodoosound wrote: Could this be causing jitter as well?
Where can I find/adjust RR?
Compile time of linuxsampler?
sfz file?
You said that you captured your own bass samples, right? Did you create the SFZ file? Round robin is an optional thing that you can configure in the SFZ file, in which you have two or more samples for a given note instead of one, and then playback alternates between those samples. It's used for things like moving the bow up and down on a violin, or avoiding the "machine gun" effect on drums, etc. If you wrote the SFZ file and you didn't specifically include round robin samples, then it is probably not your problem.
voodoosound
Established Member
Posts: 8
Joined: Mon Dec 02, 2013 10:27 am

Re: Linuxsampler playback has high jitter

Post by voodoosound »

Michael Willis wrote: Tell me more about this setup, I'm not sure I fully understand.

1. What memory, CPU, and sound interface does the host system have?
2. What resources do you allocate to the VM?
3. Are you running JACK in the host system, or in the VM, or both?
4. How do you set up your audio routing, both on the host and on the VM?
5. Did I understand correctly that you're running Mint 18 on both the host and the VM, but with different kernels?
1. 16GB RAM, i7-6880HQ 8-core, Focusrite Scarlett 2i2.
2. 2 CPU 4GB RAM and host SSD caching!
3/4. Both, connected via netjack. Host is Master, guest is slave. 12 channels io + midi. 64Frames/2P.
5. Both Mint 18. Host preempt, guest generic. I figured without IRQ to handle prempt in VM would not be of much use.
I'm still confused as to why you're running your sequencer and sampler in the VM. Is it so that you can easily save and restore state? I really think you would have better results running them on your host system, particularly because generic kernel is not recommended for audio work
I am using it on my laptop and move incremental versions to the recording machine in the studio. there is no internet access. but also share it with my band collegues to always have the same ground for this.

If you wrote the SFZ file and you didn't specifically include round robin samples, then it is probably not your problem.
I wrote it myself with no RR.

BR,
Ck
User avatar
Michael Willis
Established Member
Posts: 1450
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Re: Linuxsampler playback has high jitter

Post by Michael Willis »

voodoosound wrote:I am using it on my laptop and move incremental versions to the recording machine in the studio. there is no internet access. but also share it with my band collegues to always have the same ground for this.
Do you experience the same problem on the studio machine?
voodoosound
Established Member
Posts: 8
Joined: Mon Dec 02, 2013 10:27 am

Re: Linuxsampler playback has high jitter

Post by voodoosound »

Yes. Mint 18 with preempt and everything tuned for best low lat performance. 4-core fx3500 with 16gb ram.
User avatar
Michael Willis
Established Member
Posts: 1450
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 68 times
Been thanked: 162 times
Contact:

Re: Linuxsampler playback has high jitter

Post by Michael Willis »

I'm sorry, I'm out of ideas, other than try it on the host instead of the VM and see if you get the same results. Maybe somebody else around here can help.
voodoosound
Established Member
Posts: 8
Joined: Mon Dec 02, 2013 10:27 am

Re: Linuxsampler playback has high jitter

Post by voodoosound »

For others who might face this situation, I found the problem.

If you record your own sample library, it is crucial that the time from the beginning of a sample to its maximum attack is constant and as short as possible for all samples.

This removes the problem that short note are not played.
The mentioned jitter was a result of variing start-to-attack-time for samples of the same note played with different velocities.

Hope this helps someone.

BR,
Ck
Post Reply