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

-
@d-healey I cant get the midi files to load into the midi player.
inline function onbtnLoadNewMidiControl(component, value) { if (!value) return; local root = FileSystem.MidiFiles; FileSystem.browse(root, false, "*.mid", function(file) { MIDIPlayer1.saveAsMidiFile(file, 1); MIDIPlayer1.setFile(file, true, true); }); } Content.getComponent("btnLoadNewMidi").setControlCallback(onbtnLoadNewMidiControl);
I've tried .AppData .Downloads and .Documents. I can open the folder and click on the file but loading doesnt execute.
Trying to load .mid files from anywhere doesn't work so it has to be the way im reading the file in or something...?
-
@Chazrox said in Save MIDI files to MIDI FOLDER || See code::
but loading doesnt execute.
Do MIDI players have a
setFile
function? -
-
Show me where MIDIPlayer1 is declaredActually if saveAsMidiFile is working then the declaration must be correct.Minimal snippet time.
-
-
@d-healey said in Save MIDI files to MIDI FOLDER || See code::
Show me where MIDIPlayer1 is declared
give me 5 minutes please! brb!
-
HiseSnippet 1031.3ocsV8taaaCDmxNpq1aqnEXO.b9SJEFFx4eKEAEMINwaFKI0XJKXeqfV5TLQjH0nnRlQQA1C0d.1Sy97dC1NJIaK03klYrQCXni2e4ui2cbrR5CooREwp8kyR.h0WX6MSnmNXJiKHiNgX8b6y4Ab5YRV.8RHUSNdVBKMEBHVVM+ViTVs1fju9y2bLKhI7gkaQHWI49vY7Xtd4tiO764QQCYAvk73JRuygi7khAxHYFFQMscIIL+aXWCWvLh0vl7crzoDqWZu0Vg9665t+1auqKisc.isSeX6WAg6E5uq6qbClrqK9aOh0SNMfqkJOMSConQOVFLyap7NQgCthmxmDAFh9DOzyEaSFLkGELdN7jRHVaLdIX0r.r9pbrYw92CzVpQUPypwCER8+WDRMpDRe177WdHEwlAp7P4Y1mO5jQzhc5WKPFjoTfP6A+bF7QYsRVWpP7uZB9LoL4TACCufpaar9DTTuDnNCql+GcVIli0PdDX9txwdihi8Kr87U7D8RNly9maORnAUHCObUO3ExRZ7GMrGHQID5dwrafgJjXgFN6451kh+s4AsaiWKS0zaYJpAMKAS5qo4EK8tFzKQcmNUA7Nn1KUdhVXJjt.tK+9wqoycOZgAx3Do.Ib5TWLiIvEWDwE.MLS3q4RAUJpKlwTJYji+b6zEcYTFrY622lhKdH04qK1gp.clRbfY+bdQReVDUIkZLlLnr2rTMD26njjSXZF5eiTUXLQIuKEbLZzkFxhRgtzNurWLOnS2EgnSHpvlE59dZ4pU6Vspfg8RY2BGkNO6lqRWZ+MOXt7sm+QMk.cEo0prx+Wp1JV4V5CHX9g1ONX23lRTc.KJxbA24e.0MonJYlKjZ3sBGCz2BcG8iYEFtRdkFKBuDsJ1llkpGRQGQV7DPUIwmKHVkTuJ7IOtpP+BTphfRwHAW+1DnjdnLJvTRY9dE0rkvL1oxpLBQQ04ErOqrf83LsVJH7.SSy5PKI+TTsqD4GGYtNN2dnoQ2k.JM2bprNAtEm0TzPnk8IP5MZYRtrkoXrK4i26+xBO+qWc3rED+9jCuiGnwoP1V+FROE3WOUanbPJd54xXzSLEpgUiUzoBGMHCxhX55yKLSRKYfozZcqLcjDob8rZMVe7CQbe3FqOxP7E1i4Z+oqNFarhXzLe5+gXrbz6WZeZXH3qWFfaXO7mV24reB2+CxLMWb84LshiWKruHK1CehhOfdWHfnTS5ug4BeAsqg1f.dfHHm3uvUIy9FZqRl8myjDy7Ux24WTlXFt+z7cvXRj+3mV1mano8ueYA10k+Ne+5l5dJt05p31qqh6rtJt65p3dqqhey5p39eZEMcSNJSKiKJavmxL9z71XVVKdJkUSxeCLcj3vC
-
@Chazrox I'm out for a few hours, I'll take a look when I'm home
-
@d-healey yes sir!
-
This post is deleted! -
Please help. I really cant afford another day of loss this week.
-
@Chazrox Your snippet works here. But I don't understand why you're writing over the selected MIDI file.
-
@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!
-
@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);
-
@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+gcKRz30LJgAokgEqAksX2mjsEY3HcuF9i6JbSUFx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cZSTcKFOGzijk6lJy.v5quys182Npy21aFgu8I2zYTTW2juliE+16nwCjX.Ul+ydXccwLQWHFyXVas.ojtnKEy45zecn6kdgiZznTgVv+sXIdKU648t5rjqTTOAgeMLRmbmH0O7HZ1aWhlYJQWj2pJmL4Q5OMqVtliHVWj2ypYiPFqgYivou6T7wW3krEAcYmO5xxft6nMYrRsJspj+vJeHO9VMbWPjk4EAYodAPBaFd8JqvnjiG8xQZIRhuqZPWhA6pWOt84rFnBZy75FeiZMl0.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..
-
// 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....
-
@Chazrox What does the documentation tell you to pass as the first parameter?
-
@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.
-
@HISEnberg WOWZERS! That looks like fun!
Gonna check this out rn too! Thanks!
-
@Chazrox Yep you are so close. So what you get back from the
FileSystem.browse
function is aFile
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 casefile.FullPath
- file here is the file object, which you've called file, but it could have any name.