0
0

Hello everybody,

Thanks ahead for all your help. I hope some of these questions do not seem too basic. I am currently working with FMOD Ex for iPhone Dev v4.25.07 and I want to make sure my app(s) are tuned as best as possible.

[list:2i2x9lza]
– Memory management: My app loads sounds that are chosen by a user, one at a time, into the same variable set (&sound, &channel, &channelGroup, &dspwhatever). When a new sound is through createStream / createSound, should I be releasing all the variables and "creating" them again, or is one set of creation calls for the channel, channelGroup, dsps, in the very beginning of the app good enough? Is this also true for createStream/creatSound, or should I release the previous sound before creating it again?

  • How can I determine what frequency a file is encoded at (for example, I have some WAV and OGG files encoded at 22khz, 16bit, mono)?

  • Is there a way to set the output frequency for offline decoding? As mentioned, I have OGG files that were created from 22khz, 16bit, mono, at OGG compression quality 0, but when I offline decode them, I still need to read them with a exinfo.defaultfrequency= 44100.

  • In the same vein, is there a way to set the output frequency for all of FMOD (without changing the frequency of each sound which would sound lower or higher)? Would doing so help performance if my sounds are 22050hz and I set the sound output to 22050hz? Would it hurt performance if my sounds were at 22050hz and they had to be resampled on the fly to 44100hz?

  • I’ve tried the following: system->setSoftwareFormat(22050, FMOD_SOUND_FORMAT_PCM16, 0, 0, FMOD_DSP_RESAMPLER_LINEAR);, but my app crashes on this call.

  • When I createStream a RAW or WAV file which is a song, I often get stuttering during playback at random times. I’ve only started playing around with setStreamBufferSize. Would this help? What would be the optimal parameters for a RAW/WAV file?

  • Would setStreamBufferSize also help performance for playback of OGG files?

  • I’ve tried to play around with setDSPBufferSize, but the app quits on me after setting it. Does it work on iPhone? What are the limits?
    [/list:u:2i2x9lza]

Thanks again,

  • George
  • You must to post comments
0
0

One of the best part about posting your questions is that sometimes you find out the answer yourself right after posting! I’ve got a couple of additions:

[list:2259a2yn]
– I’ve found that [b:2259a2yn]setSoftwareFormat[/b:2259a2yn] and [b:2259a2yn]setDSPBufferSize[/b:2259a2yn] need to be called [b:2259a2yn][i:2259a2yn]before[/i:2259a2yn][/b:2259a2yn] system->init:

  • Should [b:2259a2yn]setStreamBufferSize[/b:2259a2yn] be called before or after system->init? The program runs in both cases, but I can’t really guage whether or not it has any effect.
    [/list:u:2259a2yn]

Thanks!

  • George

[/i]

  • You must to post comments
0
0

Hi george,

[quote:3c5l30ph]When a new sound is through createStream / createSound, should I be releasing all the variables and "creating" them again, or is one set of creation calls for the channel, channelGroup, dsps, in the very beginning of the app good enough? Is this also true for createStream/creatSound, or should I release the previous sound before creating it again?[/quote:3c5l30ph]
This really depends on your application. Channels cannot be released, but for the others you can create instances at the start if you’re going to have a small fixed number of sounds but for a more complex application you should be loading and unloading data at run time.

[quote:3c5l30ph]- How can I determine what frequency a file is encoded at (for example, I have some WAV and OGG files encoded at 22khz, 16bit, mono)? [/quote:3c5l30ph]Sound::getFormat will tell you bits and number of channels
Sound::getDefaults will give you the frequency

[quote:3c5l30ph]- Is there a way to set the output frequency for offline decoding? As mentioned, I have OGG files that were created from 22khz, 16bit, mono, at OGG compression quality 0, but when I offline decode them, I still need to read them with a exinfo.defaultfrequency= 44100[/quote:3c5l30ph]
Changing the frequency would require resampling. You can try using FMOD_DSP_RESAMPLER.

[quote:3c5l30ph]- Would setStreamBufferSize also help performance for playback of OGG files? [/quote:3c5l30ph]
Ogg files take a lot of CPU to decode regardless of the stream buffer size.

-Pete

  • You must to post comments
0
0

Thanks for the information Peter,

I have a couple of additional questions:

  • Does setSoftwareFormat change the frequency for both playing and offline decoding?

  • Is there a way to change the overall priority of the FMOD threads?

  • Any ideas on what could be causing the stuttering of playback of RAW and WAV formatted song files and how I could fix it?

Thanks again!

  • George
  • You must to post comments
0
0

[quote:n976zvhj]- Does setSoftwareFormat change the frequency for both playing and offline decoding?[/quote:n976zvhj]
No setSoftwareFormat will add a resampler in the DSP network, the data you get access to is the raw data.

[quote:n976zvhj]- Is there a way to change the overall priority of the FMOD threads? [/quote:n976zvhj]
The geometry thread period can be specified in the advanced settings struct. Otherwise you need source access to change the thread priorities.

[quote:n976zvhj]Any ideas on what could be causing the stuttering of playback of RAW and WAV formatted song files and how I could fix it[/quote:n976zvhj]
There are a number of things which can cause stuttering. Some things you can do to diagnose the problem are:

Make sure System::getCPUUsage is less that 100%. If it over 100% then there is just too much stuff going on and you need to reduce the load on the CPU.

Try loading the sound files in a different media player and make sure that the files themselves don’t contain stuttering. If they do contain stuttering it would suggest that there is a problem with the offline decoding.

Try loading the sounds as samples instead of streams and see if they still stutter. If so, that would suggest the stuttering is caused by disk access.

-Pete

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.