Finding all used AudioFiles in all Events

Hi,

I’m trying to figure out how to find out which AudioFiles are referenced in an Event. I can’t really find out how they are related to each other.

I got all events the following way:

var allEvents = studio.project.model.Event.findInstances();

But how to get a list of all AudioFiles they reference?

Thanks.

This requires to drill down from the event to the group tracks to the instruments. Use this as a starter function, it only returns single instruments and doesn’t say which parameter sheet they are found on. Finding audio files in scatterer/multi instruments requires you to drill down further, but use the dump() function on them to find out where they are stored.

allEvents.forEach(function(event) {
  eventPath = event.getPath();
  console.log(eventPath + " assets:");
  allTracks = event.groupTracks;
  allTracks.forEach(function(track) {
    allInstruments = track.modules;
    allInstruments.forEach(function(instrument) {
      if(instrument.audioFile !== undefined) {
        console.log("    " + instrument.audioFile.assetPath);
      }
    });
  });
});