FMOD_CREATESAMPLE vs FMOD_CREATECOMPRESSEDSAMPLE

Hello, it’s me again! Haha

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

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.

FMOD_CREATECOMPRESSEDSAMPLE only supports a few formats. See 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 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

1 Like

Thanks :slight_smile:

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.

Once = once at a time or simultaneously/concurrently

Now I understand :slight_smile: Thanks~