This forum is now locked and moved (back) to Plogue's forum http://plogue.com/phpBB3/viewforum.php?f=14
Restricting pitch bend to the last note played
  • Hey all,
      Is there a way to restrict pitch bend to the last note played? I recall that some Garritan sounds use a workaround by inserting CC#19 events in a sequence, but I'm looking for a solution that can be implemented for realtime playing. I know that there are Kontakt scripts that have this functionality.

    Any help/suggestions in this regard would be appreciated. Thanks in advance!

     - Guru

    P. S. My first post here, and I'd like to congratulate @davidv and others behind Aria and Sforzando, and the community efforts in keeping SFZ viable.

  • davidvdavidv
    Posts: 453

    Thanks Guru.

    Probably would require a detailed state machine of the logic/maths you require.

    Probably doing this would require the new math opcode I've recently cooked into ARIA but have not been disclosed.


  • Thanks for the reply.

    Unless I'm mistaken, the logic is pretty straightforward: pitchbend applies only to the last note-on received. Other notes that are still sounding, either by being held, or sustained, or still in release state are unaffected by pitchbend.

    As a workaround, could pitchbend be made group specific, in existing versions of Sforzando/Aria? The idea here is this:
    • External MIDI processing can be used to split consecutive notes into different channels.
    • Within SFZ, groups can be made channel specific using lochan and hichan, i.e. one group for Ch. 1, another for Ch. 2, and so on.
    So for e.g. if 3 notes are held, they're assigned Ch. 1, 2 and 3 respectively. Pitchbend will also be on channel 3. My question is, when pitchbend is coming in on Ch. 3, will the notes on Ch. 1 and 2, which are still sounding, be affected or not?

    If they do, it should perhaps be considered a bug - since lochan and hichan should affect all incoming MIDI, not just notes.

    Looking forward to your thoughts.

     - Guru
  • davidvdavidv
    Posts: 453

    lochan and hichan are not supported in anything but the old sfz.dll (IIRC not even dimension supports that)

    Now that I understand what you want to achieve, I don't have a magic trick for you (sadly).

    Probably will have the answer at a very unexpected time :)

  • davidvdavidv
    Posts: 453
    Maybe it would be best to implement something like note expression, because IMHO thats really the sole reason, to send bends and parameters to specific voices. Easier said than done in SFZ because of its legacy logic. More brain activity is required....
  • Ok, let's keep aside channel for now. There are other ways of ensuring that consecutive notes go to different groups. So here's my question: Does pitchbend apply to all held/sustained notes, irrespective of group?
  • davidvdavidv
    Posts: 453


    <group>

    bend_up=0

    bend_down=0

    bla bla


    <group>

    bend_up=200

    bend_down=-200

    bla bla


    But the only thing that can trigger a group in order is round robin, but that is not what you want

    what would be needed i guess would be some SFZ feature like this

    <group> bend_up=200 bend_down=200

    on_locc$IS_LAST_NOTE=127 //true


    then this group would only be called if its the last note played, applying bend_up/bend_down only then.

    sadly this kind of approach forces you to completely rethink the whole SFZ file structure according to the bend logic, so we would need something better.


  • I might be missing something here, but it appears to me that the SFZ file structure, as it exists today, is more than adequate to implement this - as long as the player engine is sophisticated enough.

    In fact, there's no need to use bend_up/bend_down, and the ideal group trigger would be round robin, actually:

    <group>
    group=1
    ...
    <group>
    group=2

    I.e., keep groups absolutely identical. The crucial part is this:  the player needs to see groups as polytimbral.

    I know this works, because I've already implemented it, and it's easy to try it out, with any VST instrument:
    In your host/DAW, use multiple instances of the same plugin, with the same preset, each with a separate channel. Using MIDI processing (e.g. through the midiPolyphony plugin of the PizMidi collection), consecutive notes can be assigned to different channels. Voila, pitchbend, aftertouch, CC, all effects apply only to the last note played. No note effects required.

    And it's even easier in the Aria player: use the ensemble to have the same SFZ file on 16 channels, so you only have 1 plugin in the host/DAW ( I wonder if the memory usage remains same, but that's a different issue).

    So the functionality is already there in the Aria engine, no restructuring of SFZ, no note effects required. Each SFZ file has to be treated as multitimbral, just the way an ensemble is already treated as multitimbral. This will give you several benefits, and not just for my  pitchbend problem: it allows aftertouch/mod/CC to be routed on a per-note/per-group basis. Not to mention, enormous possibilities with PolyAT.

    The last-note pitchbend is important for articulation of several instruments. I'm surprised that it already hasn't been done this way...!
  • davidvdavidv
    Posts: 453

    Since this is a SFZ forum I can't suggest a solution that uses external MIDI plugins myself and would want to implement this in SFZ directly, without kludges preferably


    If in the end what you want is an instrument, and not an ensemble, then all the logic should be handled in one 'slot'




  • davidvdavidv
    Posts: 453
    Also, shouldnt polyaftertouch be used instead? Seems one of the reason for this articulation around is to allow per note pitch changes in the case where your controller doesnt support polyaft.
  • The reference to the external MIDI plugins was just for the sake of illustration/proof of concept, to help understand the logic. In fact, external plugins are unnecessary -  this feature is part of the MIDI specification standard, called MIDI Mode 4 (Omni Off/ Mono), and is implemented on some hardware controller keyboards. Click here for an explanation. Such keyboards can transmit consecutive notes in different channels.

    The current SFZ specification is fully capable of utilizing MIDI Mode 4 to produce last-note articulations. However, the shortcoming  is with the SFZ player engine (Aria/Sforzando):
    1. The engine does not implement lochan and hichan and
    2. The engine does not route modifiers - CC/pitchbend/aftertouch through specific MIDI channels, so that only notes in channel X are affected by modifiers in channel X, but notes in channel Y are not affected.

    The huge disadvantage of this, is that a lot of beautiful articulation capabilities are lost. And I see no advantage to this implementation - except for slightly less coding effort, perhaps. ;)

    There are several string instruments where modulation - pitch/vibrato, anything - is applied only to one string, while the others are resonating. So this is a very important feature for realistic articulation.

    In summary, existing SFZ (without any external kludges/plugins) is good enough these beautiful articulations. The change is required at the level of the engine - Sforzando. I'd hope to see this in coming versions...! If not, developers would be forced to turn to Kontakt to emulate last-note articulations. Suggestion: you can make response to MIDI mode 4 available in Aria/Sforzando, for any SFZ file, and build in MIDI Mode 4 emulation for custom commercial instruments. That way, it's a win-win for everyone.
  • Hi AshvilleGuru, I haven't used pitch bending yet in sfz or sforzando, so I just want to be clear before I start fiddling around - if i pitchbend by using the pitchbend wheel or aftertouch or something appropriate, is the "standard" behaviour that this will bend all sounds playing at the time of bending? And that you want it to only affect the last note. And there's no easy way (being relative of course) to do this in sfz or sforzand?
  • Hi klodvig: yes, you've summarized the issue precisely.
  • Well, you have op codes like pitchlfo_depthpolyaft, which supposedly alters the pitch of the lfo for a particular note/key, so I guess the current sfz implementation lacks an op code like polyaft_bend=nn cent or something similar that would tell how many cents a a full aftertouch value should change the tone.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!