MIDI.js icon indicating copy to clipboard operation
MIDI.js copied to clipboard

very long notes are truncated

Open algorithmixx opened this issue 6 years ago • 2 comments

If a midi note shall last longer than the duration of the soundfont sample the sound will stop when the end of the sample is reached. Adding "source.loop=true;" after the audio buffer has been created in "player.js" is a cheap work around.

Alas, if the sample contains an attack, the loop restart will be noticeable.

Is there a way to split buffers generally into attack / steady sound / decay ?

algorithmixx avatar Feb 03 '19 06:02 algorithmixx

The sound fonts don't have any information about attack / steady / decay, if you had that information you could certainly use it and get both infinite sustain AND smaller sound fonts, which would be great.

sf2 sound font has the attack / steady / decay information, but the sound font builder script included with MIDI.js doesn't actually understand sf2 files. It just renders an sf2 sound font to the js format by using the Fluidsynth synthesiser to play each note for 3 seconds.

hmoffatt avatar Feb 03 '19 22:02 hmoffatt

If a midi note shall last longer than the duration of the soundfont sample the sound will stop when the end of the sample is reached. Adding "source.loop=true;" after the audio buffer has been created in "player.js" is a cheap work around.

Alas, if the sample contains an attack, the loop restart will be noticeable.

Is there a way to split buffers generally into attack / steady sound / decay ?

Hi, could you elaborate on where to insert source.loop=true; in player.js? I'm having the same problem and need a quick fix. Thanks!

congfeng22 avatar Aug 14 '20 12:08 congfeng22