0
0

I’m trying to get streaming music working for the 3ds.

At the moment it just uses mp3 however that’s too slow (as I don’t believe the 3ds runs them in hardware). The stream sample which comes with FMOD uses an fsb file which looks like it’s encoded to use the GameCube ADPCM file format.

My understanding is that ADPCM is the way to go on the 3ds as it runs in hardware (although the files are pretty big) however I have a couple of questions.

  1. ADPCM is single channel and I want stereo music. Does the fsb tool encode both channels and when I play this file will it automatically create 2 voices for playback.
  2. The Gamecube ADPCM is similar but not exactly the same. Is this an issue or nothing to worry about?

btw – I’m also going to have to do real time stitching with these files (it worked with the mp3 files after a bit of playing around). Is there anything I should know here too?

Thanks for your help.

  • You must to post comments
0
0

Sorry I thought you meant the event system API when talking about designer not the tool. I guess there’s no downside from having loads of fsb files rather than a few which then have a load of sub sounds.

I think it works.

However regarding the stitching. I use a stream created this way for the sound containing all the stiched subsounds.

[code:228ozexo]
FMOD_CREATESOUNDEXINFO exinfo;
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.decodebuffersize = 44100; // 352800; // 44100
exinfo.defaultfrequency = 44100;
exinfo.numsubsounds = NumMusicBuffers;
exinfo.numchannels = 2;
exinfo.format = FMOD_SOUND_FORMAT_PCM16;
result = system->createStream( 0, FMOD_LOOP_NORMAL | flags | FMOD_OPENUSER, &exinfo, &music);
FMOD_ERRCHECK(result);
[/code:228ozexo]

Which if I change to exinfo.format = FMOD_SOUND_FORMAT_GCADPCM; asserts.

So should I just leave it as it is?

  • You must to post comments
0
0

I’ve been doing some investigation and it appears stitching is a bit tricky for GCADPCM due to the associated coefficients required for decoding. I’m going to have to recommend using either PCM to still use FMOD_HARDWARE or perhaps ADPCM with FMOD_SOFTWARE.

Also to amend my earlier comments about using multiple FSBs or a single FSB, when stitching with a single FSB the logic is a lot simpler. You simply put all your sounds in one FSB and use Sound::setSubSoundSentence on that.

  • You must to post comments
0
0

I’m a bit low on memory so not sure if I could use PCM and low on cpu so probably not ADPCM either. I’ll try everyway and see what’s best.

To be honest I only got mp3 working on the iphone with toying around with it and in that particular instance I think it required accurate time and the right buffer size.

Thanks for your help.

  • You must to post comments
0
0

Wav files are okay, I should have been more specific, both GCADPCM and PCM (wavs) are supported as FMOD_HARDWARE but generally people use just GCADPCM for everything as there is no extra cost for using it.

I’m not 100% following what you are doing here. To recap, FSBank Tool, or FMOD Designer will generate FSBs with multiple sounds in them. Each one of those sounds can be mono, stereo or multichannel, so if you encode 2 stereo and 1 mono wav files you will get an FSB containing 3 sounds. Internally we handle compression and playback of the stereo cases.

For stitching it’s fine to either use multiple subsounds or multiple FSBs.

  • You must to post comments
0
0

Yes, MP3 will be too CPU intensive for 3DS, you need GCADPCM. The GCADPCM format is the only hardware decoded format on this platform so I recommend you use it for everything. Note this is different to the ADPCM format we support, you must use GCADPCM to be able to load the audio as FMOD_HARDWARE.

The FSBank tool or FMOD Designer will take care of multichannel for you, it is as you guessed, stereo data will consume 2 hardware voices.

When you do stitching with hardware voices, we do our best to play them end to end but this will not be sample accurate.

  • You must to post comments
0
0

Thnaks Mathew,

Just a couple more follow-up questions.

When you say everything, I have wav files for sound effects. Should I use it for them too?

The tool looks to add two channels but when I create the sound it looks to just use one (it’s half the size from the debug), I’m playing it using Fmod Ex rather than Fmod Designer. How would I get stereo working in this case. Do I have to play 2 sounds one for each "ear"? If so how do I do that?

Finally regarding stitching. I had the same problem with mp3s but after a bit of trial and error with the buffer size and flags it worked on. However does it matter if I create the parts that need stitched as one .fsb file (with man subparts) or multiple .fsbs. At the moment it uses multiple mp3 files so the later would be easier for me.

  • You must to post comments
0
0

"Also to amend my earlier comments about using multiple FSBs or a single FSB, when stitching with a single FSB the logic is a lot simpler. You simply put all your sounds in one FSB and use Sound::setSubSoundSentence on that."

Sorry – I must have gotten something wrong here. After the sound has been playing if I call setSubSoundSentence and then next frame I call channel->getPosition (required to know when to change the order once it’s playing) on the channel of that sound I get a crash.

I’ve also tried to read it in as a single fsb and then stich it into a user stream by calling setSubSound with this code. But I get an error saying that sounds can’t share parent sounds.

[code:3g91box6]
FMOD::Sound *subsound = 0;
for( s32 i=0; i<NumMusicBuffers; i++ )
{
result = music.subsounds->getSubSound( 0, &subsound );
FMOD_ERRCHECK(result);
result = music.sound->setSubSound( 0, subsound );
FMOD_ERRCHECK(result);
}
[/code:3g91box6]

Can real time stitching even be done with one fsb file? Or real time order changing without gaps if you prefer to call it that.

  • You must to post comments
0
0

Do I have to call createStream for every subsound in the FSB and then stich them in individually to a user parent sound?

  • You must to post comments
0
0

Ok after playing around with it would appear GCADPCM doesn’t work properly and isn’t the most efficient.

It would appear simple ADPCM is a better choice (lower cpu overhead and slightly lower file size) plus it does work in hardware, or at least the debug print says it does and the cpu is lower.

I gave up on stitching as I can’t get around the problem that any sub sound loaded in as a part of the fsb can’t be stitched in to a user sound or setSubSoundSentence can’t be changed while a sound is playing. As a result all what was left to me was to not load them in as a single fsb file or change them in the callback (which creates a gap).

All a bit flaky and considering this is the complete opposite of what I was told I’m a bit apprehensive about the support for the 3ds in general.

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.