HISE Logo Forum
    • Categories
    • Register
    • Login

    Populating a MidiPlayer with event data received over OSC

    Scheduled Pinned Locked Moved General Questions
    5 Posts 2 Posters 199 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.
    • P
      phatamoto
      last edited by

      I'm new to HISE, and seeking some tips for getting this particular bit of functionality working:

      Receiving an array of event data over OSC, for use in populating a MidiPlayer with note and cc messages, and sending the events out of the MIDI out when used as a MIDI FX plugin in Logic.

      I have the OSC receive part working, using the GlobalRoutingManager within an onInit callback of the Interface.

      Where or how might one populate a MidiPlayer with events? I haven't found any code examples of this yet.

      And also, how might one pass the OSC data received in that Interface callback, over to where it can be used to populate the MidiPlayer?

      Best,
      Thom

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @phatamoto
        last edited by

        @phatamoto you 'll need to show us how far you got - so a snippet.

        HISE Development for hire.
        www.channelrobot.com

        P 1 Reply Last reply Reply Quote 0
        • P
          phatamoto @Lindon
          last edited by phatamoto

          @Lindon

          I haven't yet gotten anywhere beyond receiving the data over OSC.
          I'm unclear on where one needs to populate the MidiPlayer, does it need to happen with a callback locally-specific to the MidiPlayer, or can the MidiPlayer be accessed from with the same Interface onInit callback where the OSC is being received?

          I've been through some of the documentation and several videos, but still a bit unclear as to how to approach this.

          My hope is to get this first bit working as a jumpstart into HISE, something immediately useful to my external music-making workflow, then progressively add features as I learn more and more about HISE and the range of possibilities it offers.

          Here's the OSC-receive code. It can receive arrays or single values, and for now just prints the value(s):

          const var rm = Engine.getGlobalRoutingManager();
          
          inline function print(value)
          {
          	Console.print(value);
          }
          
          inline function printOSC(id, value)
          {
                  // if received token is an array (if it has a defined length)
          	if (typeof value.length == "number")            
          	{
          		for (i = 0; i < value.length; i++)
          		{
          			Console.print(value[i]);
          		}
          	}
          	else 
          	{
          		Console.print(value);	
          	}
          }
          
          inline function processOSC_phraseA(id, value) 
          {
          	print("phraseA: ");
          	printOSC(id, value);
          }
          
          inline function printError(msg)
          {
          	Console.print(msg);
          }
          
          rm.connectToOSC({"Domain": "/HISE", "SourcePort": 6400}, printError);
          
          rm.addOSCCallback("/phraseA", processOSC_phraseA); 
          
          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @phatamoto
            last edited by

            @phatamoto - so yes you can reference a MIDIPlayer basically anywhere in your code.

            Look at the MIDI Player API here;

            Link Preview Image
            HISE | Docs

            favicon

            (docs.hise.audio)

            Once you have collected your "note data" then you just need to add a sequence to the MIDIPlayer, this will give you a good set of pointers on how to do this:

            404 Not Found

            favicon

            (docs.hise.audio)

            HISE Development for hire.
            www.channelrobot.com

            P 1 Reply Last reply Reply Quote 0
            • P
              phatamoto @Lindon
              last edited by

              @Lindon

              Thank you, this is very helpful!

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

              26

              Online

              1.7k

              Users

              11.8k

              Topics

              102.8k

              Posts