HISE Logo Forum
    • Categories
    • Register
    • Login

    Adding and removing notes from the buffer

    Scheduled Pinned Locked Moved Scripting
    7 Posts 2 Posters 414 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.
    • B
      benosterhouse
      last edited by

      Hello!

      I'd like to trigger samples at multiple places and multiple times.

      So, first of all, I need to delay the start of samples by a beat.

      I can use this:
      Synth.addNoteOn(channel, noteNumber, velocity, timeStampSamples)

      and set timeStampSamples back by 1 beat.
      This delays the notes. Awesome!

      Now, if you let go of a key after the delayed sample has been started, it stops the note, but if you let go before that, you end up with a stuck note.

      So how do you remove notes from the buffer?
      One way I was thinking is to just change the note's velocity to 0 to change it's note to somewhere no samples are mapped.

      I see there's a function Message.setNoteNumber()

      This acts on Messages rather than events though, so perhaps there's a way to get event id from the addNoteOn into a message.
      I see there's something called a messageholder, and then you can store events in it.

      Using Message.store() you can put the current event into a messageholder. addNoteOn isn't the current event, so that doesn't work.

      On a side note, I'll definitely want to be able to change the tune and pan of artificial notes in the future, and if you can only do setNoteNumber() to Messages (which are only generated by real events), does that mean you can only setNoteNumber() of real events?
      I think maybe I'm fuzzy on the difference between a Message and an event.

      1 Reply Last reply Reply Quote 0
      • B
        benosterhouse
        last edited by

        I was also adding note offs before, which didn't work for some reason.
        I probably just need to figure out why that wasn't working.

        In the Artificial Events section:
        "As soon as you call Synth.addNoteOffFromEventId() with a real event ID, it will invalidate the note on event (=delete them from the queue)"

        So yeah, that's probably the way to remove notes from the buffer :face_with_tongue:

        1 Reply Last reply Reply Quote 0
        • Christoph HartC
          Christoph Hart
          last edited by

          You could also delay the incoming note off message to avoid stuck notes...

          1 Reply Last reply Reply Quote 0
          • B
            benosterhouse
            last edited by

            Ok, so delaying it in onNoteOff using engine uptime?

            1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart
              last edited by

              No just delay it by the same amount you've delayed the respective note on and its guaranteed to never get stuck - I have no idea about the context though so I'm not sure if this helps in your situation.

              On a side note, I'll definitely want to be able to change the tune and pan of artificial notes in the future,

              Use Synth.addPitchFade with zero fade time with the event ID you get as return value from Synth.addNoteOn()

              B 1 Reply Last reply Reply Quote 0
              • B
                benosterhouse
                last edited by

                Yep, that worked. The only thing is it plays the envelope's release.
                I could just get rid of that using a volume fade although I'm not sure that's the best way to do it.

                1 Reply Last reply Reply Quote 0
                • B
                  benosterhouse @Christoph Hart
                  last edited by benosterhouse

                  @Christoph-Hart If you delay the note off in the onNoteOff using the same offset as when you added the note in the onNoteOn, it will put the note off after the note on.
                  I'm trying to make it so that if you let go of the key before the note on, it doesn't play the delayed note on.

                  Of course, just use a PitchFade! Thanks for the tip.

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

                  50

                  Online

                  1.7k

                  Users

                  11.7k

                  Topics

                  101.8k

                  Posts