HISE Logo Forum
    • Categories
    • Register
    • Login

    Simple Envelope - release not working

    Scheduled Pinned Locked Moved General Questions
    2 Posts 2 Posters 289 Views
    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.
    • LindonL
      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.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        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

        29

        Online

        1.7k

        Users

        11.7k

        Topics

        102.0k

        Posts