Creating a MIDI sequence browser/selector for MIDI Player
-
@Mwins your using
MIDIPlayer1.setSequence(list[value-1]);
with you can use if the sequence is already loaded into the midiplayer
try this:
MIDIPlayer1.setFile(var fileName, bool clearExistingSequences, bool selectNewSequence)
-
@ulrik Thanks for the reply. So I have some strange behavior going on. I am sure I'm on the latest script-node.
Like you said, it should work if you have MIDI file is loaded into the MIDI Player. Below is a snippet where I have loaded a midi file into the MIDI player 1. I have also set the Engine.addModuleStateToUserPreset on the MIDI player so that it retains the file after closing out.
The combo box only seems to populate if I have placed the MIDI Files in the project MIDI folder. "getMidiFileList" seems to only work or pull from the project MIDI folder.
So would the example you gave work on an exported plugin? The MIDI files should be contained within the plugin once exported. Then, how would you obtain the filename for MIDIPlayer1.setFile(var fileName.....
-
Here is the snippet with the MIDI file loaded directly into the MIDI Player. It's got to be something simple that I am missing
HiseSnippet 2518.3oc6bssaaajFlxNrIVMNHMn.cuYADL5EJHID5rs2hBKKRIaYcvRhR1RZSQAE4HIZQNCEOHY4h9BruA8t8QXeDVf8oXuq.686l2fcmghThRV0Q0HwqcBctIy++b3a9m+CeyvDWQGIBLLP5TA1p9DM.UfmRyOAZ1msufLjJOGUfGSWGnpgnxLQSvv.HQEHvlGQTFXqGQY+y6NHifh.TDLWDE0YHYQPQYUYy4RqjtfrhRNAIPcYUO8NQ57hHHKRAYgAxlzQnzDDGHzCTVfzsMnoB7EYkjMQ57lBl.Cp.OJCRZBeezX3z9elrgbGE.oQTJd7DMUbNjhDAwDoTr8kUjp3tgMnnBDrx7s+lS29eMcIYI4YxmaFdtshPyGgW6QfMtI3E0K7hr9vKfG38nov6qn4E0k0LmqgfsujNOzDn2U.eD3EVS6K0F+kMnYQ3d.MYTEF.xoiaLaDg2ORjWGJU7nu761N31AwGDFlgFInGpTdt7UTDl.ziF56CY6UvzCXZaerEGdGRWB4zmcHie9nYQpcPYPWRFq6hiGMVrFBhaDdmY8XmkWYEY7e468B.2ENmrB1oxvLLYHyl.FC.d9jMApF67Z6Qyb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g0JVh4JW4BMWcMxo2BuEwLUKiju0yRtB7X+FgfUAFGMqDIN5t9t1QwJtzvbTTRX.vRaES20U7fMGySbS25r0bdNWmVK5uM0B6rsSGO9+5fSsL0rL8J4ZFzecwqpg6z+3fBPfaO9q+xu7OO3Aq06lxj8Lm2DOzza9e+lrwSoseE2PjGc+S4bshtSEdu472serw.aBlQXXCEvHfh2naCqtcIPZC5ay2DIl+2Dw+ah7+kuIRzO69lHwVuuIBdstO+MQ9j9cfi4+Nv9uC7mR+SivmDnOIv2KIv39j.8IA5SB7NgDXbeRf22IAF2mDnOIPeRf9j.+rhDXBeRf9j.8IAdmPBLgOIv66j.S3SBzmDnOIPeRfeVQBLoOIPeRf9j.uSHAlzmD38cRfI8IA5SBzmDnOIvOqHAlxmDnOIPeRf2Ij.S4SB79NIvT9j.8IA5SBzmD3CXRf2EnTUPTG8ihS+UJGAqOwVBFkP6e8mrEcIR6Py9sHGMcDlHTp3xH+nnHIP3MXK7pGSrawXheKFShawXRdKFSpawX18VLl8twwPpfenkIRcZRRrfJYm5XEvy+Eko9e.8BObHA
-
Update:
MIDIPlayer1.setFile(var fileName, bool clearExistingSequences, bool selectNewSequence)
This does infact load the file from the MIDI folder. Thanks @ulrik I actually figured out how to define the file name. However, I am not sure of how it will work once the plugin has been compiled.
@Christoph-Hart does setSequence in conjunction with getMidiFileList work on files that have been simply dragged into the midi player? I am not able to get this to work. I have several different midi players that will each contain a separate set of midi files. Although "setFile" works to load the file, It's only ideal if you have 1 MIDI player with 1 set of Midi files. I need a solution that will locate only the MIDI files that are contained within a specific MIDI player. It's not ideal for me to select the midi files from the project MIDI folder because I am trying to categorize and group them based on the MIDI player they are in. For example, midi player 1 has flute midi and midi player 2 has bass midi and so on. When the user clicks the combo box, I only want them to be able to select from a list of midi files that are exclusive to the slected MIDI player. Not every MIDI file in my project. I Hope that makes sense. Is there a solution or am I missing something simple?
-
@Mwins if you Console.print the "list", you can see that it's empty,
so this line don't get anythingconst var list = MIDIPlayer1.getMidiFileList();
-
@Mwins said in Creating a MIDI sequence browser/selector for MIDI Player:
Update:
MIDIPlayer1.setFile(var fileName, bool clearExistingSequences, bool selectNewSequence)
This does infact load the file from the MIDI folder. Thanks @ulrik I actually figured out how to define the file name. However, I am not sure of how it will work once the plugin has been compiled.
It will work just fine in the compiled plugin
-
@Mwins said in Creating a MIDI sequence browser/selector for MIDI Player:
Then, how would you obtain the filename for MIDIPlayer1.setFile(var fileName.....
You have to store the midi files names in an array or something,this is how I've done it:
const var DemoSongsArr = ["Bel viso", "Lorda mornar", "Sakkijarven polkka", "Vals i natta", "Miss Karting", "La China", "Invention 1", "Kass theme", "Libertango"]; //populating the cmb inline function onDemoSongsControl(component, value) { DemoSongs.set("items", DemoSongsArr.join("\n")); if(value < SongInfo.length) { // Set the midifile MIDIPlay.setFile("{PROJECT_FOLDER}"+DemoSongsArr[value]+".mid", true, true);
-
@ulrik said in Creating a MIDI sequence browser/selector for MIDI Player:
@Mwins said in Creating a MIDI sequence browser/selector for MIDI Player:
Then, how would you obtain the filename for MIDIPlayer1.setFile(var fileName.....
You have to store the midi files names in an array or something,this is how I've done it:
const var DemoSongsArr = ["Bel viso", "Lorda mornar", "Sakkijarven polkka", "Vals i natta", "Miss Karting", "La China", "Invention 1", "Kass theme", "Libertango"]; //populating the cmb inline function onDemoSongsControl(component, value) { DemoSongs.set("items", DemoSongsArr.join("\n")); if(value < SongInfo.length) { // Set the midifile MIDIPlay.setFile("{PROJECT_FOLDER}"+DemoSongsArr[value]+".mid", true, true);
I have also tried there and given it up for the time being.
Do you have a working snippet here? -
@MikeB Here is a working example
midiplayer -
Super - Many thanks for that
-
I just tried the midi player for the first time. i just have a problem with the play and stop buttons. even if I assign them the play button does not work. it does another function. i am using scriptnode version about 1 month ago.
-
@yall What kind of reference do you do to the MidiPlayer?
There is 2 kind
-
@ulrik I didn't pay attention to 2. but the one I use is simply called the midi player in the midi part of the containers. the one where there is the drag n drop, choice of sequence, play stop rec.