# Legacy Audio Engine Enabled Not Working

**URL:** <https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059>\
**Category:** Questions\
**Created:** [March 11, 2025, 8:18pm UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059 "2025-03-11T20:18:57Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [March 11, 2025, 8:18pm UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/1 "2025-03-11T20:18:57Z")

</div>

So @docEdub … Here is a small repo to test sound not working:

> **[GitHub - MackeyK24/UMD\_LegacyAudio: Test Legacy Audio](https://github.com/MackeyK24/UMD_LegacyAudio)**
>
> Test Legacy Audio

Viewer.tsx

```auto
 const engine = new Engine(canvas, antialias, { audioEngine: true }, adaptToDeviceRatio);

```

App.tsx

```auto
    const sx = new BABYLON.Sound(
        "loading",
        "https://raw.githubusercontent.com/onekit/gardener/master/public/sounds/loader/loading.ogg",
        scene,
        null,
        { autoplay: true, loop:true }
    );
    console.log("Legacy Sound: ", sx);

```

---

<div class="post-metadata">

**Author:** ![gorenje](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gorenje/32/18894_2.png) [@gorenje](https://forum.babylonjs.com/u/gorenje)\
**Post date:** [March 11, 2025, 10:19pm UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/2 "2025-03-11T22:19:01Z")

</div>

It might well have something to do with the 7.52.2 version since it was [commented](https://forum.babylonjs.com/t/audioenginev2-how-to-attach-sound-to-mesh-in-a-new-way/57027/5) that it was working with the 7.51.3 version. Although that might not be the case since this [example](https://playground.babylonjs.com/#4ZG2UY#37) works perfectly well with 7.52.2.

I’ve tried to take that example and simulate it using my [setup](https://blog.openmindmap.org/3dtwo/testing.1.2.3.testing) (with a `audioEngine: true`) but I just can’t get it to work. In my setup, that example failures while accessing the channels:

```auto
testing.1.2.3.testing:292 Uncaught TypeError: Cannot read properties of undefined (reading 'getChannelData')
    at createRibbonForNote (testing.1.2.3.testing:292:61)

```

What exactly does the playground do to get legacy audio to work?

There must be something else other than just `audioEngine: true`.

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [March 11, 2025, 10:36pm UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/3 "2025-03-11T22:36:56Z")

</div>

> [@gorenje](#):
>
> Although that might not be the case since this [example](https://playground.babylonjs.com/#4ZG2UY#37) works perfectly well with 7.52.2.

For backward compatibility they are enabling the old audio engine in playgrounds that contain `BABYLON.Sound`, even if the engine’s `audioEngine` option is set to `false` like in this playground: [https://playground.babylonjs.com/#QARKUZ#5](https://playground.babylonjs.com/#QARKUZ#5).

[PR 16273](https://github.com/BabylonJS/Babylon.js/pull/16273) should fix the issue. When that PR is merged.

---

<div class="post-metadata">

**Author:** ![gorenje](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gorenje/32/18894_2.png) [@gorenje](https://forum.babylonjs.com/u/gorenje)\
**Post date:** [March 11, 2025, 10:44pm UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/4 "2025-03-11T22:44:32Z")

</div>

> [@MackeyK24](#):
>
> For backward compatibility they are enabling the old audio engine

Exactly but when I do that with `audioEngine: true` in my setup, the old sound does not work. That’s what I can’t get my head around - there is something else - IMHO - going on in the playground to make the “old” audio engine still work.

Is there another external JS lib that needs to be included? Some addon?

Either way, something isn’t working … :-/

---

<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:** [March 12, 2025, 3:59am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/5 "2025-03-12T03:59:06Z")

</div>

Awesome! Thank you. I found the issue and fixed it with [PR 16278](https://github.com/BabylonJS/Babylon.js/pull/16278). The `audioEngine: true` option should work again when that PR gets merged and released.

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [March 12, 2025, 4:09am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/6 "2025-03-12T04:09:15Z")

</div>

You are awesome @docEdub

---

<div class="post-metadata">

**Author:** ![gorenje](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gorenje/32/18894_2.png) [@gorenje](https://forum.babylonjs.com/u/gorenje)\
**Post date:** [March 12, 2025, 7:52am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/7 "2025-03-12T07:52:22Z")

</div>

> [@gorenje](#):
>
> Either way, something isn’t working

As per usual the error was 40cm from the screen …

I just removed this include from my .html and audio began working:

```auto
<script src="https://cdn.babylonjs.com/recast.js"></script>

```

If I include that and use `audioEngine: true`, nothing happens - audio doesn’t work. Removing the recast.js and using `audioEngine: true` works as expected.

Sorry for the confusion!

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [March 12, 2025, 4:23pm UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/8 "2025-03-12T16:23:23Z")

</div>

> [@gorenje](#):
>
> If I include that and use `audioEngine: true`, nothing happens - audio doesn’t work. Removing the recast.js and using `audioEngine: true` works as expected.

I tried to remove recast.js but I STILL dont hear any audio (Spatial or Regular). Hopefully the next PR fixes it for me 🙂

---

<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:** [March 12, 2025, 5:20pm UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/9 "2025-03-12T17:20:34Z")

</div>

This should be fixed with Babylon.js version 7.52.3, available now.

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [March 13, 2025, 1:52am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/10 "2025-03-13T01:52:27Z")

</div>

How do unlock audio now that `BABYLON.Engine.audioEngine.unlock` is no more ?

---

<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:** [March 13, 2025, 2:55am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/11 "2025-03-13T02:55:39Z")

</div>

Are you trying to unlock the old legacy audio engine, or a new one you created? Maybe post some example code of what you’re trying to do?

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [March 13, 2025, 5:47am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/12 "2025-03-13T05:47:02Z")

</div>

Unlock the old way… We used to do this:

```auto
    if (!BABYLON.Engine.audioEngine.unlocked)
    {
        BABYLON.Engine.audioEngine.unlock();
    }

```

Says deprecated and use Audio Engine 2. So wondering how to unlock when we want to use legacy audio engine

---

<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:** [March 13, 2025, 6:09am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/13 "2025-03-13T06:09:45Z")

</div>

> [@MackeyK24](#):
>
> Unlock the old way… We used to do this:
> 
> ```auto
> if (!BABYLON.Engine.audioEngine.unlocked)
> {
> BABYLON.Engine.audioEngine.unlock();
> }
> 
> ```

That should work if you’re using the old audio engine.

If you’re trying to unlock the new audio engine the same way, then that won’t work. You’ll have to call `unlock` on the new audio engine instance returned by `CreateAudioEngineAsync`.

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [March 13, 2025, 6:12am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/14 "2025-03-13T06:12:53Z")

</div>

Yep,I already do that

 ![Screenshot 2025-03-12 at 8.11.53 PM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/8/c80537940fce57783820da23942d6ae428f8bfeb.png)

So your saying keep using the `BABYLON.Engine.audioEngine.unlock()` for legacy audio ?

---

<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:** [March 13, 2025, 6:15am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/15 "2025-03-13T06:15:54Z")

</div>

> [@MackeyK24](#):
>
> So your saying keep using the `BABYLON.Engine.audioEngine.unlock()` for legacy audio ?

Ya, you should be able to use the old audio engine exactly the same way it worked before as long as you turn it on with the `audioEngine: true` option in the graphics engine constructor.

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [March 13, 2025, 6:18am UTC](https://forum.babylonjs.com/t/legacy-audio-engine-enabled-not-working/57059/16 "2025-03-13T06:18:56Z")

</div>

Thanks 🙂
