# Raw data FMOD\_OPENMEMORY

**URL:** <https://qa.fmod.com/t/raw-data-fmod-openmemory/22054>\
**Category:** FMOD Engine\
**Created:** [September 2, 2024, 6:12pm UTC](https://qa.fmod.com/t/raw-data-fmod-openmemory/22054 "2024-09-02T18:12:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpadam450](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@dpadam450](https://qa.fmod.com/u/dpadam450)\
**Post date:** [September 2, 2024, 6:12pm UTC](https://qa.fmod.com/t/raw-data-fmod-openmemory/22054/1 "2024-09-02T18:12:05Z")

</div>

I have a raw buffer of floating point samples read in from a .txt file. If I import raw into Audacity, it plays back just fine.  
I want to push it into FMOD however and play it back.

I have tried various things but either the DLL crashes or I try other parameters and get ERR\_MEMORY. data here is a pointer to my raw floating point buffer and I’m only passing in half the size in case it was a memory buffer overflow. Very confused why this won’t work.

FMOD\_CREATESOUNDEXINFO creationInfo;  
creationInfo.cbsize = sizeof(FMOD\_CREATESOUNDEXINFO);  
creationInfo.length = numSamples/2;  
creationInfo.format = FMOD\_SOUND\_FORMAT\_PCMFLOAT;  
creationInfo.numchannels = 1;  
creationInfo.defaultfrequency = 48000/2;  
FMOD\_RESULT result = fmodSystem-\>createSound(data, FMOD\_OPENMEMORY\_POINT, &creationInfo, &m\_fmodSound);  
if (result != FMOD\_OK)  
{  
FMOD::System\* fmodSystem = SoundManager::GetSingleton()-\>GetFMODSystem();  
fmodSystem-\>playSound(this-\>m\_fmodSound, NULL, false, &m\_fmodChannel);  
}

---

<div class="post-metadata">

**Author:** ![dpadam450](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@dpadam450](https://qa.fmod.com/u/dpadam450)\
**Post date:** [September 2, 2024, 7:37pm UTC](https://qa.fmod.com/t/raw-data-fmod-openmemory/22054/2 "2024-09-02T19:37:42Z")

</div>

Memset the structure fixed my issues. And then I figured out the parameters needed.

```auto
FMOD_CREATESOUNDEXINFO creationInfo;
	memset(&creationInfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
	creationInfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
	creationInfo.length = numSamples*sizeof(float);
	creationInfo.format = FMOD_SOUND_FORMAT_PCMFLOAT;
	creationInfo.numchannels = 1;
	creationInfo.channelorder = FMOD_CHANNELORDER_ALLMONO;
	creationInfo.defaultfrequency = 48000;
	//creationInfo.suggestedsoundtype = FMOD_SOUND_TYPE_RAW;
	FMOD_RESULT result = fmodSystem->createSound(data, FMOD_OPENRAW | FMOD_OPENMEMORY | FMOD_DEFAULT, &creationInfo, &m_fmodSound);
	if (result == FMOD_OK)
	{
		this->m_isLoaded = true;
		SoundManager::GetSingleton()->PlayControlledSound( this, true );
	}

```

---

<div class="post-metadata">

**Author:** ![dpadam450](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@dpadam450](https://qa.fmod.com/u/dpadam450)\
**Post date:** [September 2, 2024, 10:39pm UTC](https://qa.fmod.com/t/raw-data-fmod-openmemory/22054/3 "2024-09-02T22:39:43Z")

</div>

So I have the same char\* buffer that holds float data. Its 38 seconds of data, but the audio plays back in 35 seconds. SampleRate is 48000. I provide 1,851,392 floats.  
1851392/48000 = 38.57 seconds.

Anyone know what causes this? FMOD internal timer issue? Calling FMOD::Update too often?

---

<div class="post-metadata">

**Author:** ![dpadam450](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@dpadam450](https://qa.fmod.com/u/dpadam450)\
**Post date:** [September 3, 2024, 3:56pm UTC](https://qa.fmod.com/t/raw-data-fmod-openmemory/22054/4 "2024-09-03T15:56:52Z")

</div>

^ Also solved. This was incorrect. My internal timer had some issues and the audio playback when properly timed worked just fine.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 3, 2024, 10:41pm UTC](https://qa.fmod.com/t/raw-data-fmod-openmemory/22054/5 "2024-09-03T22:41:03Z")

</div>

Thank you for all the info and for sharing the solution.
