Forum

    • Register
    • Login
    • Search
    • Categories

    Simple Envelope - release not working

    General Questions
    2
    2
    164
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Lindon
      Lindon last edited by Lindon

      OK I have a drum sound in a sampler - with a simple envelope attached to manage GainModulation - the Attack works fine - but the release doesnt work at all.

      I suspect this has something to do with the fact I am triggering note playback in my Samplers midi processor - on note call back thus:

      function onNoteOn()
      {
          Message.ignoreEvent(true);
          Synth.playNote(Globals.triggerNote, Message.getVelocity());
          Console.print("playing trigger note:" + Globals.triggerNote);
      }
      

      I suspect here that this is because there is no corresponding note off event for my script triggered play_note. Do I need to keep the play_note noteID in some Global(again) spot and issue a note off for it? Or is there some other way in the note off I can get to the id of my internally triggered note?

      I guess I'm thinking of KSP play_note(some note, some velo, some offset, -1)

      Where "-1" means "releasing the note which started the callback stops the sample"

      HISE Development for hire.
      www.channelrobot.com

      d.healey 1 Reply Last reply Reply Quote 0
      • d.healey
        d.healey @Lindon last edited by d.healey

        @Lindon I don't see a need to use a global to create the note off (unless you need to turn if off in another script) just a reg variable should be fine. If you want 1 ID per note then use a MIDIList instead.

        function onInit()
        {
            reg noteId;
        }
        
        function onNoteOn()
        {
            Message.ignoreEvent(true);
            noteId = Synth.playNote(Globals.triggerNote, Message.getVelocity());
            Console.print("playing trigger note:" + Globals.triggerNote);
        }
        
        function onNoteOff()
        {
            Synth.noteOffByEventId(noteId);
        }
        

        Another option

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        14
        Online

        795
        Users

        5.5k
        Topics

        51.6k
        Posts