I have written a tiny patch that allows off_by to trigger release of samples on the *same key* even within the same group. The result is a more consistent interpretation of the SFZ API. For example, complex ride patterns will not result in tens/100's of voices at the same time. This results in a more realistic sound, less CPU usage, less voice usage, and volume levels don't go through the roof.
--- linuxsampler/src/engines/sfz/Voice.cpp 2012-04-17 23:09:11.000000000 -0500
+++ linuxsampler/src/engines/sfz/Voice.cpp 2012-04-17 23:35:58.000000000 -0500
@@ -275,7 +275,7 @@
dmsg(4,("Voice %x processGroupEvents event type=%d", this, itEvent->Type));
if (itEvent->Type == Event::type_control_change ||
(Type & Voice::type_controller_triggered) ||
- itEvent->Param.Note.Key != MIDIKey) {
+ itEvent->Param.Note.Key) {
dmsg(4,("Voice %x - kill", this));
if (pRegion->off_mode == ::sfz::OFF_NORMAL) {
// turn off the voice by entering release envelope stage
Setting up SFZs to take advantage of the new feature
====================================================
It works like this:
For the purpose of an example, our group number will be 001. Of course, it can be any integer.
1) Groups trigger groups.
// Closed Hats on key 1, switched via MIDICC
<group> key=1 group=001 off_by=001 locc23=64 hicc23=127
<region> HatClosed.wav lorand=0 hirand=0.5
<region> HatClosed2.wav lorand=0.5 hirand=0.6
// Semi Open Hats on key 1, switched via MIDICC
<group> key=1 group=001 off_by=001 locc23=1 hicc23=63
<region> HatSemiOpen.wav lorand=0 hirand=0.5
<region> HatSemiOpen2.wav lorand=0.5 hirand=0.6
// Hi Hat Foot on key 2
<group> key=2 group=001 off_by=001
<region> HiHatFoot.wav lorand=0 hirand=0.5
<region> HiHatFoot2.wav lorand=0.5 hirand=0.6
* Regions within a group will not trigger release. Only if groups is seperate.
2) Regions trigger regions.
// Closed Hats on key 1, switched via MIDICC
<group> key=1 locc23=64 hicc23=127
<region> HatClosed.wav lorand=0 hirand=0.5 group=001 off_by=001
<region> HatClosed2.wav lorand=0.5 hirand=0.6 group=001 off_by=001
// Semi Open Hats on key 1, switched via MIDICC
<group> key=1 locc23=1 hicc23=63
<region> HatSemiOpen.wav lorand=0 hirand=0.5 group=001 off_by=001
<region> HatSemiOpen2.wav lorand=0.5 hirand=0.6 group=001 off_by=001
// Hi Hat Foot on key 2
<group> key=2
<region> HiHatFoot.wav lorand=0 hirand=0.5 group=001 off_by=001
<region> HiHatFoot2.wav lorand=0.5 hirand=0.6 group=001 off_by=001
3) You can define a "ghost trigger" <group> with group=NNN, and any <region> or <group> on those keys with the off_by=NNN will have their releases triggered.
// Closed Hats on key 1, switched via MIDICC
<group> key=1 group=001 off_by=002 locc23=64 hicc23=127
<region> HatClosed.wav lorand=0 hirand=0.5
<region> HatClosed2.wav lorand=0.5 hirand=0.6
// Semi Open Hats on key 1, switched via MIDICC
<group> key=1 group=001 off_by=002 locc23=1 hicc23=63
<region> HatSemiOpen.wav lorand=0 hirand=0.5
<region> HatSemiOpen2.wav lorand=0.5 hirand=0.6
// Hi Hat Foot on key 2
<group> key=2 group=001 off_by=002
<region> HiHatFoot.wav lorand=0 hirand=0.5
<region> HiHatFoot2.wav lorand=0.5 hirand=0.6
// ghost trigger
<group> end=-1 sample=samples\releaseTrigger_koala_silent_1.wav group=002
<region> key=1
<region> key=2
Shane Richards
|