How can I make a single instrument loop through a script?I have already written this, but it has no effect. Can we only use var region=markerTrack. addRegion (0, asset length, “loop”, studio. project. regionLoopMode. Looping);Do you want to loop like this, but I found looping=false on sound again
asset = getAsset(filepaths[0], o.Asset);
var sound = track.addSound(event.timeline, ‘SingleSound’, 0, 10);
sound.audioFile = asset;
sound.length = asset.length;
sound.name = o.Event;
sound.looping = true; // This has no effect
Hi,
What version of FMOD Studio are you using?
Would it be possible to see the whole script? I was able to get an instrument looping so I may be able to advise where we went differently.
version: FMOD Studio 2.02.16
studio.menu.addMenuItem({
name: “ZXM\Test Loop”,
execute: function () {
var event = studio.project.create(“Event”);
event.name = “TestLoop”;
var track = event.addGroupTrack();
var asset = studio.project.importAudioFile(‘F:/sound/test.wav’);
var singleInstrument = track.addSound(event.timeline, ‘SingleSound’, 0, asset.length);
singleInstrument.audioFile = asset;
singleInstrument.name = ‘test’;
singleInstrument.looping = true;
}
});
Similar to this, it has no effect.
Hi,
Thank you for providing the code.
To confirm you are trying to enable looping on the instrument: FMOD Studio | Working with Instruments - Looping Instruments.
Using the provided code it worked for me. Is the script creating the event as well as the instrument the only issue is it is not looping?