0
0

I’m evaluating FMOD in our application right now and I’m running into a weird problem.

So basically what I’m doing in words is creating a sound with these flags (FMOD_2D | FMOD_SOFTWARE | FMOD_OPENUSER) and recording into it with looping set to true.

The sample is running @ 8khz, +-PCM16, mono and is one second in length. I have a timer running around 16x / sec which I use to update the system and lock/process/unlock the sample. During the process stage I just feed the data directly to our DSP algorithms, all this works perfectly.

The problem occurs when I try to play a sample at the same time, this sample is different than the live recording sample, it’s just a pre-made sound effect.

So basically if I try to play a sample while recording, FMOD loads the sample, and plays it all without complaining but there is no output on the device.

What I’ve been doing to get around this is; stopping the recorder, playing the samples, waiting until they are done playing then restart the recorder. This in fact does allow the system to play and output the audio…

This to me seems a little messy unless of course the iPhone doesn’t support full-duplex audio but I was under the impression that it does.

Any insight on this one would be very helpful, if I can get this working then we will certainly be purchasing a license for our product, many thanks in advance.

Chris
__

  • You must to post comments
0
0

Hmmm, I just did a quick test here, using the "recording" example I added another sound in (drumloop.wav) and played that while recording and playing back my voice. This worked correctly as expected, there shouldn’t be any problems from the hardware side with recording and playing at the same time, especially since FMOD is always "playing".

My first instinct with this problem would be something to do with audio sessions, are you using any of the Apple SDK audio APIs? for instance setting the audio session (this is not advisable, we have alternative ways of handling this that won’t cause problems).

I should also ask what version of the SDK you are using and what hardware you are testing on, everything should be compatible but you never know.

You can easily recreate the test I did with the FMOD SDK "recording" example to verify that it works at your end too. You might be able to spot something in the example that you are doing differently. But if you are still having issues I recommend sending us in a reproduction case of the problem (at support@fmod.org). If I can recreate the problem here I should be able to get it working for you quickly.

  • You must to post comments
0
0

Yeah I found the problem, it’s working like a charm now!

Another thing that I’ve found (and the recorder sample has this behavior as well) is that when I’m recording all playback is routed to the earpiece and not the main speaker.

I know it seems like you should stop recording then play the sample but the problem is when you start/stop recording it makes a popping noise and it seems quite a bit faster to just leave it recording rather that starting/stopping based on sample playback…

So I keep recording and only stop our DSP processing when a sample is being played, no pops, and it’s fast, but the audio is being routed to the wrong place.

So my question is how does one control the speaker routing using the API?

Chris
__

  • You must to post comments
0
0

I’m glad you have that problem resolved.

Currently that audio is automagically re-routed by the Apple SDK, we inform the device we are going into Record and Playback mode which is required to have recording work while playing. Then the device decides since there will probably be feedback by the sound coming out of the main speaker then being picked up by the microphone, it directs audio out the receiver speaker instead of the base speaker.

There is the ability to override this audio routing change via the Apple SDK, but it is not currently expose via FMOD. Leave this with me, I will have a look into how this could be exposed with FMOD. I will have a firm answer for you later today.

  • You must to post comments
0
0

Ok I have decided to expose the feature via the extra driver data structure found in the fmodiphone header file. There will be a new setting for forceSpeakerOutput that will reroute the audio to the main speaker while recording and playing.

As a warning though if you are not careful you will get feedback, also note that this feature will only work on devices with iPhone OS 2.1 or higher.

This should be available in the development branch of our next release. I will also update the platform specific docs to describe the use of this new feature.

  • You must to post comments
0
0

Awesome, I’ll keep an eye out for it. How often do you guys update your development branch?

And also as a quick fix could I just hardcode the routing using the Audio Session?

Chris
__

  • You must to post comments
0
0

We normally release a new version each week on a Thursday or Friday, so we should have a new version out by the end of today. I have just checked that new feature in so it’s good to go.

I tend not to recommend people use the audio session APIs (since weird bugs can get introduced) instead do everything through FMOD but for this particular one it is probably safe. Although you can probably just wait until the release is out since it will be so soon.

  • You must to post comments
0
0

[quote="mathew":2x2jkb3m]Ok I have decided to expose the feature via the extra driver data structure found in the fmodiphone header file. There will be a new setting for forceSpeakerOutput that will reroute the audio to the main speaker while recording and playing.

As a warning though if you are not careful you will get feedback, also note that this feature will only work on devices with iPhone OS 2.1 or higher.

This should be available in the development branch of our next release. I will also update the platform specific docs to describe the use of this new feature.[/quote:2x2jkb3m]

Is there something in the SDK, or planned, to reduce or eliminate this feedback? Thanks in advance!

  • You must to post comments
0
0

No, we currently have no plans to support any echo cancellation. The reason this mode is an override is because it’s outside the normal usage pattern for the device. You would need to implement this yourself.

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.