Help with loading 4x file_players from Ui button/Knob
-
@Rognvald said in Help with loading 4x file_players from Ui button/Knob:
const slot = ScriptFX1.getAudioFile(0);
You need 4 of these, one for each of your node external audio files.
-
@d-healey Ok I get that part, but how to set different files for each 4 knobs through Script FX1 is where I am confused.
//Knob1 Sample selection--------------------------------------------------------------------------------- inline function onKnS1Control(component, value) { Synth.getAudioSampleProcessor("Script FX1").setFile("{PROJECT_FOLDER}"+inst[value]); }; Content.getComponent("KnS1").setControlCallback(onKnS1Control);
-
Each slot is separate.
const var ScriptFX1 = Synth.getAudioSampleProcessor("Script FX1"); const slots = []; for (i = 0; i < 4; i++) { slots[i] = ScriptFX1.getAudioFile(i); }
-
@d-healey Thats the one, is it similar for the sample array?
// Array Samples in AudioFiles-Folder---------------------------------------------------------------------- const var inst = ["Wi_Kick-1.wav","Wi_Kick-2.wav","Wi_Kick-3.wav","Wi_Kick-4.wav","Wi_Kick-5.wav","Wi_Kick-6.wav"];
-
@Rognvald I'm not familiar with that project
-
@d-healey its the interface I am trying to link to scriptFX.
Can I reference the separate slots in the knob function?inline function onKnS1Control(component, value) { Synth.getAudioSampleProcessor("Script FX1").setFile("{PROJECT_FOLDER}"+inst[value]); }; Content.getComponent("KnS1").setControlCallback(onKnS1Control);
-
@Rognvald said in Help with loading 4x file_players from Ui button/Knob:
Can I reference the separate slots in the knob function?
You create the references in
on init
using the code I posted above.You can use these within the callback.
slot[0].setFile()...
slot[1].setFile()...
etc.
-
@d-healey said in Help with loading 4x file_players from Ui button/Knob:
slot[0].
I added the references and added slot function here* and getting error "Unknown function 'setFile'
inline function onKnS1Control(component, value) { Synth.getAudioSampleProcessor("Script FX1").slot[0].setFile("{PROJECT_FOLDER}"+inst[value]); }; Content.getComponent("KnS1").setControlCallback(onKnS1Control);
-
@Rognvald You already have the references in
on init
you don't need to get the reference in the control callback - in fact you should never create references in control callbacks.// This goes in on init const var ScriptFX1 = Synth.getAudioSampleProcessor("Script FX1"); const slots = []; for (i = 0; i < 4; i++) { slots[i] = ScriptFX1.getAudioFile(i); }
// This goes in the control callback slot[0].setFile()
-
@d-healey Thanks again, this is where I was going wrong. Learning slowly but surly :)
-
@d-healey Sorry i am still battling with this same error "Unknown function 'setFile'..
//-------------------------------------------------------------------------------------------------------- const var ScriptFX1 = Synth.getAudioSampleProcessor("Script FX1"); const slots = []; for (i = 0; i < 4; i++) { slots[i] = ScriptFX1.getAudioFile(i); } //-------------------------------------------------------------------------------------------------------- // Load Audiofiles into pool ---------------------------------------------------------------------------------------------- Engine.loadAudioFilesIntoPool(); //-------------------------------------------------------------------------------------------------------- // PLAYER-1 const vars---------------------------------------------------------------------------------------------- //const var AudioLoopPlayer1 = Synth.getChildSynth("Audio Loop Player1"); const var Random = Content.getComponent("Random1"); const var KnS1 = Content.getComponent("KnS1"); const var Next = Content.getComponent("Next1"); const var Prev = Content.getComponent("Prev1"); //-------------------------------------------------------------------------------------------------------- // PLAYER 2 const vars---------------------------------------------------------------------------------------------- //const var AudioLoopPlayer1 = Synth.getChildSynth("Audio Loop Player1"); const var Random2 = Content.getComponent("Random2"); const var KnS2 = Content.getComponent("KnS2"); const var Next2 = Content.getComponent("Next2"); const var Prev2 = Content.getComponent("Prev2"); //-------------------------------------------------------------------------------------------------------- // PLAYER 1 Array Samples in AudioFiles-Folder---------------------------------------------------------------------- const var inst = ["Wi_trap808-1.wav","Wi_trap808-2.wav","Wi_trap808-3.wav","Wi_trap808-4.wav","Wi_trap808-5.wav","Wi_trap808-6.wav"]; //-------------------------------------------------------------------------------------------------------- // PLAYER 2 Array Samples in AudioFiles-Folder---------------------------------------------------------------------- const var inst2 = ["Wi_Kick-1.wav","Wi_Kick-2.wav","Wi_Kick-3.wav","Wi_Kick-4.wav","Wi_Kick-5.wav","Wi_Kick-6.wav"]; //-------------------------------------------------------------------------------------------------------- //PLAYER 1 Knob1 Sample selection--------------------------------------------------------------------------------- inline function onKnS1Control(component, value) { slot[0].setFile("{PROJECT_FOLDER}"+inst[value]); }; Content.getComponent("KnS1").setControlCallback(onKnS1Control); //-------------------------------------------------------------------------------------------------------- //PLAYER 2 Knob1 Sample selection--------------------------------------------------------------------------------- inline function onKnS2Control(component, value) { slot[1].setFile("{PROJECT_FOLDER}"+inst[value]); }; Content.getComponent("KnS2").setControlCallback(onKnS2Control); //--------------------------------------------------------------------------------------------------------
-
@Rognvald Have you created external audio slots for your script effect node?
-
-
Shouldn't ScriptFX1 module be a part of your button script? I think you're writing to slot[i] but thats not a module. It looks like you're assigning to a slot....but it doesn't know what that slot is for.
-
@Rognvald send me a snippet, I'll take a look in the morning. It's some issue with the references
-
@d-healey The buttons are linked to the knobs which should change the files in the slot. I thought..
Thanks I will create a snippet :) -
@Rognvald said in Help with loading 4x file_players from Ui button/Knob:
+inst[value]);
also, you're grabbing from the same 'inst' array in both knob callbacks. idk if you meant to do that but you do have inst2 commented as being for Player 2.
-
@Chazrox Yes, I am not sure how to call inst more than once.. i keep getting error - Duplicate const var declaration.
// PLAYER 1 Array Samples in AudioFiles-Folder---------------------------------------------------------------------- const var inst[0] = ["Wi_trap808-1.wav","Wi_trap808-2.wav","Wi_trap808-3.wav","Wi_trap808-4.wav","Wi_trap808-5.wav","Wi_trap808-6.wav"]; //-------------------------------------------------------------------------------------------------------- // PLAYER 2 Array Samples in AudioFiles-Folder---------------------------------------------------------------------- const var inst[1] = ["Wi_Kick-1.wav","Wi_Kick-2.wav","Wi_Kick-3.wav","Wi_Kick-4.wav","Wi_Kick-5.wav","Wi_Kick-6.wav"]; //--------------------------------------------------------------------------------------------------------
-
const var instA = []; const var instB = []; or const var inst1 = []; const var inst2 = []; should work fine.
const var inst[1] = [1 , 2, 3, 4, 5];
if you were to call 'inst[1]' anywhere, it will be referencing all '1,2,3,4' as being index [1] of a previous variable named 'const var inst'. I imagine thats not what you have or what you're after.
//in your case those arrays should be const var inst1 = [Kick1, Kick2, Kick3, Kick4]; //and when you want to grab "Kick1" you reference: //Kick1= inst1[0] // and so on... //Kick2 = inst1[1]
**Arrays are zero based so count indexes starting from zero despite your kick name starting with 1.
Im just answering some of your questions for now but like Dave said, there is an issue with the way you're referencing the module slots and file indexes. I'll try to work something out if I have time tonight but if not, Dave said he'll get to it in the morning. Just giving you help and maybe you can figure it out on your own in the mean time.
-
@Chazrox This info really helps me understand tho :) thanks
Here is a snippet with 2x file_players and the controlsHiseSnippet 2985.3oc6a07babaEeWIsxVJwNezzON0fQsGnpMk4BRJRFmVS8YhhkjYHUURFWOxPbAEQ0xEa2ETVrY7L9RmoG80bnyj+L5w7WRmbuWxgzC8TJ.1c4hkeJQaIl1oalIl.38v6g2u26gOUEOZcruO0SSewC53h0zeSiZcbXM2nIh3nsylZ5+biG5POF1fXiqYSYoq4PbcwLs063h78wVZ55y9QBh0WXNM4228f0Q1Hm533pzzNjRpi2kzhvhqsR4GRrs2FYgOfzRg5bk2oN0YCpMsMWwl0HilKp9onSv6iDjMig1Gi7apo+aLfl4K0vJeVyhvbEyTxDuZ9UsZXUf++xdrokoUQqR4JfyooO+VVDF0qFCwv9Z5ysN0pSslzm4DHfCI9jiswhBlZ03RNn5so1VhgnnVsMZRrspDYw7038RkX62rA1u2yXOhEoa8w1w2V1.HlCUCn9LIUuYSndlppWFE0a.pjthJMWfJ8NF0p6QbYwsHzm2vXGGF1qAhiSppR.sZy78+BiMnbJbXqzBcJdaOdgtbjJelL2EjKSlku+hKt38FzGn1Z6UY2spARCLA0NXspG..f6M1OQuk9Z5aQtWlOCbFxCDLp29yMA+VfL.XkSvr0ZaQn0PsbswcscoVJfT.m1k3i9ftvmGY3yY8wOgaOZP8.oH7RYtOf.9PPN9+bm6r7he4hbKP.oOl7DgfhDZWgsMOJKEg2sO+5zLvkEXWJxBH0AQjtOf3vn.WJ0FbEK7sbNg3fWwlK+tl.etiFsBW3o3lhqYCQkcW6K1pZZSPWmC+qXodu6E6GJMA6RotUrQcvdIbGkA6xRoVRRGPPHHjxXmQQ+TE4XQaw4NJFVvOskK0gWH0RAM2COOzol4P4PzXRx2GeNanjKZrG5q3gOanzKZ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