# Can I read audio sample data somehow?

**URL:** <https://qa.fmod.com/t/can-i-read-audio-sample-data-somehow/19976>\
**Category:** Unreal Engine\
**Tags:** ue4, cpp\
**Created:** [March 16, 2023, 11:40am UTC](https://qa.fmod.com/t/can-i-read-audio-sample-data-somehow/19976 "2023-03-16T11:40:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nukenyks](https://avatars.discourse-cdn.com/v4/letter/n/a587f6/32.png) [@nukenyks](https://qa.fmod.com/u/nukenyks)\
**Post date:** [March 16, 2023, 11:40am UTC](https://qa.fmod.com/t/can-i-read-audio-sample-data-somehow/19976/1 "2023-03-16T11:40:51Z")

</div>

I am using UE5 and I need audio sample data as something like Array \< uint8 \>. Is there any way to get this kind of data in via fmod event? I couldn’t find any kind of Read function.

I don’t need this data in runtime. I only need it in editor btw.

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [March 16, 2023, 10:56pm UTC](https://qa.fmod.com/t/can-i-read-audio-sample-data-somehow/19976/2 "2023-03-16T22:56:08Z")

</div>

You can get the audio sample data from a sound using [`Sound::readData`](https://fmod.com/docs/2.02/api/core-api-sound.html#sound_readdata). We have an example of how to use this method here: [Reading Sound Data](https://fmod.com/docs/2.02/api/glossary.html#reading-sound-data)  
Getting the sound from an event requires an additional step- the sound data only becomes available when an event needs to play it, so you will need to play the event and use an [Event Callback](https://fmod.com/docs/2.02/api/studio-guide.html#event-callbacks) to read the sound data when it begins playing:

```ruby
FMOD_RESULT F_CALLBACK Callback(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, FMOD_STUDIO_EVENTINSTANCE* event, void* parameters)
{
    switch(type)
    {
        case FMOD_STUDIO_EVENT_CALLBACK_SOUND_PLAYED:
        {
            FMOD::Sound* sound = (FMOD::Sound*)parameters;
            unsigned int length;
            char* buffer;

            sound->getLength(&length, FMOD_TIMEUNIT_RAWBYTES);
            buffer = new char[length];
            sound->readData(buffer, length, nullptr);

            // Do something with the data

            delete[] buffer;
            break;
        }
    }
    return FMOD_OK;
}

```
