HISE Logo Forum
    • Categories
    • Register
    • Login

    Loading Files Into MIDIPlayer via script?? || SOLVED! 🙏

    Scheduled Pinned Locked Moved Solved Scripting
    34 Posts 5 Posters 120 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.
    • ChazroxC
      Chazrox @Chazrox
      last edited by

      Please help. I really cant afford another day of loss this week. 🙏

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Chazrox
        last edited by

        @Chazrox Your snippet works here. But I don't understand why you're writing over the selected MIDI file.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        ChazroxC 1 Reply Last reply Reply Quote 0
        • ChazroxC
          Chazrox @d.healey
          last edited by Chazrox

          @d-healey explain please! I dont know what you mean? Im not intending to write over it. I just want to load it. Any clues why its not working in mine? I dont even get errors, it just doesnt load. Kinda hard to chase down with no errors and minimal knowledge. haha.

          So you're saying midi file loads when you select from the pop up browser? Can you show me please! 🙏

          d.healeyD HISEnbergH 2 Replies Last reply Reply Quote 0
          • d.healeyD
            d.healey @Chazrox
            last edited by

            @Chazrox Actually I was wrong, it isn't working, but I'm not seeing any errors. However I know why it's not working.

            // This overwrites the selected file with the contents of the MIDI player - I don't think you want to do this
            MIDIPlayer1.saveAsMidiFile(file, 1);
            
            // This is almost correct, take another look at that API documentation you posted ;)
            MIDIPlayer1.setFile(file, true, true);
            

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            ChazroxC 1 Reply Last reply Reply Quote 1
            • HISEnbergH
              HISEnberg @Chazrox
              last edited by

              @Chazrox Hey hopefully this will help you out. It's a whole MIDI project I was working on that sort of never came to fruition but I started building a MIDI browser for loading into a MIDI Player. The script is pretty huge but hopefully you can find useful parts to salvage. Maybe try running it through an AI with links to the HISE docs about the MIDI Player and extracting the useful info for your use case.

              Let me know if loads/works for you correctly.

              HiseSnippet 4621.3oc27r1baibjf1laVqb6lcq6wGxmvppNejVTv7gjkr05rhhOjnsHEMIs7CUJt.IGRBIP.Z.PIQ6n6Rc+RteF2GyOostue0ccO.fX.v.RJZoToBSJsFyzS28zS+blAntgdGhootgPrUZMYDQH1+P7lSzrFTXfrhlPkhBw9WhOToqxdF5WZRL12PoadCC4IB6MYjroIoqPrX2eeD1XO7ABze+5urmrprVGhWSBBGqqzgbnxPEKuVqu6qTTUKK2kzRYHCzarakN5ZEzU0GC708imVXjbmyk6SpIifcu3BGHaNPH1iimlztc2dsy8LR1LYx9rMSu4VsyBMkizQNaus1HS5s1bqrOCXxuoTWEKcilVxVDSgXOXO8tSZNP+RMaBbrhoRaUB9PFgl.ksatrtZWbJhsJTXfhZ25tBLSA.K08De22V78OEuJHsl1tmX7GncH5MBVAXr64m8tuO1KCK6klg83vR2mgk9MtqnTVRUdBwfxJee7pUJVQztkL9XjBiMLHZVMIeZLw2J3u9KNc0x.VKXa+Pc8QkzjA1qKayH1aCf1bDweGwt+BOWyLy4p.NsJqnRv4cL2G.nw4HnjTT1RVH1gw2LmjVqm9psKzn94kjjZUodyV8K+dI3WYo5RREuXCsOW7MWYVFZ4hWJIU40mU5f1RMJVuzdkjVas8jxKU+kM2nh.R.akvee7uTuwQurTgVer7QGVrTiqOWoy4RfoBvKn5bSk9ZxViM.X+lZiGtmLvxLRgZ5CUf9wkI2F+gcKRz30LJgAokgEqAksX2mjsEY3HcuF9i6JbSUFx922JC2KQr3Yyrki5PFo7edXdoCLuR0XudUJKUHW+5adQ98U+TgICtJ6k8aLZ+2o7gKZou1YkmbVtCRK+Vs2t1qk2SRtW6JmU67wC2ebuWYUn7YUZ7rsOt26K95IeBzALKja6MkpuU0q1uowy13kExU7M4e8kmqV8fbkdakypV73wkNO8G5kUdi9oKdwa00y2nWk8KM53ZWo1+rIuq94EMTe6kkKk8f0FXV7SFkKU3xMq7tssTq9xtiG+dRwielRwWZU5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Ot84rFnBZy75FeiZMl0.SnMdXaLUMGyHG.Eh8.+ub0wWrWt5N1pUL.pCA5UrNZDQKpOEBBN5h3GEAGtB.0h9Z298Nu1s6M1xRWS.eKg+93rlbBT9l8E7U3FgCzJa4vw2Emw3KHJ90e4lhhrb3h2Tg9pmKDKliHBDaiHFVJ3JRrhjKT5Pre8jeX7hDyyszGID6amZOKD62XS5uy8kWF0noT9eNNmPHBWwR8IrObIdPESa3u7et6.5YMLskc+O1EbQneoqiBf+9cwyqpJ50f.Ce8MQwW+X7.1aQwS69m2cd7jPqcEhVVbnbaGZ9OFOTddrTUY2IrSSL4OXBDG+jMDPr.fFjE1vGK7sKpRMC4euexqXVUGK2R1Xhs8jM+rRb5sqQerY.d5Oe7s.OQMRX3oIKDO8Mwoi6FxOQtL88wYugfLry+0+NuUneWbZ1VYvaa3FRou8DK9s6iR8zkMPwQ.sjJbHsgbWE88MzGOJfOjaHCkkkgprKWFJ6WACE9CivODupd2wp39Iw9AqA+r93zADuw2GGA7CffFDibhuOlG2VeEaVTV7GiWGyGjOOdON7H3F9tfGc91+7cwK0qGj1gGC9f3ke2cyG5GA6KIUenjFCEPeIdswCapO1nCAyYAbEiw6icOLLn8yowmQIPShVW5C+evOmNyfOGyoyLtcJLTtig9G6XGDD+vp7szV.dRi9oA4gwqhOKlIbbO7sV4ic53GUgFX1kcf4V1AtwxNvMW1A9zkcfasrCb64OPLRY9wV5CsMaDDpVuj82KoXS+78D69B++.nXSG..
              

              ScreenRecording2025-08-29at6.06.02PM-ezgif.com-video-to-gif-converter (1).gif

              ChazroxC 1 Reply Last reply Reply Quote 1
              • ChazroxC
                Chazrox @d.healey
                last edited by

                @d-healey

                // This is almost correct, take another look at that API documentation you posted ;)
                
                // I see! 
                MIDIPlayer1.setFile(file, true, true);
                
                // So I tried this....
                MIDIPlayer1.setFile(file, true, 1); 
                
                //still not loading. hmmm....
                
                
                d.healeyD HISEnbergH 2 Replies Last reply Reply Quote 0
                • d.healeyD
                  d.healey @Chazrox
                  last edited by

                  @Chazrox What does the documentation tell you to pass as the first parameter?

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  ChazroxC 1 Reply Last reply Reply Quote 1
                  • ChazroxC
                    Chazrox @d.healey
                    last edited by

                    @d-healey filename. My little brain assumed that the filename would be picked up on click or something. So load by file name? Sorry im new here. haha.

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • ChazroxC
                      Chazrox @HISEnberg
                      last edited by

                      @HISEnberg WOWZERS! That looks like fun! 🙏 Gonna check this out rn too! Thanks!

                      1 Reply Last reply Reply Quote 1
                      • d.healeyD
                        d.healey @Chazrox
                        last edited by

                        @Chazrox Yep you are so close. So what you get back from the FileSystem.browse function is a File object, not a filename. To get the filename from the object you need to use .toString() and pass in one of the various constants, in this case file.FullPath - file here is the file object, which you've called file, but it could have any name.

                        Link Preview Image
                        HISE | Scripting | File

                        A object for accessing a file on disk

                        favicon

                        (docs.hise.audio)

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        ChazroxC 1 Reply Last reply Reply Quote 2
                        • HISEnbergH
                          HISEnberg @Chazrox
                          last edited by

                          @Chazrox I think you need to set the path to the file there, not just the file itself:

                          MIDIPlayer.setFile(midiFilePath, true, true);
                          

                          Essentially this is how I am doing it (you will need to change the file name, but this should load in your project).

                          @d-healey is right though you want to learn and use the File API to get the path and extract all the midi files instead of writing it out like I do (it will save you a lot of time).

                          const var mp = Synth.getMidiPlayer("MIDI Player1");
                          const var Button1 = Content.getComponent("Button1");
                          
                          const var midiFile = "{PROJECT_FOLDER}kick.mid"; // the name of midi files
                          
                          
                          inline function onButton1Control(component, value)
                          {
                          	if (value == 1)
                          		mp.setFile(midiFile, true, true);
                          	else
                          		mp.clearAllSequences();
                          		
                          };
                          
                          Button1.setControlCallback(onButton1Control);
                          
                          HiseSnippet 968.3ocsV01aaaCDlxNZaVaqXEn+.H7m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G9aeYd0AciJUyk2cIQGygKa6qRCm.OdSYPzkRXO.nyplowMWtkQ1TAlvj9YB+E7ovnmQ1pvn2JinPBMVcKMuc27T22joA3jL6uEzv9RiLdKc4lET2RoUOp+Av16Jvi1UfGuq.OYWA9xcEXmcE3q9uAZdw7MoZUX9XC7v93AYakrrV+GKrpi9ajyj2aC
                          
                          1 Reply Last reply Reply Quote 1
                          • ChazroxC
                            Chazrox @d.healey
                            last edited by

                            @d-healey I got it....wheres that damn t-shirt. Thats my outfit for the week. hahaha.

                            Thank you so much! 🙏

                            @HISEnberg I see the answers in your snippet as well and so much more! Im already learning a few things just looking at this. 🙏 Bless!

                            1 Reply Last reply Reply Quote 2
                            • ChazroxC Chazrox has marked this topic as solved
                            • First post
                              Last post

                            17

                            Online

                            1.9k

                            Users

                            12.4k

                            Topics

                            107.9k

                            Posts