# FMOD\_CREATESAMPLE vs FMOD\_CREATECOMPRESSEDSAMPLE

**URL:** <https://qa.fmod.com/t/fmod-createsample-vs-fmod-createcompressedsample/13147>\
**Category:** FMOD Engine\
**Created:** [April 30, 2017, 10:13am UTC](https://qa.fmod.com/t/fmod-createsample-vs-fmod-createcompressedsample/13147 "2017-04-30T10:13:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [April 30, 2017, 10:13am UTC](https://qa.fmod.com/t/fmod-createsample-vs-fmod-createcompressedsample/13147/1 "2017-04-30T10:13:19Z")

</div>

Hello, it’s me again! Haha

Sorry for my repeated asking here but this is the last time 🙂

I tried FMOD\_System\_CreateSound() with both FMOD\_DEFAULT and FMOD\_CREATESAMPLE for my audio player application but loading took too long!

So I also tried with FMOD\_CREATESTREAM and FMOD\_CREATECOMPRESSEDSAMPLE, and really worked well.

Short loading time, fast enough for playback, no problem.

So I’m wondering if those latter options would be okay for me.

My application

a. supports MP3, OGG, AAC, WAV types only.

b. opens only LOCAL files in hard drives.

c. plays TWO audios MAX at the same time. (like a music player)

d. opens 1sec to 5min long audio files most of the time, and rarely 10mins long at best.

e. uses a little of built-in DSPs. (ex. FMOD\_DSP\_TYPE\_PITCHSHIFT)

f. uses  
FMOD\_Channel\_SetVolume()  
FMOD\_Channel\_SetPosition(), FMOD\_Channel\_GetPosition(),  
FMOD\_Channel\_SetPaused(), FMOD\_Channel\_GetPaused(),  
FMOD\_Sound\_GetLength()  
functions.

g. may sometimes open files with FMOD\_LOOP\_NORMAL option for looping.

Are there any limitations or disadvantages for this app with FMOD\_CREATESTREAM or FMOD\_CREATECOMPRESSEDSAMPLE?

One more question.

Are there any benefits to limiting max channel with the lowest number if possible when calling FMOD\_System\_Init()?

Thanks.

---

<div class="post-metadata">

**Author:** ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)\
**Post date:** [May 1, 2017, 1:27am UTC](https://qa.fmod.com/t/fmod-createsample-vs-fmod-createcompressedsample/13147/2 "2017-05-01T01:27:36Z")

</div>

FMOD\_CREATECOMPRESSEDSAMPLE only supports a few formats. See [https://www.fmod.org/docs/content/generated/FMOD\_MODE.html](https://www.fmod.org/docs/content/generated/FMOD_MODE.html)

> FMOD\_CREATECOMPRESSEDSAMPLE  
> Load MP2/MP3/IMAADPCM/Vorbis/AT9 or XMA into memory and leave it compressed. Vorbis/AT9 encoding only supported in the FSB file format. During playback the FMOD software mixer will decode it in realtime as a ‘compressed sample’. Overrides FMOD\_CREATESAMPLE. If the sound data is not one of the supported formats, it will behave as if it was created with FMOD\_CREATESAMPLE and decode the sound into PCM.

Those formats are only reliably supported through the FSB container format. loose MP3 files are also supported.

Please check [https://www.fmod.org/docs/#content/generated/overview/terminology.html](https://www.fmod.org/docs/#content/generated/overview/terminology.html) about streams vs samples vs compressedsamples.

FMOD\_System\_Init channels should not be limited, set them as high as the number of voices you will ever want to play at once. 1024 is as safe a number as any.

For performance, you would only change the number of software channels with [https://www.fmod.org/docs/#content/generated/FMOD\_System\_SetSoftwareChannels.html](https://www.fmod.org/docs/#content/generated/FMOD_System_SetSoftwareChannels.html)

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [May 1, 2017, 12:37pm UTC](https://qa.fmod.com/t/fmod-createsample-vs-fmod-createcompressedsample/13147/3 "2017-05-01T12:37:48Z")

</div>

> [@](#):
>
> FMOD\_CREATECOMPRESSEDSAMPLE only supports a few formats. See [https://www.fmod.org/docs/content/generated/FMOD\_MODE.html](https://www.fmod.org/docs/content/generated/FMOD_MODE.html)
> 
> > FMOD\_CREATECOMPRESSEDSAMPLE  
> > Load MP2/MP3/IMAADPCM/Vorbis/AT9 or XMA into memory and leave it compressed. Vorbis/AT9 encoding only supported in the FSB file format. During playback the FMOD software mixer will decode it in realtime as a ‘compressed sample’. Overrides FMOD\_CREATESAMPLE. If the sound data is not one of the supported formats, it will behave as if it was created with FMOD\_CREATESAMPLE and decode the sound into PCM.
> 
> Those formats are only reliably supported through the FSB container format. loose MP3 files are also supported.
> 
> Please check [https://www.fmod.org/docs/#content/generated/overview/terminology.html](https://www.fmod.org/docs/#content/generated/overview/terminology.html) about streams vs samples vs compressedsamples.
> 
> FMOD\_System\_Init channels should not be limited, set them as high as the number of voices you will ever want to play at once. 1024 is as safe a number as any.
> 
> For performance, you would only change the number of software channels with [https://www.fmod.org/docs/#content/generated/FMOD\_System\_SetSoftwareChannels.html](https://www.fmod.org/docs/#content/generated/FMOD_System_SetSoftwareChannels.html)

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [May 2, 2017, 12:22pm UTC](https://qa.fmod.com/t/fmod-createsample-vs-fmod-createcompressedsample/13147/4 "2017-05-02T12:22:11Z")

</div>

I read the explanations and it made all clear but one thing.  
It says,  
“A streaming sound can only be played once, not multiple times due to it only having 1 file handle per stream and 1 ringbuffer to decode into.”  
But I don’t understand what ‘being played once’ means here…  
As I said above, I’m making an audio player with FMOD engine,  
and never had any problem when replaying the same song again.

I tried all these three methods for looping.  
a. starting FMOD\_System\_CreateSound() with FMOD\_LOOP\_NORMAL opition.  
b. just calling FMOD\_System\_CreateSound() again when finished.  
c. setting the starting point with FMOD\_Channel\_SetPosition().  
This way, I could play the same audio again and again even with FMOD\_CREATESTREAM.

---

<div class="post-metadata">

**Author:** ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)\
**Post date:** [May 2, 2017, 1:23pm UTC](https://qa.fmod.com/t/fmod-createsample-vs-fmod-createcompressedsample/13147/5 "2017-05-02T13:23:14Z")

</div>

Once = once at a time or simultaneously/concurrently

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [May 3, 2017, 12:00pm UTC](https://qa.fmod.com/t/fmod-createsample-vs-fmod-createcompressedsample/13147/6 "2017-05-03T12:00:36Z")

</div>

Now I understand 🙂 Thanks~
