Hello, this script is supposed to extract points from automation track but doesn’t work because it seems that the automationTrack doesn’t have any “points” property, so volumeTrack.points returns null.
How can refer the points in the automationTrack in js with FMOD 2.03 ?
Thanks!
studio.menu.addMenuItem({
name: “Export Volume Curve to CSV”,
isEnabled: function() { var eventt = studio.window.browserCurrent(); return eventt && eventt.isOfExactType(“Event”); },
execute: function () {
const event = studio.window.browserCurrent(); // Get the currently selected event
if (!event) {
studio.system.message("Please select an event to export its volume curve.");
return;
}
var tracks = event.masterTrack.automationTracks;
var volumeTrack = tracks[0];
let points = volumeTrack.points;
if (points == null) {
studio.system.message("No automation points found in the volume track.");
return;
}
if (points.length == 0) {
studio.system.message("No automation points found in the volume track.");
return;
}
// Prepare CSV content
let csvContent = "Time (ms),Volume (dB)\n";
for (x = 0; x < points.length; x++){
csvContent += points[x].time + "," + points[x].value + "\n";
};
// Save CSV file
const filePath = studio.system.getFile("C:/extract.csv");
if (filePath) {
studio.system.writeFile(filePath, csvContent);
//studio.system.message("Volume curve exported successfully to: " + filePath);
} else {
studio.system.message("Export canceled.");
}
}
});