Loading Different Midi Files With Different Sample Maps
-
Working within the sampler...I have chopped up a loop and mapped it across the keys and I am triggering the loop as a sequence using the midi player...which should be a great workaround seeing as we don't have time stretching built in yet... the idea is to load a different loop into a different SampleMap and then trigger the loop with different midi files...the question is how do I make the midi player load a different midi file when I load a different sample map...
-
Anybody? Lol
-
@johnmike Here you go:
HiseSnippet 1363.3oc2Ws0abSDEdb1L.wPfVnHwKHMZeZiZ51rsEnRUnljc2f1RRyp3sAPkppI1ylcn1yXrGG5ppJwOMdf232.+EP8e.bN9xt1QNoaiZ4lSzJOmKy7cNm4bwCizth3XcDwZkQSCEDq2i5LUYlzcBWpHC5Qrde5d7XiHhkQZ6og73XgGwxpwWgDrVYYR5yKt61betxULmDgbnV5J1UFHMyoNbyuV56uC2SLRFTR5as4.Wspq1Wm.3oAcCRH28I7iE2mihsDkX8V88jFcjigaDwDqk2V6M0Yh9mTYxenLVdju.Wzg3.aTF4cz9dHhQpjtSj9dCKr6XBwhNbtWnQlW3Jz8jdxYzm6MtTJC1bMJ6OrVpJ7ZTAdcJCuMJAuZfzRkfzaWDXRgjOepHJEJ1z8Fza.RnBH5lDEITFGwOlHNUvHm0nHvsVNtsqVG1WwAn4UVbbqOBD0ITTlwKtqUiE1N6bt1IAMocj9B78Rl7xYl7koNtQxPybNnc+tzAJ393XNXbkM7LYIKcXCZWMHgxzNf+DwNQvhYZzpyMt85radi0typ13evEtXC6DdDqvY1g8krzTf1GKLyc4sZVHPyLcu90Y2KAz0LQvTvETldLK8tAZOqy9FoYhNwvZGH8pbLfH384X3XdncyuCtqyBP0FCpwPNrsZtd8L19rXz8rXzCYrkxi4nY6qZ2tcy0W09Q.9sQ7OZhLlA+OBLgt5fizaqe5owpivW3BwZzsT3VAGCHdnVAK.+RYoRcNUnzNV.BIMhf3lqO27a+CZopUyuW0bs0tCK8AP0p1RkuTIXiSTtFoVwzpJ6FBgHseK2hyec.o9Ih0V09YowDGQVHAcDnevlk+LK9h.BiQsZ9rgGr+852czi2Y+c60+fm27pyf2CS20q04QWsIFAAjahRDY+lE+eN76B4PvyKG1c499XFUq5sJbiKY32WaD6qZsl8yrWw941rSyZ73Z4kuY9vc15Xi0biNOEaoRBNRDU3XKDDxJql0SWrrd2LeTIA0pAJoY+Pg5rJISxcrPkPqbTAhZRKJbo7hBEWXIRH6+CnU7mjTnOuj0U1j7fA83FdwFB6MbdghHiDMEqdhSf9TYUcVg1SD+DiNLU17nJz54U33eZ4xnSKuHfC7nVT30zTBh0XZs0.rqs.PsT6VK0d1ky6qq7JzKS6k3yMUavgc0yY.2KpThEKiphkloU5F75pq2hBwKSGJMtSpGiKUCFwFpuAvX9rBqR6OdLD3mCvko67suYFLn7w+QEG+VIdRM1COevfqjQggjXYcu5bVys8K+wl+9hN2V3BO2Fz+zEBOhxWSRiYoidHUGW9nNioONPqMXYtxyM5vCB8EfWLx.aeEoEmHhhqtCXQ9rQG+T5oK022K3Zabq1i84tj.zaPsJkdhu5CvJ8jJSnuxqX4oGBZ4Eqb3KYVzk+W2rn+GnvQkwkWo.iNR7xRe0IBeH0HEieHTZeLOw2TPsZdwdZkNbhVIcqd0xDIO9XQTYrWqAskwTYxZTWeAOd1c3e9290M2EFugGc5riWAew4ORsk0BFu9DZFbYXxL6e7B94ekiM8PHv3hmHBxOd1R1LSnyKGgOHVLhmBg4ghAPHOxTsBQOgq7Hge0fwqT2hNu46n03+2czN.9JInivdbHKCK9d+j.GnQhq.NckR3iSZZsDNSX15MJJ.6HTdoK9S3ImYGbsUNyNEL+a4LB3tQ5G6lMsJlH9NoT.6Vk1CZE5d3Z1rgSozMZuAAmZ6wttnK9ZcHj504FW.ct4EPmacAz4yt.574W.c9hKfN29b0A6dtUhQGjkxADF1O8iDrrlMOhUCxeAy01JaC
-
@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
-
@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..
-
@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
-
@johnmike - you dont (usually) put it in the code, its parameter of each and every widget in your interface,
-
@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.3ocwXssaaTDFdW6rExVBsEJRbCRq7UNptt1sEnhJTiOhbIowJq6ATnpZxtisG5tyX1c1jFEEItfGf9pvaPuf63YfWATuiKK++6A6cc1j5ZZ.2pDO+Gl46+37Ooumvh56K7TTWcvgSnJpejl4gb43ViILtRu1Jper1VDeI0yHhTyCmP78o1JppE+Njf5pqnD9402qIwgvsnyHon7HAyhtIykImQs+FeOywoKwlNf4lR5auQOKAukvQD.3onVMkIDqmSFQe.AEqflh5E5XyjBOSIQR8UTWoov9PywhC3Qx+HlOaOGJtnthIrQQj6JbrQDiTUZMl4X2Owt8UTT05OyKTLxKbUssX1rozm4MtbHCiYZj1enV3rfW8zvq1hCuBof2GjDjBgmC4PpWHrz01pW6dHgL.pUfmGkKMo+b.ct.SLqAdfKNcLbSgXRGNAfocZwwsdOPTyIzzLd88TKl0lKd51b5PxIsSEzj5xbn32SYxqDYxWQyzxiMQNiCZ2WTqGGxMGR.iKsgGIqRgmTTqk.jfKq5RdNsqGrXpFkqWqVsJF2oVs0u6Z53+fzOeow9DOiD2Yciu0Hrfn5HpblSuboDAJEo6Mtgw8C.ckioFbHc0PLzHLSAsnJFOlIGKBjFUcY1YNFPDL61GNlc0K8CPlugKp1PPMCjiQiRUxmQySiQqSiQajQC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Bs4mzpis60qc6pCcHVJtn2PSM0si3Wc.XEdRoIzgamrb9WgrxhMMxa4kWqbd8vvhKV52xWs9uu4xRCwLuWc0DLZxvjkN78oNPoQHF+DXxpgj.GYB0r0EaI3hIiEblU1TKoGazHpWZrmqA0PJy7zVTWGJweZN7u7G+9FaButf3Me0w6fu3reSqp5BFu9bsH3ZfEyF+uD2TN4elAcsGAAFK7DQP9YSWZL0Dp+1Q3C8oCHgPXVnnGDx8jY6PzlZw1i5jMXbxaQV9+.CuOtoq3BcS26kfvxe61xe76HBvA82h.UYXyWXpQS3hDKJb5bN0AenmZA7IYQqqkz.1jxsCW7F3SLy53Z0Xl0SX9exY3Rr7DOyJ5whXg3GFRArad3cPqpsEt1X5aC0zpUslB9nomYYgt3qWWQIect4RnysVBct8RnyWtD57UKgNe8RnycNScvaOaDHEtQkb.g9cBewmp5z4QTKp7OPPuZxl
-
@johnmike - what are the names of your midi files...
-
@Lindon right now just this cause im testing it out
-
@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
-
@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...
-
@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
-
@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
-
@Lindon thanks so much for the point in the right direction!