# Using addFadeOutCurve in a script causes silent sample

**URL:** <https://qa.fmod.com/t/using-addfadeoutcurve-in-a-script-causes-silent-sample/15148>\
**Category:** FMOD Studio\
**Created:** [October 19, 2019, 1:31pm UTC](https://qa.fmod.com/t/using-addfadeoutcurve-in-a-script-causes-silent-sample/15148 "2019-10-19T13:31:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zi\_9](https://avatars.discourse-cdn.com/v4/letter/z/7ab992/32.png) [@Zi\_9](https://qa.fmod.com/u/Zi_9)\
**Post date:** [October 19, 2019, 1:31pm UTC](https://qa.fmod.com/t/using-addfadeoutcurve-in-a-script-causes-silent-sample/15148/1 "2019-10-19T13:31:02Z")

</div>

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);

---

<div class="post-metadata">

**Author:** ![Zi\_9](https://avatars.discourse-cdn.com/v4/letter/z/7ab992/32.png) [@Zi\_9](https://qa.fmod.com/u/Zi_9)\
**Post date:** [October 22, 2019, 9:21am UTC](https://qa.fmod.com/t/using-addfadeoutcurve-in-a-script-causes-silent-sample/15148/2 "2019-10-22T09:21:16Z")

</div>

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.

 ![WinMergeU_NGNOHBcwwT](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/1X/5ad7284c80cc9502de70f7acc930ef0e4c85ad2d.png)

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

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [October 23, 2019, 1:04am UTC](https://qa.fmod.com/t/using-addfadeoutcurve-in-a-script-causes-silent-sample/15148/3 "2019-10-23T01:04:36Z")

</div>

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.
