Using addFadeOutCurve in a script causes silent sample

I am creating a script that automatically imports samples and sets up AutoPitch on them and now i need to set up fades for the samples, but using the addFadeOutCurve function causes that sound to become silent and not play. I can get the sample to play again by removing the fade and manually adding it again using the Studio. Is this a bug or am i not using the function correctly?
My code looks like this:
var audio = track.addSound(event.parameters[0], “SingleSound”, 0, 6000);
audio.audioFile = studio.project.importAudioFile(p2samples + “/” + bank + “_02.wav”);
audio.addFadeOutCurve(3500, 0.25);

Okay, by doing a diff between two event xml files i’ve determined that the addFadeOutCurve does not add the value properties to the automation points.

Adding them manually by setting curve.startPoint.value and curve.endPoint.value makes the sample play again normally.

As you’ve pointed out, it seems that using the addFadeOutCurve() function does not correctly add the automation points needed for the fades. I’ve raised this as a bug and will take a look at it for a future release. In the meantime, fades will either need to be manually created or you can manually jiggle them slightly for the automation points to be created.

1 Like