stevefolta / SFZero

A simple SFZ player plugin
MIT License
92 stars 32 forks source link

Why does SFZSynth::noteOn() call stopNoteQuick() for repeated notes? #4

Open jamiebullock opened 6 years ago

jamiebullock commented 6 years ago

SFZSynth::noteOn() calls SFZVoice::stopNoteQuick() if a note is repeated and not playing one shot mode. Why is this?

Because stopNoteQuick() initiates a 10 ms release, this causes a noticeable dip for quick repetitions of notes or chords with longer release times. Shouldn't SFZVoice::stopNoteForGroup() be called instead? Then the current behaviour will be retained if off_mode is set to fast (the default), but the standard release portion of the note will be entered if the off_mode is set to normal

The relevant code is here: https://github.com/stevefolta/SFZero/blob/90ee4819988345299f73a6fb6076dfc13f2d4200/module/SFZero/SFZero/SFZSynth.cpp#L53

jamiebullock commented 6 years ago

I've just had another look at this, and I'm pretty confident that Line 53 should be voice->stopNoteForGroup() and not voice->stopNoteQuick()

For off_mode the SFZ Spec says:

Region off mode. This opcode will determinate how a region is turned off by an off_by opcode

Unless we call voice->stopNoteForGroup() for the implementation of off_by , the value of off_mode will have no effect.

jamiebullock commented 6 years ago

Actually, it seems SFZero's implementation of off_mode is incomplete (it only supports the default and off_mode can't be read from the SFZ file). I am working on a fix for this.