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

-
How do we save to the MIDI Folder within the plugins project folder?
I dont know how to write the string reference to the exact folder.
//Basically, I dont know how to reference the MIDI Folder. .. const MidiFolder = FileSystem.getFolder(FileSystem.Desktop); const midiFileNOW = MidiFolder.getChildFile("");
This one...
I can write and read from .json files but moving files is a different thing I havent learned yet.
Thank You
-
Im here....
I want to save some midi files to here, while loading them into MIDIPlayer1...
//Does this look correct because it doesn't load the file when I select // it from the pop up browser. inline function onbtnLoadNewMidiControl(component, value) { if (value) { FileSystem.browse(FileSystem.AppData, false, "*.mid", function(f) { MIDIPlayer1.saveAsMidiFile(f, 1); MIDIPlayer1.setFile(f, true, true); }); } }; Content.getComponent("btnLoadNewMidi").setControlCallback(onbtnLoadNewMidiControl);
-
@Chazrox You should be able to use the
{PROJECT_FOLDER}
Wildcard here. -
@HISEnberg Nice! I havent seen this yet. Exactly what I needed. Thanks!
Any tips on loading the file to MIDIPlayer? I was experimenting with just going to the AppData folder and retrieving some midi files there, but when I click on them the rest of my script doesnt execute loading the midi to the MIDIPlayer. -
C Chazrox marked this topic as a question
-
HiseSnippet 3831.3oc2Zr1aaibjJIJIRWejq3PQK5G5Vg1qxm8wH4Gw14vcwx5giiksUjjcbRPvAJxkRLhjKC4JK6j51h9un+YJ5Og9S49dA50YV9VOrcxcWQaELjEmc1Ym26LK2VtLUpmGyUJSttm6Pkx7ix14ba9fpCTLrk1slTl6j8TGdOSosO2QwyipIkIyM2AGLStaII97MOZaESEaUZLHIoiYFpzlFVF7Xns1ZOCSyFJZztFVIvd0s1UkYWkYxFALxMyVRxQQcnRe5AJHZ2HqTlaWWyfyb6vU3TOoL2Zal14cFvFa6i+wFdF8Lo3Ckk5.DxGbCloFxwHTopCLL0ZEJvdRRYx1JV7uou3+IY22PyHBdrZ3dhAHwyHo9HyMRyd2LE6UNI6UJA6MCV5FIXo6DZQDrjox4TWAq..1s1tA.RxFUG45Rs4cnuYDMk43adTvPccAEaL76tUSFyotsBvbZI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5pDdOv00xwjV29TpITKnfG+YPwehqqPHzz9x6yrYNCX1FpIMzsoPST86ScSx6yTfpv4otgaexVsolTkjNs+1sv2nnhK9Z+9.0Eku95hKyd8Kx5ytDL.j7+tIou4+emj1+JGzeeEvID1ZO6Air5.4FUo30DAJEBaxKyMv7a9OWJrmnNTaMwCeK7IXvx3yYBFrb3f+GYMrTTcYespe+cne5cEP.41VbO9xkce7YR4o6JDOb5uVUMMolZhK+gNwU9Pm3penSbsOzI9fOzIt9G5D23pmHtITkQbl+KfEubssp6WYYlnK2alaJ8uQLzARz
-
@tsempire Thanks! I just checked it out. I cant tell what you're doing different from my script above. Can you possibly give me some insight if you see what im doing wrong?
This is what I have now and still not working. Obviously doing wrong.
const var MIDIPlayer1NOW = Synth.getMidiProcessor("MIDI Player1"); inline function onbtnLoadNewMidiControl(component, value) { if (!value) return; local root = FileSystem.Downloads; FileSystem.browse(root, false, "*.mid;*.midi", function(file) { MIDIPlayer1NOW.saveAsMidiFile(file, 1); MIDIPlayer1NOW.setFile(file, true, true); //pnlCustomMidiRipView.sendRepaintMessage(); //pnlCustomMidiPanel.sendRepaintMessage(); }); } Content.getComponent("btnLoadNewMidi").setControlCallback(onbtnLoadNewMidiControl);
-
@Chazrox is this working, you have a semicolon instead of a comma?
"*.mid;*.midi"
-
-
@Chazrox When the user installs your plugin they won't have the project folder, so you don't want to store your files there unless it's for them to be embedded in the plugin. For any files the user should be able to modify you probably want to place them in an app data folder.
-
@d-healey I tried this same method with AppData and it didnt go well. It has to be something else. I've been trying for a few hours but I cant seem to find it.
-
-
@Chazrox said in Save MIDI files to MIDI FOLDER || See code::
@d-healey I tried this same method with AppData and it didnt go well. It has to be something else. I've been trying for a few hours but I cant seem to find it.
Which issue are you referring to?
-
@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+bdQReVDUIkZLlLnr2rTMD26njjSXZF5eiTUXLQIuKE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