HISE Logo Forum
    • Categories
    • Register
    • Login

    Need some help with MidiPlayer Rectangle list

    Scheduled Pinned Locked Moved Scripting
    4 Posts 2 Posters 168 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.
    • ulrikU
      ulrik
      last edited by ulrik

      When using:

      List = MidiPlayer.getNoteRectangleList(a);
      

      I get an array with the area for all MidiNoteEvents, I wonder if the order of the areas follow a specific order, like [area based on noteon & off eventId0, area based on noteon & off eventId1, etc...]?
      I ask because I need to use the MidiPlayer.getEventList() list to modify some stuff.

      I've checked the length of both arrays (NoteRectangleList && EventList), and the EventList is 2 times longer than the NoteRectangleList, and it should be right? because the EventList contains NoteOn and the corresponding NoteOff event.

      How can I check that index number 10 in the NoteRectangle list is based on the the NoteOn and NoteOff event from index 19 and 20, or does it not work that way?

      It would be great to have the EventId attached to the corresponding Rectangle area in the NoteRectangleList.

      Any help is appreciated :)

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

      ustkU 2 Replies Last reply Reply Quote 0
      • ustkU
        ustk @ulrik
        last edited by ustk

        @ulrik said in Need some help with MidiPlayer Rectangle list:

        I get an array with the area for all MidiNoteEvents, I wonder if the order of the areas follow a specific order, like [area based on noteon & off eventId0, area based on noteon & off eventId1, etc...]?

        The order seems to follow the NoteOn + EventId order.

        I've checked the length of both arrays (NoteRectangleList && EventList), and the EventList is 2 times longer than the NoteRectangleList, and it should be right? because the EventList contains NoteOn and the corresponding NoteOff event.

        Not necessarily. For instance if you have a Controller event, it won't be reflected in the rectangle list, so the index will be messed up.
        Moreover, you can't count on the index anyway because you might have several NoteOn before having the first NoteOff event.
        But if you filter the event list to keep only the NoteOn, then you should end up having the same order and same length as the rectangle list, and where the associated EventId should give you the rectangle index.

        How can I check that index number 10 in the NoteRectangle list is based on the the NoteOn and NoteOff event from index 19 and 20, or does it not work that way?

        It would be great to have the EventId attached to the corresponding Rectangle area in the NoteRectangleList.

        See above

        Another way to do it is to make your own rectangle list derived from the eventList. This way you are certain the order is the exact same as you need

        Can't help pressing F5 in the forum...

        ulrikU 1 Reply Last reply Reply Quote 1
        • ustkU
          ustk @ulrik
          last edited by ustk

          @ulrik Oh! I've just seen there's a convertEventListToNoteRectangles method which does exactly this :)

          @Christoph-Hart this function doesn't seem to benefit from your last bar rounding fix seeing that the x and width values aren't the same. That is probably because the eventList doesn't have the bar length info which makes sense...

          Left -> getNoteRectangleList([0,0,100,128])
          Right -> convertEventListToNoteRectangles(eventList, [0,0,100,128])
          (the 3rd beat is around 75% on the left which is expected compared to the right)

          Screenshot 2023-06-16 at 00.49.45.png

          Can't help pressing F5 in the forum...

          1 Reply Last reply Reply Quote 0
          • ulrikU
            ulrik @ustk
            last edited by

            @ustk thank you!

            Hise Develop branch
            MacOs 15.3.1, Xcode 16.2
            http://musikboden.se

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

            36

            Online

            1.8k

            Users

            12.0k

            Topics

            104.6k

            Posts