Latency with 1GrandPiano sample set

jea posted Dec 25 '18, 12:49:

Hi there,

just to let you know - the 1GrandPiano sample set has a varying length of silence before the samples. The silence is up to 50ms. Thsi creates "latency" issues so it would be good to fix that sample set or replace is with a better working one.

I created a sample trimmer in python to fix it. Can't post a link but you'll find it at juho-eric dot blogspot dot com.

HansEhv posted Dec 25 '18, 22:56:

Hi Jea,
Thanks. As this is not only set suffering from this, it will be a great help in reviving "unusable" sets without a lot of manual editing.

joseph posted Dec 27 '18, 13:22:

Hi Jea,
Just as an example, can you give filenames of a few WAV samples affected by a leading 50ms silence?

I haven't looked yet, but does your 'sample trimmer code' cut a constant x milliseconds at the beginning of each file, or is there a dB threshold, relative to the maximum volume of the sample? (the latter is the way to go I think: cut the beginning until we reach maximum_dB_of_the_sample - 20 dB).


jea posted Dec 27 '18, 18:23:

C1v2 is one with some 50ms or something like that. I'd maybe even cut it further than that.

The files have differing lengths of silence so cutting a constant amount of ms is not an option.

My trimmer script works with threshold values. A db conversion could be done if wanted.

The getframe(frames, f) returns sample values for left and right channel. The values are between -32768 and 32767 for these files (Audacity calls the format "Stereo 32-bit float"). So that value is compared to the "startthreshold" value, which is set to 100 in the script example.

The 100 is roughly -50dB. A "startthreshold" of 3277 would be -20dB. But that would cut the attack too much IMHO.

When the absolute of the sample value reaches "startthreshold" or over, the samples before that are cut out and a short fade in of 4 samples is applied to not cause a "pop" sound each time the sample starts.

The same process is done in reverse for the ending of the sample. There are large amounts of silence in the samples also after the sample. This reduces the sample pack size, makes loading quicker and you shouldn't be able to notice the difference.

Though the script looks awful when I now look at it two years later, it seems to work! At least for this wav format :)

jea posted Dec 27 '18, 18:36:

Cutting the silence from the ending of the samples might reduce some unnecessary polyphony. I'm not sure how big an effect it will have to anything tho! :D


  (not published)
  I want to post as guest