Hi, I’d like to speed up event creation with a script that will make a parameter sheet event, and load samples into single instruments inside each slot of a single parameter, so it will look something like this (I created this one manually in Studio):
I have 49 note samples from C4 to C8 that I want to go into each parameter value 0-49. The idea is C4 will be parameter value 0, C#4 will be value 1 etc. (The actual files are named Keys - Soft n sweet_C4_78.wav
etc)
My attempt at the set up:
// Define the base path for audio files
var basePath = "C:\\em-sounds\\";
// Define the event name and parameter name
var eventName = "SoftKey";
var parameterName = "Note";
// Create a new event
var newEvent = studio.project.create("Event");
newEvent.name = eventName;
// Create a new parameter
var newParameter = newEvent.addGameParameter({
name: parameterName,
type: studio.project.parameterType.User,
min: 0,
max: 49
});
// List of musical notes from C4 to C8
var notes = [
"C4", "C#4", "D4", "D#4", "E4", "F4", "F#4", "G4", "G#4", "A4", "A#4", "B4",
"C5", "C#5", "D5", "D#5", "E5", "F5", "F#5", "G5", "G#5", "A5", "A#5", "B5",
"C6", "C#6", "D6", "D#6", "E6", "F6", "F#6", "G6", "G#6", "A6", "A#6", "B6",
"C7", "C#7", "D7", "D#7", "E7", "F7", "F#7", "G7", "G#7", "A7", "A#7", "B7",
"C8"
];
// Create instruments for each note
for (var i = 0; i < notes.length; i++) {
var note = notes[i];
// Construct the sample filename
var sampleFilename = "Keys - Soft n sweet_" + note + "_78.wav";
///No idea how to actually create the instrument in the parameter slot :)
}
// Save the project
studio.project.save();
Hopefully I have the framework more or less right, but as you can see I’m missing the most important part - the actual instrument creation / adding to each parameter slot. Any help would be massively appreciated, thanks.