Re: [Linuxsampler-devel] Cracks and xruns in audio

2018-02-08 Thread Thomas Howe
Hi all,

Please let me know if there's a better place to be sending these messages...


I think I've identified the problems a bit more clearly now:

0.0025 ms isn't a long enough fadout to prevent an audible click in some
cases, yet it is also too long to fit within a realtime buffer size. To
prevent the clicks ruining a performance, the fadeout time for voice
stealing needs to be quite a lot higher than the period size. Maybe around
20ms to be on the safe side?

The maximum number of audio streams should never be reached, as voice
stealing should keep the number of audio streams to a sane level. But if
enough notes are played in too short a time to release within 20ms, maybe a
fadeout based on the period size should be used as a last resort?

I also notice that “Least buffer fill stream usage” in Qsampler exceeds 50%
fairly often, the linuxsampler process never takes up more than 10 CPU.
Maybe there's some internal limit on how much processing linuxsampler gets,
which could be removed?


I'll try to make some example recordings of when errors occur soon, to make
this a bit clearer. I'm also happy to sponsor these issues if fixes are
manageable. My setup is glitchy at the moment, but apart from that it
sounds amazing.

(~: Tom

On 25 January 2018 at 14:46, Thomas Howe  wrote:

> Update:
>
>
> I have found that setting the maximum number of voices to 1 seems to
> eradicate the xruns completely! I hope this will be true for some higher
> numbers of voices too. It was previously set to something like 60.
>
>
> The non-xrun clicks are still present, every time I play a note before
> another has died (including release time I think). I also get this error
> message in Qsampler:
>
> EngineBase: WARNING, CONFIG_EG_MIN_RELEASE_TIME too big for current audio
> fragment size & sampling rate! May lead to click sounds if voice stealing
> chimes in!
>
>
> Which suggests my period size of 64 samples at 96kHz (0.67ms) is too low.
> So I will look into decreasing CONFIG_EG_MIN_RELEASE_TIME and report back
> when I find out how to. Any hints would be appreciated.
>
>
>
> I think, if this works, then to stress test my setup properly I would need
> some way to verify that the non-xrun clicks are really gone. Like some kind
> of LinuxSampler click counter. Is there a way to do this?
>
>
> On a side note, is there a way to run LinuxSampler in non-realtime mode,
> so that very polyphonic pieces or possibly even Black MIDI could be
> rendered?
>
>
>
> Please let me know if there's a better place to post this.
>
>
>
> (~: Tom
>
>
> On 24 January 2018 at 00:03, Thomas Howe  wrote:
>
>> Hi all, me again...
>>
>> Sometimes LinuxSampler's audio seems to glitch and cause xruns. Xruns
>> aren't registered by patchage and xrun-logger each time.
>>
>> Is this a normal issue? I think it might be related to polyphony (it
>> tends to occur when the sustain pedal is used in fast passages).
>>
>> I would imagine that pitch-shifting a lot of note samples at the same
>> time and then playing them all would be a very intensive task and likely to
>> cause audio glitches, but the processors don't max out or anything.
>>
>> Attached is a MIDI file (Liszt's 2nd Sonata in B Minor) which when played
>> with the SalamanderGrandPianoV3Retuned instrument, gives me a lot of audio
>> glitches.
>>
>> Also I'm using JACK2.
>>
>> Any advice still appreciated (:
>>
>> Tom
>>
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel


Re: [Linuxsampler-devel] Cracks and xruns in audio

2018-02-08 Thread Christian Schoenebeck
On Donnerstag, 8. Februar 2018 16:00:53 CET Thomas Howe wrote:
> Hi all,
> 
> Please let me know if there's a better place to be sending these messages...

The list is fine for that, it just became a bit more silent over here than it 
used to be. When it comes to newbie questions, those might probably quicker 
being answered on the web forum instead:

https://bb.linuxsampler.org/

> I think I've identified the problems a bit more clearly now:
> 
> 0.0025 ms isn't a long enough fadout to prevent an audible click in some
> cases, yet it is also too long to fit within a realtime buffer size. To
> prevent the clicks ruining a performance, the fadeout time for voice
> stealing needs to be quite a lot higher than the period size. Maybe around
> 20ms to be on the safe side?

Voice stealing is bound to the same audio fragment cycle. For one reason: if 
it was posponed to a subsequent audio fragment cycle then it would add 
(audible) latency to the newly spawned note/voice.

So when voice stealing kicks in, it picks an old voice, "kills" the old voice, 
which means it ramps its volume down as fast as possible (as defined by 
CONFIG_EG_MIN_RELEASE_TIME), renders its audio, then the voice object is 
immediately conquered by the new note, which immediately starts to render its 
audio with the same voice (C++) object. So the trick is, when this is done in 
the same audio fragment, then you are using one voice (C++) object for 
actually two audible voices simultaniously, and hence it adds no latency for 
the new note/voice.

Accordingly CONFIG_EG_MIN_RELEASE_TIME must not be bigger than your period 
size, otherwise you will see that mentioned warning message and you hear 
clicks. CONFIG_EG_MIN_RELEASE_TIME is a compile time option which you may 
lower to a certain degree. But obviously as soon as you make it soo small it 
results in audible clicks.

> The maximum number of audio streams should never be reached, as voice
> stealing should keep the number of audio streams to a sane level. But if
> enough notes are played in too short a time to release within 20ms, maybe a
> fadeout based on the period size should be used as a last resort?

Streams and voices are dynamically assigned to each other. That's because the 
two are handled by two separate threads (disk thread and audio thread). So a 
voice requests a stream when it needs it and releases it when no longer 
needed. Due to the latency involved for handling this, the amount of max. 
streams should be higher than the amount of max. voices in practice.

> I also notice that “Least buffer fill stream usage” in Qsampler exceeds 50%
> fairly often, the linuxsampler process never takes up more than 10 CPU.
> Maybe there's some internal limit on how much processing linuxsampler gets,
> which could be removed?

The performance bottle neck is usually the disk, not the CPU. But as long as 
you don't get audio dropouts then you can try to increase max. voices (and 
max. streams) to achieve a higher polyphony and reduce the potential 
requirement for voice stealing. You can easily play around with that i.e. from 
QSampler's settings dialog.

CU
Christian

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel