HISE Logo Forum
    • Categories
    • Register
    • Login

    Is it possible to create a midi note from ScriptNode/c++ node and direct it to a synth in the module tree?

    Scheduled Pinned Locked Moved ScriptNode
    14 Posts 3 Posters 391 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.
    • O
      Orvillain @griffinboy
      last edited by

      @griffinboy Thanks, I'll take a look! My c++ is still a bit rough, but I'm getting better. I did manage to get a modulation output from my node, and pushing that into a global cable confirms that I get the signal. But the actual 'turn this into a midi note and route to a sampler' task I don't know how to do yet.

      The reason I wanted to direct it at a sampler rather than write a sample playback node was because I have all my sample maps and my module tree organised already.

      O 1 Reply Last reply Reply Quote 0
      • O
        Orvillain @Orvillain
        last edited by

        @Orvillain
        c1820220-6169-4d15-a5f2-37e091b3fd91-image.png

        Hmmm. So I've got this, and it compiles. But I really have no idea how to tell if I'm truly creating a midi note, and if I am, where is it going... and how can I pick it up elsewhere in my module tree.

        Do I need to write an additional script for a MidiProcessor and process the event???

        @Christoph-Hart - Any ideas?

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

          @Orvillain yeah there's currently not a real line of communication for MIDI messages back from scriptnode, but you're pretty good on track with the global cable approach - just analyse the audio in the C++ node and send it back to HISE via a global cable, then attach a synchronous script callback there that will add an HiseEvent to the MIDI queue with Synth.playNote() et al.

          O griffinboyG 3 Replies Last reply Reply Quote 3
          • O
            Orvillain @Christoph Hart
            last edited by

            @Christoph-Hart Thank you!

            1 Reply Last reply Reply Quote 0
            • griffinboyG
              griffinboy @Christoph Hart
              last edited by griffinboy

              @Christoph-Hart

              Wait, we can do synchronous global cables?
              How fast will this be? We aren't talking sample accurate audio thread type fast are we?

              Someone told me recently that cables are not high priority speed wise.

              I decided they aren't for anything fast anyway due to the copying involved, except for midi, it kind of makes sense, I can see it being powerful for c++ sequencers, so I'm curious.

              Then again, for normal sequencers we can just send an array back and Hise can play from it. I guess this is only for sequencing that needs to be really realtime for some reason

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

                Wait, we can do synchronous global cables?

                How fast will this be? We aren't talking sample accurate audio thread type fast are we?

                Sure:

                f9d9ce45-66ee-4b08-a559-c21a7bb8001b-image.png

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

                  I decided they aren't for anything fast anyway due to the copying involved.

                  Ah now I understand you, that advice is when you send complex data over a global cable, but the default operational mode of just sending a single numeric value is fast and realtime capable.

                  O 1 Reply Last reply Reply Quote 1
                  • O
                    Orvillain @Christoph Hart
                    last edited by

                    @Christoph-Hart

                    So far I'm following your global cable guide and sending data from my node. I've got a fair amount of data, and it seems plenty fast. But I guess it depends what you want to do. I've got some arrays that could be thousands of samples long, and it isn't struggling.

                    griffinboyG 1 Reply Last reply Reply Quote 0
                    • griffinboyG
                      griffinboy @Orvillain
                      last edited by griffinboy

                      @Orvillain

                      oh yeah, no, in my case I was sending data that was one and a half million floats long down a cable. Although, it never actually caused a cpu spike, so maybe I didn't have to throttle it.
                      I guess I'm just being careful. Then again, that was async, which is probably why that works, it's already background thread I'm guessing.

                      O 1 Reply Last reply Reply Quote 1
                      • O
                        Orvillain @griffinboy
                        last edited by

                        @griffinboy Gotcha! Right, so I'm processing audio inside a c++ node and deriving a bunch of statistics from it, which I'm then painting in my UI. I'm not trying to do millions and millions and gajillions of floats or anything like that. I'd already assumed that was all best kept in c++

                        What kind of thing are you working on out of interest?

                        1 Reply Last reply Reply Quote 0
                        • O
                          Orvillain @Christoph Hart
                          last edited by

                          @Christoph-Hart Hey Chris. I don't know if I'm doing it wrong, but it doesn't seem possible to do these two things at the same time???

                          dataCable.registerDataCallback(function(data)
                          {
                          this is where I derive data from my custom c++ node inside the network that my dataCable is attached to
                          };

                          dataCable.registerCallback(function(data)
                          {
                          this is where I would create midi notes and tell a synth to play them
                          }, SyncNotification);

                          Am I misunderstanding?

                          O 1 Reply Last reply Reply Quote 0
                          • O
                            Orvillain @Orvillain
                            last edited by

                            @Orvillain Right no... I get it. Use two cables. Dohhh.

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

                            31

                            Online

                            1.7k

                            Users

                            11.8k

                            Topics

                            102.7k

                            Posts