# Sound.lock() returning ERR\_INVALID\_PARAM

**URL:** <https://qa.fmod.com/t/sound-lock-returning-err-invalid-param/20728>\
**Category:** FMOD Engine\
**Tags:** javascript\
**Created:** [October 4, 2023, 2:37am UTC](https://qa.fmod.com/t/sound-lock-returning-err-invalid-param/20728 "2023-10-04T02:37:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashduino101](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/ashduino101/32/5635_2.png) [@ashduino101](https://qa.fmod.com/u/ashduino101)\
**Post date:** [October 4, 2023, 2:37am UTC](https://qa.fmod.com/t/sound-lock-returning-err-invalid-param/20728/1 "2023-10-04T02:37:12Z")

</div>

Hello,

I am trying to lock a sound to use the data in some other code (JavaScript/WASM, HTML5 build of FMOD), but the `Sound.lock()` function always returns 31 (ERR\_INVALID\_PARAM). How do I use this function properly? The documentation does not provide any sort of example or special conditions, so I’m just integrating it as I would any other FMOD function. I have confirmed that using `system.playSound()` works fine, however. This is my code:

```js
// ...
let ptr1 = {};
let ptr2 = {};
let len1 = {};
let len2 = {};
if ((res = sound.lock(0, 128, ptr1, ptr2, len1, len2)) !== 0) { // lock to read 128 bytes (0-128)
  console.error('Could not lock sound for reading', res);
}
// ...

```

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [October 5, 2023, 1:09am UTC](https://qa.fmod.com/t/sound-lock-returning-err-invalid-param/20728/2 "2023-10-05T01:09:48Z")

</div>

Hi,

Thanks for bringing this to our attention. I’ve been able to reproduce the issue on my end, and it appears that `Sound::lock` on HTML5 is improperly implemented. I’ve passed this along to the development team for further investigation.There may be a few ways to work around this issue, depending on your exact use-case - can I get you to expand on what you’re trying to accomplish in more detail?
