# What does lock() really reads

**URL:** <https://qa.fmod.com/t/what-does-lock-really-reads/21816>\
**Category:** FMOD Engine\
**Created:** [June 29, 2024, 1:58am UTC](https://qa.fmod.com/t/what-does-lock-really-reads/21816 "2024-06-29T01:58:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nayeem2021](https://avatars.discourse-cdn.com/v4/letter/n/a9adbd/32.png) [@nayeem2021](https://qa.fmod.com/u/nayeem2021)\
**Post date:** [June 29, 2024, 1:58am UTC](https://qa.fmod.com/t/what-does-lock-really-reads/21816/1 "2024-06-29T01:58:19Z")

</div>

Imagine I have two types of audio file.  
i) WAV having PCM-16 bit data  
ii) MP3 file of 128 kbps  
If I do:  
system-\>createSound() for the (i) WAV file and read data using lock() I get PCM data.

But if I use system-\>createSound() for the (ii)MP3 file and read data using lock() what would I get?

I learnt that createSound() first decodes the audio file after loading. After decoding in which format does it keeps the decoded data and in which format?  
If the format is PCM then what would be the bitrate?  
And importantly will lock() read the decoded data or the compressed data of mp3 file

---

<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:** [July 3, 2024, 3:33am UTC](https://qa.fmod.com/t/what-does-lock-really-reads/21816/2 "2024-07-03T03:33:15Z")

</div>

The format a sound’s data is stored in, and subsequently what format is retrieved by `lock()`, will depend on the [`FMOD_MODE`](https://www.fmod.com/docs/2.02/api/core-api-common.html#fmod_mode) used to create the sound - either PCM data, if the mode decompresses the source audio, or compressed data if a mode like [`FMOD_CREATECOMPRESSEDSAMPLE`](https://www.fmod.com/docs/2.02/api/core-api-common.html#fmod_createcompressedsample) is used.

> [@nayeem2021](#):
>
> If the format is PCM then what would be the bitrate?

A sound’s bit rate/sample rate will depend on the asset used. You can get format info on the sound with [`Sound::getFormat`](https://www.fmod.com/docs/2.02/api/core-api-sound.html#sound_getformat). However, upon data from the sound being played into the FMOD system, it will be resampled to match the [sample rate of the FMOD system’s mixer](https://www.fmod.com/docs/2.02/api/core-api-system.html#system_setsoftwareformat), which by default is 48kHz, or 24kHz on lower-spec platforms like mobile.
