HISE Logo Forum
    • Categories
    • Register
    • Login

    Midi Player?

    Scheduled Pinned Locked Moved Documentation Discussions
    36 Posts 8 Posters 4.0k 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 @Dan Korneff
      last edited by ulrik

      @dustbro if you use the "create generic script reference" on the MidiPlayer
      and paste it in initCallback

      const var MIDIPlay = Synth.getMidiProcessor("MIDI Player1");
      

      you can use this code to enable disable the play function

      inline function onPlayControl(component, value)
      {
      	MIDIPlay.setAttribute(1, value);
      	MIDIPlay.setAttribute(0, !value);
      };
      

      Attribut 1 is Play and 0 is Stop

      However you have to disconnect the "Play" btn from "Property editor"

      this function above make only use of the Play btn value, but you've set the buttons in a radio group so the stopbtn will set the playbtn to value = 0

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

      Dan KorneffD 3 Replies Last reply Reply Quote 1
      • Dan KorneffD
        Dan Korneff @ulrik
        last edited by

        @ulrik Thanks for that! What about changing the sequence? Could I make an array of sequences and push that to a combobox?

        Dan Korneff - Producer / Mixer / Audio Nerd

        1 Reply Last reply Reply Quote 0
        • Dan KorneffD
          Dan Korneff @ulrik
          last edited by Dan Korneff

          @ulrik the suggested code is two thumbs up here.
          @Christoph-Hart When the STOP command is selected, the midi player removes the sequence. Any insight on that?

          HiseSnippet 2221.3oc4Y8+aaabEmzNLqVcNHcqXX+3sfAL5EMFIam3.DTTKKamnkXGUK2jfVTjcl7nDSHui83IqpEDf9mv9Sa+oz+C1du632jsrqfZ1FVqhCr36du68488im6KE9rrLgzxdsSmlxrr+0NClxUi5NhFws5suk8sbNhloXRhgzdSSoYYr.Ka6UeLRvdsaXo+7Ce9dzXJ2mUQxx5EhHe1yhRhTUT6u6SihiOjFvNMJoF2auaOeAuqHVLFvypNsrRo9ukNjcLEYaEGK6adPPjRHGnnJVlk8M1SDLcvHwDtg+WDkEc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mCe0xdwUKGTtkAJery.nostOuFH+N8yjWhu9yiYblDcpsul6X7etn2wX5BeGiOGFWeN6TIkCm+HalMd.KI5TnPHqNwuLCN4I6aOAixybYZBpbtK8Ce9gfQNWYFfuukNcoSBb5gYtWnKdaaeXtLwa7+f657Ce01O8lCqtXvcNdP69W5NyuMjFi2GyAb79o.JHF+MvjhP53XUA0YyqORvEoiD7H+5A8SXv4MFNjIqi84ZPvISl4Va+zcOgEyn0Sf+i6hGjiJA+DaI8EsWbew0Eu98NF3RvhQxOOZpu5uLapad6ygGQgD0uybk3Cfdo9r7avDOnHb9DTT8ysJNf1.FOP+v+B9juXa7Y67EaWr3+UzQB0WJdsu4PiXt7Goo.1MWe++q4bD9Loc4wLcf2CxJA5H9Zeezc+W.+y7kYykPlsVBY1dIj49KgLOXIjYmkPlGdsxfCi5LVIRLkh.g9GX9KEYW9GqxdUq+Md7mAJ.
          

          it also throws this in the console

          Interface:! Line 17, column 18: no iterable type

          Dan Korneff - Producer / Mixer / Audio Nerd

          1 Reply Last reply Reply Quote 0
          • Dan KorneffD
            Dan Korneff @ulrik
            last edited by

            @ulrik any insight on how to script the midi player to playback different sequences?
            Like if I drag in 5 different midi files, it creates 5 sequences.. how do you get it to play the different sequences back to back?
            The end game is to be able to assemble an entire song and have playback follow the DAW timeline.
            I saw @Christoph-Hart added a bunch of new midiplayer functionality the other day. Very thankful for that!

            Dan Korneff - Producer / Mixer / Audio Nerd

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

              @dustbro I've never used multitrack but I guess you should make use of

              MidiPlayer.setFile();
              

              .... for loading
              and use

              getPlaybackPosition()
              

              together with a timer to check when

              MidiPlayer.getPlaybackPosition()
              

              reached -0, the file is ended and then use "

              MidiPlay.setTrack(int trackIndex)
              

              to start next sequence

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

              Dan KorneffD 1 Reply Last reply Reply Quote 1
              • Dan KorneffD
                Dan Korneff @ulrik
                last edited by

                @ulrik thanks for that! I saw in the API that it recommended not hot swapping tracks. Maybe there's a similar call for sequence?

                Dan Korneff - Producer / Mixer / Audio Nerd

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

                  Now there is :)

                  Dan KorneffD 1 Reply Last reply Reply Quote 2
                  • Dan KorneffD
                    Dan Korneff @Christoph Hart
                    last edited by

                    @Christoph-Hart I'm thinking that I'll need some playhead info to create a midi sequencer...
                    When I remove these comments, HISE wont compile

                    void MainController::storePlayheadIntoDynamicObject(AudioPlayHead::CurrentPositionInfo &/*newPosition*/)
                    {
                    	//static const Identifier bpmId("bpm");
                    	//static const Identifier timeSigNumerator("timeSigNumerator");
                    	//static const Identifier timeSigDenominator("timeSigDenominator");
                    	//static const Identifier timeInSamples("timeInSamples");
                    	//static const Identifier timeInSeconds("timeInSeconds");
                    	//static const Identifier editOriginTime("editOriginTime");
                    	//static const Identifier ppqPosition("ppqPosition");
                    	//static const Identifier ppqPositionOfLastBarStart("ppqPositionOfLastBarStart");
                    	//static const Identifier frameRate("frameRate");
                    	//static const Identifier isPlaying("isPlaying");
                    	//static const Identifier isRecording("isRecording");
                    	//static const Identifier ppqLoopStart("ppqLoopStart");
                    	//static const Identifier ppqLoopEnd("ppqLoopEnd");
                    	//static const Identifier isLooping("isLooping");
                    
                    	//ScopedLock sl(getLock());
                    
                    	//hostInfo->setProperty(bpmId, newPosition.bpm);
                    	//hostInfo->setProperty(timeSigNumerator, newPosition.timeSigNumerator);
                    	//hostInfo->setProperty(timeSigDenominator, newPosition.timeSigDenominator);
                    	//hostInfo->setProperty(timeInSamples, newPosition.timeInSamples);
                    	//hostInfo->setProperty(timeInSeconds, newPosition.timeInSeconds);
                    	//hostInfo->setProperty(editOriginTime, newPosition.editOriginTime);
                    	//hostInfo->setProperty(ppqPosition, newPosition.ppqPosition);
                    	//hostInfo->setProperty(ppqPositionOfLastBarStart, newPosition.ppqPositionOfLastBarStart);
                    	//hostInfo->setProperty(frameRate, newPosition.frameRate);
                    	//hostInfo->setProperty(isPlaying, newPosition.isPlaying);
                    	//hostInfo->setProperty(isRecording, newPosition.isRecording);
                    	//hostInfo->setProperty(ppqLoopStart, newPosition.ppqLoopStart);
                    	//hostInfo->setProperty(ppqLoopEnd, newPosition.ppqLoopEnd);
                    	//hostInfo->setProperty(isLooping, newPosition.isLooping);
                    }
                    

                    Dan Korneff - Producer / Mixer / Audio Nerd

                    1 Reply Last reply Reply Quote 0
                    • Dan KorneffD
                      Dan Korneff
                      last edited by

                      Wanna dig up this old thread. Having some fun with the Midi Player but need some help regarding playback position.
                      I'm using a midi note to trigger a midi file. All works well, but the playback always begins at the beginning of the file. How are you guys setting playback to start relative to the DAW transport?

                      I see we have

                      .setPlaybackPosition(var newPosition)
                      

                      what function do we call to get a position I can pass into here?

                      Dan Korneff - Producer / Mixer / Audio Nerd

                      1 Reply Last reply Reply Quote 0
                      • Dan KorneffD
                        Dan Korneff
                        last edited by

                        Did some more tinkering.
                        I've enabled:

                        const Identifier ppqPosition("ppqPosition");
                        const Identifier ppqPositionOfLastBarStart("ppqPositionOfLastBarStart");
                        

                        Using the ppqPosition, I'm able to get a value starting at 0 and increasing by 1 per quarter note. So bar 1 starts at 0, bar 2 starts at 4, bar 3 starts at 8, etc...
                        The midi player playback position is expecting a value between 0 and 1, so I enabled ppqPositionOfLastBarStart, and with that I'm able to create a formula that gives me a range of 0-1 per bar.

                        // get position on timeline
                        var position = Engine.getPlayHead().ppqPosition;
                        
                        // get last bar value
                        var last = Engine.getPlayHead().ppqPositionOfLastBarStart;
                        
                        // calculate position per bar
                        var currentpostition = (position - last)/4;
                        

                        Once I have that value, I'm using this code to set the position and sync playback

                        var timeStamp = Message.getTimestamp();
                        MidiPlayer.setPlaybackPosition(currentpostition);
                        MidiPlayer.play(timeStamp);
                        

                        but... the midi file it still starting playback from the beginning of the file, no matter where the playback head is in the DAW.

                        On another note, I started this script in HISE standalone. All worked well, but I couldn't properly use ppqPosition and ppqPositionOfLastBarStart. Since there was no transport to get info from, I'd always get a value of 0.
                        So I built up the plugin version so I can run the script inside a host and get real time values (which worked) but when I trigger playback of the midiplayer, I get this error pointing to the line of code I'm using for ppq Engine.getPlayHead().ppqPosition:

                        Illegal operation in audio thread: HeapBlock allocation

                        Dan Korneff - Producer / Mixer / Audio Nerd

                        ustkU 1 Reply Last reply Reply Quote 1
                        • ustkU
                          ustk @Dan Korneff
                          last edited by

                          @dustbro Very interesting tinkering ;)
                          I have no idea how the midiPlayer works, but maybe defering your script will remove the error...

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

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

                            What if you call Engine.getPlayhead() in the onInit callback and then just use the updated properties in other callback? It throws this error because you're creating an object with this method in a realtime context.

                            Dan KorneffD 1 Reply Last reply Reply Quote 0
                            • Dan KorneffD
                              Dan Korneff @Christoph Hart
                              last edited by

                              @Christoph-Hart Gonna give this a go today.

                              Dan Korneff - Producer / Mixer / Audio Nerd

                              1 Reply Last reply Reply Quote 0
                              • L
                                LeeC
                                last edited by LeeC

                                @dustbro said in Midi Player?:

                                HiseSnippet 2221.3oc4Y8+aaabEmzNLqVcNHcqXX+3sfAL5EMFIam3.DTTKKamnkXGUK2jfVTjcl7nDSHui83IqpEDf9mv9Sa+oz+C1du632jsrqfZ1FVqhCr36du68488im6KE9rrLgzxdsSmlxrr+0NClxUi5NhFws5suk8sbNhloXRhgzdSSoYYr.Ka6UeLRvdsaXo+7Ce9dzXJ2mUQxx5EhHe1yhRhTUT6u6SihiOjFvNMJoF2auaOeAuqHVLFvypNsrRo9ukNjcLEYaEGK6adPPjRHGnnJVlk8M1SDLcvHwDtg+WDkEcVLCens0.XiLjOTDGfHFoZ0cTTbP+B6Nyxx1oekWXUiW3ScNJJHpjdk2315EHURT2eXux0Au1+3vq07f2p0f2MKBRZ3ESmxjEAod62iXnzdFP0crTx3pArucL6BAm7kNUBt45wwmIDoGvo.TCpS1d0YMuU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Ce01O8lCqtXvcNdP69W5NyuMjFi2GyAb79o.JHF+MvjhP53XUA0YyqORvEoiD7H+5A8SXv4MFNjIqi84ZPvISl4Va+zcOgEyn0Sf+i6hGjiJA+DaI8EsWbew0Eu98NF3RvhQxOOZpu5uLapad6ygGQgD0uybk3Cfdo9r7avDOnHb9DTT8ysJNf1.FOP+v+B9juXa7Y67EaWr3+UzQB0WJdsu4PiXt7Goo.1MWe++q4bD9Loc4wLcf2CxJA5H9Zeezc+W.+y7kYykPlsVBY1dIj49KgLOXIjYmkPlGdsxfCi5LVIRLkh.g9GX9KEYW9GqxdUq+Md7mAJ.

                                Hey @dustbro @ulrik , finally decided to dive into making use of the midi player but it seems a bit glitchy and unpredictable.

                                Simply trying to put together an interface that will control the Stop, Play & Record buttons of the midi player alongside a panel to allow drag and dropping of midi files.

                                I see that you kind of attempted it with Play & Stop a while back with the snippet you posted above but it wasn't quite there with unresolved issues and it doesn't play back the loaded midi file.

                                Any thoughts, suggestions or snippets welcome.

                                If anybody else has any ideas please chime in ☺

                                Cheers and have a good day!

                                1 Reply Last reply Reply Quote 0
                                • L
                                  LeeC
                                  last edited by

                                  Managed to figure this out in the end.

                                  Still haven't found a way to use a floating (or anything else) to be able drag midi into a DAW though... ☹

                                  Anybody managed to do this with the midi player?

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

                                  26

                                  Online

                                  1.7k

                                  Users

                                  11.8k

                                  Topics

                                  102.7k

                                  Posts