HISE Logo Forum
    • Categories
    • Register
    • Login

    Loading Different Midi Files With Different Sample Maps

    Scheduled Pinned Locked Moved General Questions
    15 Posts 3 Posters 640 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.
    • J
      johnmike @Natan
      last edited by

      @Natan wow this is dope...def gets me closer to what im trying to do...now how do I keep a midi file loaded into the player? like how do I set midi file 1 to A...midi file 2 to B...etc etc...right now they load but there's no recall

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

        @johnmike said in Loading Different Midi Files With Different Sample Maps:

        @Natan wow this is dope...def gets me closer to what im trying to do...now how do I keep a midi file loaded into the player? like how do I set midi file 1 to A...midi file 2 to B...etc etc...right now they load but there's no recall

        load your midi file from a comboBox selection - set the comboBox as SaveInPreset = Enabled

        In fact exactly like @Natan has done in the snippet - remember to save your project to save the current state..

        HISE Development for hire.
        www.channelrobot.com

        J 1 Reply Last reply Reply Quote 1
        • J
          johnmike @Lindon
          last edited by

          @Lindon cool...Im still getting used to this scripting thing...where in the code do I put the "SaveInPreset = Enabled" ? maybe im missing something...I loaded in a preset browser and created a couple of presets and it indeed does switch the file when I choose a different preset...but it unloads the midi file when I switch presets

          Screen Shot 2022-07-12 at 8.53.02 AM.png

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

            @johnmike - you dont (usually) put it in the code, its parameter of each and every widget in your interface,

            295dc2e0-c533-40bf-9ad9-0f40a4032128-image.png

            HISE Development for hire.
            www.channelrobot.com

            J 1 Reply Last reply Reply Quote 0
            • J
              johnmike @Lindon
              last edited by

              @Lindon got it makes sense...did that...but...it's still not saving the midi file that im loading in...as soon as I change the preset...it unloads the midi player completely...even when going back to a preset it does the same thing...seems to initialize the player each time here's my snippet

              HiseSnippet 1683.3ocwXssaaTDFdW6rExVBsEJRbCRq7UNptt1sEnhJTiO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RnycNScvaOaDHEtQkb.g9cBewmp5z4QTKp7OPPuZxl

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

                @johnmike - what are the names of your midi files...

                HISE Development for hire.
                www.channelrobot.com

                J 2 Replies Last reply Reply Quote 0
                • J
                  johnmike @Lindon
                  last edited by

                  @Lindon right now just this cause im testing it out Screen Shot 2022-07-12 at 10.30.55 AM.png

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

                    @Lindon I think I just figured it out! smh...I changed the midi names in the script to the midi names in the project midi folder and they are loaded now when I switch from the combo box

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

                      @johnmike well that would be why then, look at this bit of the code from @Nathan

                      
                      inline function onMidiSelector1Control(component, value)
                      {
                      // Set the midifile
                            MIDIPlay1.setFile("{PROJECT_FOLDER}"+MidiNames[value-1]+".mid", true, true);
                      };
                      Content.getComponent("MidiSelector1").setControlCallback(onMidiSelector1Control);
                      

                      what is it doing?

                      --hint: its loading a midi file into the MIDI file player.....

                      what is the name of the midi file its trying to load?

                      -- hint: its taking the value returned by the comboBox, and looking up a name in an array.. here's the array of names it is using:

                      const var MidiNames = [
                      "Your midi file Name A",
                      "Your midi file Name B",
                      "Your midi file Name C",
                      "Your midi file Name D",
                      "And So On...",
                      ];
                      

                      so when you select the first item in the comboBox (called "Your midi file Name A") it knows its the first item (so the number we would be using is ..1), but arrays are zero indexed so we need to remove 1 from the returned number to get to the correct array position..so: 1-1 = 0, so it looks up array item zero ....

                      this is "Your midi file Name A"

                      so it adds ".mid" to this to get:

                      "Your midi file Name A.mid"

                      ..and it trys to load a file called this:....

                      do you have a file called this?
                      -- hint no you dont...so nothing gets loaded....

                      See if you can figure out how to change Nathans code to make it work for your file names...

                      edit: seems you beat me to it...

                      HISE Development for hire.
                      www.channelrobot.com

                      J 1 Reply Last reply Reply Quote 1
                      • J
                        johnmike @Lindon
                        last edited by

                        @Lindon yup I see the light now lol! You guys are amazing...one other question while I got you...and let me know if I need to buy you a coffee or a beer for this...is it possible to have the midi file play automatically when the preset is loaded? like when I click on "Test 1" it automatically triggers the play button on the midi player? trying to create an drum loop player that plays the files as the user clicks on the preset names...I.e. Click "Kick" in the preset browser and the kick start playing...hopefully that makes sense

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

                          @johnmike said in Loading Different Midi Files With Different Sample Maps:

                          @Lindon yup I see the light now lol! You guys are amazing...one other question while I got you...and let me know if I need to buy you a coffee or a beer for this...is it possible to have the midi file play automatically when the preset is loaded? like when I click on "Test 1" it automatically triggers the play button on the midi player? trying to create an drum loop player that plays the files as the user clicks on the preset names...I.e. Click "Kick" in the preset browser and the kick start playing...hopefully that makes sense

                          Go read up about UserPresetHandler, and specifically setPostCallback

                          HISE Development for hire.
                          www.channelrobot.com

                          J 1 Reply Last reply Reply Quote 0
                          • J
                            johnmike @Lindon
                            last edited by

                            @Lindon thanks so much for the point in the right direction!

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

                            40

                            Online

                            1.7k

                            Users

                            11.7k

                            Topics

                            101.9k

                            Posts