# How to override current audio ramp in audio engine v2

**URL:** <https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591>\
**Category:** Questions\
**Tags:** audio\
**Created:** [September 21, 2025, 5:15pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591 "2025-09-21T17:15:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [September 21, 2025, 5:15pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591/1 "2025-09-21T17:15:38Z")

</div>

Hey there,

I am migrating my audio v1 code to the new v2 engine and noticed that using setVolume in quick successions now throws errors:

> **[Babylon.js Playground](https://playground.babylonjs.com/#1BZK59%23116)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

My use case is to toggle a music by clicking a button: click to fade-in, click again to fade-out. This means the second click can happen before the end of the fade-in ramp, thus throwing the error like in the PG.

What is the V2-friendly way to override the ramp in this case?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 22, 2025, 3:11pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591/3 "2025-09-22T15:11:06Z")

</div>

cc @docEdub

---

<div class="post-metadata">

**Author:** ![docEdub](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/docedub/32/14525_2.png) [@docEdub](https://forum.babylonjs.com/u/docEdub)\
**Post date:** [September 23, 2025, 2:11pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591/4 "2025-09-23T14:11:11Z")

</div>

When a ramp has started, there is no way to override it. This is due to a limitation in Firefox. Mozilla has a fix for it that hasn’t made it into the latest Firefox release, yet. See [1752775 - WebAudio: cancelScheduledValues does not cancel in progress curve events](https://bugzilla.mozilla.org/show_bug.cgi?id=1752775).

There is a Codepen that reproduces the issue on Firefox: [https://codepen.io/wemyss/pen/BamjNLW?editors=1011](https://codepen.io/wemyss/pen/BamjNLW?editors=1011). When this works we can remove this limitation in the audio engine.

Until then, you can disable the button until the ramp ends, like in the documentation Playground: [https://playground.babylonjs.com/#HDPCXJ#6](https://playground.babylonjs.com/#HDPCXJ#6), starting at line 69.

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [September 23, 2025, 4:33pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591/5 "2025-09-23T16:33:15Z")

</div>

Alright! I think I will keep using V1 until this is fixed in Firefox and Babylon. Thanks for the info 🙂

---

<div class="post-metadata">

**Author:** ![docEdub](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/docedub/32/14525_2.png) [@docEdub](https://forum.babylonjs.com/u/docEdub)\
**Post date:** [September 23, 2025, 10:28pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591/6 "2025-09-23T22:28:26Z")

</div>

How are you doing the fade in/out in the V1 audio engine?

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [September 24, 2025, 4:13pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591/7 "2025-09-24T16:13:03Z")

</div>

I have been using the `setVolume(targetVolume, duration)` method of v1 `Sound` instances. Calling it when a ramp was not finished simply stopped the ramp and started the new one.

---

<div class="post-metadata">

**Author:** ![docEdub](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/docedub/32/14525_2.png) [@docEdub](https://forum.babylonjs.com/u/docEdub)\
**Post date:** [November 17, 2025, 3:04pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591/8 "2025-11-17T15:04:43Z")

</div>

Firefox supports canceling audio ramps, now, and the latest version of Babylon.js has been updated to cancel old ramps when new ones are created with `setVolume`.

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [November 17, 2025, 3:06pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591/9 "2025-11-17T15:06:43Z")

</div>

That’s one unexpected good news 👌 Thanks a lot! So no more throwing errors on `setVolume`?

---

<div class="post-metadata">

**Author:** ![docEdub](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/docedub/32/14525_2.png) [@docEdub](https://forum.babylonjs.com/u/docEdub)\
**Post date:** [November 17, 2025, 3:58pm UTC](https://forum.babylonjs.com/t/how-to-override-current-audio-ramp-in-audio-engine-v2/60591/10 "2025-11-17T15:58:42Z")

</div>

Yep, no more errors on `setVolume`!
