Fade out and numPressedKeys



  • I'm experimenting and I think that fading out a note to -100 doesn't reduce the numPressedKeys counter - I'm trying to put together a simple example to demonstrate it at the mo.



  • Ok I've got an example that demonstrates the issue. It's a bit of a weird one. If you play a legato phrase and then release all the keys you'll see the numPressedKeys() in the console go up and it will keep going up everytime you do this, even though you're releasing all the keys. If you change the line of code in the first script from a fade out to Synth.noteOffByEventId() the problem is fixed.

    If you Console.print() the number of pressed keys in the first script the value is correct, it's only the second script that isn't correct and only seems to occur when the first script is in a container that is the parent of the second scripts synth - confusing!

    Also if you change the Synth.noteOffByEventId() in the noteOff callback of the first script to a volume fade out to -100 nothing is output by the seconds script at all.

    <?xml version="1.0" encoding="UTF-8"?>
    
    <Processor Type="SynthChain" ID="releaseTest" Bypassed="0" Gain="1" Balance="0"
               VoiceLimit="128" KillFadeTime="20" IconColour="0" packageName=""
               views="32.rk1bzA..........................vro1Qzc...." currentView="-1">
      <EditorStates BodyShown="0" Visible="1" Solo="0" Folded="0" InterfaceShown="0"/>
      <ChildProcessors>
        <Processor Type="MidiProcessorChain" ID="Midi Processor" Bypassed="0">
          <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
          <ChildProcessors/>
        </Processor>
        <Processor Type="ModulatorChain" ID="GainModulation" Bypassed="0" Intensity="1">
          <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
          <ChildProcessors/>
        </Processor>
        <Processor Type="ModulatorChain" ID="PitchModulation" Bypassed="1" Intensity="0">
          <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
          <ChildProcessors/>
        </Processor>
        <Processor Type="EffectChain" ID="FX" Bypassed="0">
          <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="0"/>
          <ChildProcessors>
            <Processor Type="SimpleGain" ID="Balcony" Bypassed="0" Gain="0" Delay="0"
                       Width="100" Balance="0">
              <EditorStates BodyShown="1" Visible="1" Solo="0"/>
              <ChildProcessors>
                <Processor Type="ModulatorChain" ID="Gain Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Delay Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Width Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Pan Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
              </ChildProcessors>
              <RoutingMatrix NumSourceChannels="12" Channel0="0" Send0="-1" Channel1="1" Send1="-1"
                             Channel2="-1" Send2="-1" Channel3="-1" Send3="-1" Channel4="-1"
                             Send4="-1" Channel5="-1" Send5="-1" Channel6="-1" Send6="-1"
                             Channel7="-1" Send7="-1" Channel8="-1" Send8="-1" Channel9="-1"
                             Send9="-1" Channel10="-1" Send10="-1" Channel11="-1" Send11="-1"/>
            </Processor>
            <Processor Type="SimpleGain" ID="Close" Bypassed="0" Gain="0" Delay="0"
                       Width="100" Balance="0">
              <EditorStates BodyShown="1" Visible="1" Solo="0" Folded="0"/>
              <ChildProcessors>
                <Processor Type="ModulatorChain" ID="Gain Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Delay Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Width Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Pan Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
              </ChildProcessors>
              <RoutingMatrix NumSourceChannels="12" Channel0="-1" Send0="-1" Channel1="-1"
                             Send1="-1" Channel2="2" Send2="-1" Channel3="3" Send3="-1" Channel4="-1"
                             Send4="-1" Channel5="-1" Send5="-1" Channel6="-1" Send6="-1"
                             Channel7="-1" Send7="-1" Channel8="-1" Send8="-1" Channel9="-1"
                             Send9="-1" Channel10="-1" Send10="-1" Channel11="-1" Send11="-1"/>
            </Processor>
            <Processor Type="SimpleGain" ID="Decca Centre" Bypassed="0" Gain="0" Delay="0"
                       Width="100" Balance="0">
              <EditorStates BodyShown="1" Visible="1" Solo="0" Folded="0"/>
              <ChildProcessors>
                <Processor Type="ModulatorChain" ID="Gain Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Delay Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Width Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Pan Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
              </ChildProcessors>
              <RoutingMatrix NumSourceChannels="12" Channel0="-1" Send0="-1" Channel1="-1"
                             Send1="-1" Channel2="-1" Send2="-1" Channel3="-1" Send3="-1"
                             Channel4="4" Send4="-1" Channel5="5" Send5="-1" Channel6="-1"
                             Send6="-1" Channel7="-1" Send7="-1" Channel8="-1" Send8="-1"
                             Channel9="-1" Send9="-1" Channel10="-1" Send10="-1" Channel11="-1"
                             Send11="-1"/>
            </Processor>
            <Processor Type="SimpleGain" ID="Decca Stereo" Bypassed="0" Gain="0" Delay="0"
                       Width="100" Balance="0">
              <EditorStates BodyShown="1" Visible="1" Solo="0" Folded="0"/>
              <ChildProcessors>
                <Processor Type="ModulatorChain" ID="Gain Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Delay Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Width Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Pan Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
              </ChildProcessors>
              <RoutingMatrix NumSourceChannels="12" Channel0="-1" Send0="-1" Channel1="-1"
                             Send1="-1" Channel2="-1" Send2="-1" Channel3="-1" Send3="-1"
                             Channel4="-1" Send4="-1" Channel5="-1" Send5="-1" Channel6="6"
                             Send6="-1" Channel7="7" Send7="-1" Channel8="-1" Send8="-1" Channel9="-1"
                             Send9="-1" Channel10="-1" Send10="-1" Channel11="-1" Send11="-1"/>
            </Processor>
            <Processor Type="SimpleGain" ID="Wide" Bypassed="0" Gain="0" Delay="0" Width="100"
                       Balance="0">
              <EditorStates BodyShown="1" Visible="1" Solo="0" Folded="0"/>
              <ChildProcessors>
                <Processor Type="ModulatorChain" ID="Gain Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Delay Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Width Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="Pan Modulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
              </ChildProcessors>
              <RoutingMatrix NumSourceChannels="12" Channel0="-1" Send0="-1" Channel1="-1"
                             Send1="-1" Channel2="-1" Send2="-1" Channel3="-1" Send3="-1"
                             Channel4="-1" Send4="-1" Channel5="-1" Send5="-1" Channel6="-1"
                             Send6="-1" Channel7="-1" Send7="-1" Channel8="8" Send8="-1" Channel9="9"
                             Send9="-1" Channel10="-1" Send10="-1" Channel11="-1" Send11="-1"/>
            </Processor>
          </ChildProcessors>
        </Processor>
        <Processor Type="SynthChain" ID="Container" Bypassed="0" Gain="1" Balance="0"
                   VoiceLimit="128" KillFadeTime="20" IconColour="0">
          <EditorStates BodyShown="0" Visible="1" Solo="0" Folded="0"/>
          <ChildProcessors>
            <Processor Type="MidiProcessorChain" ID="Midi Processor" Bypassed="0">
              <EditorStates BodyShown="1" Visible="1" Solo="0" Folded="0"/>
              <ChildProcessors>
                <Processor Type="ScriptProcessor" ID="Script Processor3" Bypassed="0" Script="reg noteNumber = -1;&#10;reg eventId = -1;&#10;&#10;function onNoteOn()&#10;{&#10;&#9;Message.ignoreEvent(true);&#10;&#10;&#9;if (eventId != -1)&#10;&#9;{&#13;&#10;&#9;&#9;//Synth.noteOffByEventId(eventId);&#10;&#9;&#9;Synth.addVolumeFade(eventId, 60, -100); //Fade out old note&#10;&#9;}&#10;&#10;&#9;eventId = Synth.playNote(Message.getNoteNumber(), Message.getVelocity());&#10;&#10;&#9;noteNumber = Message.getNoteNumber();&#10;}&#10;&#10;function onNoteOff()&#10;{&#10;&#9;Message.ignoreEvent(true);&#10;&#10;&#9;if (Message.getNoteNumber() == noteNumber)&#10;&#9;{&#10;&#9;&#9;Synth.noteOffByEventId(eventId);&#10;&#9;&#9;//Synth.addVolumeFade(eventId, 60, -100);&#10;&#9;&#9;noteNumber = -1;&#10;&#9;&#9;eventId = -1;&#10;&#9;}&#10;}&#10;&#10;function onController()&#10;{&#10;&#9;&#10;}&#10;function onTimer()&#10;{&#10;&#9;&#10;}&#10;function onControl(number, value)&#10;{&#10;&#9;&#10;}&#10;">
                  <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="1" onInitOpen="0"
                                onNoteOnOpen="1" onNoteOffOpen="0" onControllerOpen="0" onTimerOpen="0"
                                onControlOpen="0"/>
                  <ChildProcessors/>
                  <Content/>
                </Processor>
              </ChildProcessors>
            </Processor>
            <Processor Type="ModulatorChain" ID="GainModulation" Bypassed="0" Intensity="1">
              <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
              <ChildProcessors/>
            </Processor>
            <Processor Type="ModulatorChain" ID="PitchModulation" Bypassed="1" Intensity="0">
              <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
              <ChildProcessors/>
            </Processor>
            <Processor Type="EffectChain" ID="FX" Bypassed="0">
              <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
              <ChildProcessors/>
            </Processor>
            <Processor Type="SineSynth" ID="Sine Wave Generator" Bypassed="0" Gain="0.017782794"
                       Balance="0" VoiceLimit="128" KillFadeTime="20" IconColour="0"
                       OctaveTranspose="0" SemiTones="0" UseFreqRatio="0" CoarseFreqRatio="1"
                       FineFreqRatio="0" SaturationAmount="0">
              <EditorStates BodyShown="1" Visible="1" Solo="0" GainModulationShown="1" Folded="1"/>
              <ChildProcessors>
                <Processor Type="MidiProcessorChain" ID="Midi Processor" Bypassed="0">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="ModulatorChain" ID="GainModulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0"/>
                  <ChildProcessors>
                    <Processor Type="SimpleEnvelope" ID="DefaultEnvelope" Bypassed="0" Intensity="1"
                               Attack="5" Release="10" LinearMode="1">
                      <EditorStates BodyShown="1" Visible="1" Solo="0"/>
                      <ChildProcessors>
                        <Processor Type="ModulatorChain" ID="Attack Time Modulation" Bypassed="0"
                                   Intensity="1">
                          <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                          <ChildProcessors/>
                        </Processor>
                      </ChildProcessors>
                    </Processor>
                  </ChildProcessors>
                </Processor>
                <Processor Type="ModulatorChain" ID="PitchModulation" Bypassed="0" Intensity="0">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="EffectChain" ID="FX" Bypassed="0">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
              </ChildProcessors>
              <RoutingMatrix NumSourceChannels="2" Channel0="0" Send0="-1" Channel1="1" Send1="-1"/>
            </Processor>
            <Processor Type="SineSynth" ID="Sine Wave Generator2" Bypassed="0" Gain="0.020417383"
                       Balance="0" VoiceLimit="128" KillFadeTime="20" IconColour="0"
                       OctaveTranspose="0" SemiTones="0" UseFreqRatio="0" CoarseFreqRatio="1"
                       FineFreqRatio="0" SaturationAmount="0">
              <EditorStates BodyShown="0" Visible="1" Solo="0" GainModulationShown="1"/>
              <ChildProcessors>
                <Processor Type="MidiProcessorChain" ID="Midi Processor" Bypassed="0">
                  <EditorStates BodyShown="1" Visible="1" Solo="0" Folded="0"/>
                  <ChildProcessors>
                    <Processor Type="ScriptProcessor" ID="numPressedKeys" Bypassed="0" Script="function onNoteOn()&#10;{&#10;&#9;Message.ignoreEvent(true);&#10;}&#10;function onNoteOff()&#10;{&#10;&#9;Message.ignoreEvent(true);&#13;&#10;&#9;&#13;&#10;&#9;Console.print(Synth.getNumPressedKeys());&#10;}&#10;function onController()&#10;{&#10;&#9;&#10;}&#10;function onTimer()&#10;{&#10;&#9;&#10;}&#10;function onControl(number, value)&#10;{&#10;&#9;&#10;}&#10;">
                      <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="1" onInitOpen="0"
                                    onNoteOnOpen="0" onNoteOffOpen="1" onControllerOpen="0" onTimerOpen="0"
                                    onControlOpen="0" Folded="0"/>
                      <ChildProcessors/>
                      <Content/>
                    </Processor>
                  </ChildProcessors>
                </Processor>
                <Processor Type="ModulatorChain" ID="GainModulation" Bypassed="0" Intensity="1">
                  <EditorStates BodyShown="1" Visible="0" Solo="0"/>
                  <ChildProcessors>
                    <Processor Type="SimpleEnvelope" ID="DefaultEnvelope" Bypassed="0" Intensity="1"
                               Attack="5" Release="10" LinearMode="1">
                      <EditorStates BodyShown="1" Visible="1" Solo="0"/>
                      <ChildProcessors>
                        <Processor Type="ModulatorChain" ID="Attack Time Modulation" Bypassed="0"
                                   Intensity="1">
                          <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                          <ChildProcessors/>
                        </Processor>
                      </ChildProcessors>
                    </Processor>
                  </ChildProcessors>
                </Processor>
                <Processor Type="ModulatorChain" ID="PitchModulation" Bypassed="0" Intensity="0">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
                <Processor Type="EffectChain" ID="FX" Bypassed="0">
                  <EditorStates BodyShown="1" Visible="0" Solo="0" Folded="1"/>
                  <ChildProcessors/>
                </Processor>
              </ChildProcessors>
              <RoutingMatrix NumSourceChannels="2" Channel0="0" Send0="-1" Channel1="1" Send1="-1"/>
            </Processor>
          </ChildProcessors>
          <RoutingMatrix NumSourceChannels="2" Channel0="0" Send0="-1" Channel1="1" Send1="-1"/>
        </Processor>
      </ChildProcessors>
      <RoutingMatrix NumSourceChannels="12" Channel0="0" Send0="-1" Channel1="1" Send1="-1"
                     Channel2="0" Send2="-1" Channel3="1" Send3="-1" Channel4="0"
                     Send4="-1" Channel5="1" Send5="-1" Channel6="0" Send6="-1" Channel7="1"
                     Send7="-1" Channel8="0" Send8="-1" Channel9="1" Send9="-1" Channel10="0"
                     Send10="-1" Channel11="1" Send11="-1"/>
      <macro_controls>
        <macro name="Macro 1" value="0" midi_cc="-1"/>
        <macro name="Macro 2" value="0" midi_cc="-1"/>
        <macro name="Macro 3" value="0" midi_cc="-1"/>
        <macro name="Macro 4" value="0" midi_cc="-1"/>
        <macro name="Macro 5" value="0" midi_cc="-1"/>
        <macro name="Macro 6" value="0" midi_cc="-1"/>
        <macro name="Macro 7" value="0" midi_cc="-1"/>
        <macro name="Macro 8" value="0" midi_cc="-1"/>
      </macro_controls>
      <MidiAutomation/>
    </Processor>
    


  • Hmm, this is not totally trivial, because I realize that calling Synth.addVolumeFade violates the "One Note off per Note On" rule (and the rising voice counter is just one of the many possible side effects).

    I may have to add an internal note off event when calling Synth.addVolumeFade, but then the same rules as with the Synth.noteOffFromEventId() applies (no mixing of artificial / real events). So if you want to fade out an event, you'll have to make it artificial.



  • I thought events created with Syth.playNote() are artificial by default...
    This may sound a bit dumb but when there are no keys pressed the on-screen keyboard shows no keys are pressed, couldn't the same mechanism behind this also work for Synth.getNumPressedKeys()?



  • You mean don't increase the counter for artificial notes? This could make sense, but I'll have to think a little bit about side effects.



  • Yeah I think that would make more sense since the only thing getNumPressedKeys() should care about is the number of physical keys that have been pressed. Perhaps another counter could be used for counting the number of note ons and offs.



  • As a temporary solution I'm using this script in the master container and checking the value of Globals.keyCount rather than using numPressedKeys().

    <?xml version="1.0" encoding="UTF-8"?>
    
    <Processor Type="ScriptProcessor" ID="KeyCounter" Bypassed="0" Script="Globals.keyCount = 0;function onNoteOn()&#10;{&#10;&#9;Globals.keyCount++;&#10;}&#10;function onNoteOff()&#10;{&#10;&#9;Globals.keyCount--;&#10;}&#10;function onController()&#10;{&#10;&#9;&#10;}&#10;function onTimer()&#10;{&#10;&#9;&#10;}&#10;function onControl(number, value)&#10;{&#10;&#9;&#10;}&#10;">
      <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="1" onInitOpen="0"
                    onNoteOnOpen="0" onNoteOffOpen="1" onControllerOpen="0" onTimerOpen="0"
                    onControlOpen="0"/>
      <ChildProcessors/>
      <Content/>
    </Processor>
    


  • I'll try to add a fix ASAP.



  • Was this ever implemented? I just ran into the lying numPressedKeys function again.

    With this example script I'm using a button on the UI to generate notes. The second script just outputs the numPressedKeys in its note off callback. Obviously a button on the UI triggering notes should = zero pressed keys, but it doesn't.

    Press the button a few times to play some notes. Then recompile the Interface script, press the button a few more times. Keep repeating and each time the numPressedKeys from the second script will increase.

    HiseSnippet 1154.3oc4Ws0aaaCElxNpX1cIXcnXXOpUrGb.RCr6sMfggl3Koyq0IFwoc6sBFoirIhDoFIU1LBxuk8qYuseD6mP+GrcntDI2pl4Iz0AzwWr34BOemCOWnmJEtfRIjDqVmrLBHVer8rkb8hAKnLNY7Ph0V1SnJMHcRI0eYDUo.OhkUymXHX0ZCRx5UOtOMfxcgBRDxKDLW3YrPltf5z8dJKH3.pGbBKrjzOXuwtB9.QfHFwSS6tjHp6Yz4vgTiXMrIV2XjGSKjyzTMnHVazW3sb1BwOySk+ELE6z.vroGYFdPojOPD3YPr4axfEr.uo49shPrrmVDEZlFEts8DlG6J5EQiOIggSgFkiGVMtN30qlvypD71HEd2xdlqjEoK3Xv1MsGywKJeJdETFVoxRZrSC6ABTBtd2P5YvARbyUZz4Qc6tiyC61c6uYy1a1NIIXWOvGjCnAAmhWDpNZYLjxVBycXdNeqyc6krmwCXbvwOl6pYBtif2OVqE7dFCJEAcbEgQBNZ5cbNmFfGylsuXy1sX9Ncx26fqKR+wrLrPS7EFarcA4RRXVo3jKzvQ998WN5bzDi8PEM3rrf4n8JhWVvujQMRkdlQAzkGhmKFX1w49XXoclVWl3w4Qx4fdPtu04NYd8c1dWkgdhumG+575AECDKEwLF6HdmsaeQ6Vsursyqyx2uRdYGV.HqjsoDSdcJ1gGGdJHyuWxEDy0VMY9FqWxraZbojfB9XNSeTDjsuHcuWEo6jr.K90yGOjpolJfLZnbQfTyLvwZHbN1ZIsdnk8PPclVDkHa1sABYcB2sxpVRi9DlmQgrqBxuf0+V+NZsklOlhennmCi4Sk.dEZJeXpIhP77nRTDqFj2rbDaJH7hCn5U6TXZOlw.i3qTRZJ63JldY41m+CZezsx1GUFOWS3dK6oLs6hpwaiJvKdu7uMdyZFuo8HeevUW.1MrO3Gqam25AksRgxMsmg84RZPj.jOKYuyOfoLNOA3fzDT681FR9Ge+28qq6Pxn0dH4QtZz7mHobUjPsxAOCBYmfECpxDetBa8C+zwla4xzGHnxJY8pGe.5jUpyLpNVljtrenHlqWI8nYslFtZUSI4qXz3FefL49Syn9VPW1.bqey1oFyKvlmJQ.rajjginRGtgSsNLNzziCMwSgkpNaiC39uYvR62MCV5RxCIuAEe+hoOk8qxBl3NkIjIVAo24ypd+MIo450N7uIEtUNFmwBiBfQ7yg.zIyxfGB9z3.cN06sBJmH3hnEBNysbGhiAsjMeNHKi8Jcn80Z7ETETt8dGCA.sb2tubumgconRLNA0LVza8iEW280mamBWGSNkyGFu.n4+OeAvwhXMiOeBESTMuTDaZNCG75BHR3bHPYdzXCSmfz8cM6Sm7x8R17m3JiYOydqLl8xY9dwFgTWo3ktoszL4xeTBEzu4I+25V3exG26zijzrF0yt6tcIg3DyW55ZB22EiOUqy8pgN2uF57fZnyCqgNOpF57U0Pmu9Z0w7Xk8i0hvzRQjvzQIiXrrFwoXlbRVO4u.bjWHSJ
    


  • My old nemesis strikes again! This thing gets me every time. Still waiting for the fix 😄



  • @d-healey said in Fade out and numPressedKeys:

    I thought events created with Syth.playNote() are artificial by default...
    This may sound a bit dumb but when there are no keys pressed the on-screen keyboard shows no keys are pressed, couldn't the same mechanism behind this also work for Synth.getNumPressedKeys()?

    @Christoph-Hart

    This will be an uneducated input (hise wise :smiling_face_with_open_mouth_cold_sweat: ), but what is the point of Synth.getNumPressedKeys() if not to simply get the amount of current actually pressed keys? I mean it will of course include the stuff played back by both DAWs and midi-inputs of all kinds. But artificial is not supposed to be included in such a feature, I would think.

    But what´s the way to get the total amount of active note-on events? (normal and artificial, everything playing) That´s a different thing. That would have to include all things playing, all event-id:s including the artificially made ones, like in a polyphony script where we want to determine the current ones in need of fading out.

    I need that. But for each key mostly. Like saying "for each key, fade out the oldest event-ids first and let only 1-2 remain ringing". For keys, like a piano, that would be key. 😄

    @d-healey said in Fade out and numPressedKeys:

    With this example script I'm using a button on the UI to generate notes. The second script just outputs the numPressedKeys in its note off callback. Obviously a button on the UI triggering notes should = zero pressed keys, but it doesn't.

    I am not sure about that. Perhaps button or a script could need the feedback of the keys being pressed to be visible on the UI. For many reasons. Musical ones, educational ones. One would definitely expect that to be included in the normal flow of notes.

    If that button was to create a lot of notes artificially, and that was not treated as active keys, and one wanted to create a polyphony-script using Synth.getNumPressedKeys() , it could end up creating a higher polyphony than intended. For cpu:s not able to handle it and where we would need to restrict that, like with a "eco" button. I mean if we are using that to handle polyphony at all, and not the event-ids themselves.

    Of course, the button could end up only making new MIDI-note events, that then create normal note-on events in the engine, non-artificial ones. Perhaps better. (if that´s not the same thing 😞 haha)

    My opinion is that there is a list of on-off switches needed for some of these features. I don´t see where one option here is the only one needed for all projects. A JSON settings file for events and other deterministic stuff, for example. Also perhaps a solution to changes in different versions, like if someone is moving from one version to another or from one branch to another branch, should the coder be stuck with a non functioning instrument and a long fix? The whole script could be centered around very basic 0 and 1:s. 😟

    I figure, if a flip-switch in a settings file were to incorporate these details, they would only affect the amount of events in a return, so flip the TRUE to FALSE. Nothing else. (famous last words 😬 ..)

    Sorry if this is too noob.


Log in to reply
 

13
Online

1.1k
Users

3.8k
Topics

33.4k
Posts