0
0

Hi,

I am looking to use the FMOD Custom DSP callback pattern to do some analysis on the audio stream being read from the microphone on the iPhone.

I am using the Pitch Detection example code as a base to work from:

[code:3q4pjsg3]
result = system->recordStart(0, sound, true);
[self ERRCHECK:result];
///Give me some time to hear something
usleep(200 * 1000);

result = system->playSound(FMOD_CHANNEL_REUSE, sound, false, &channel);
[self ERRCHECK:result];

/* Dont hear what is being recorded otherwise it will feedback.  Spectrum analysis is done before volume scaling in the DSP chain */
result = channel->setVolume(0);
[self ERRCHECK:result];

[/code:3q4pjsg3]

I just noticed the comment about spectrum analysis is done before the volume scaling in the DSP chain.

My DSP definition looked something like this:

[code:3q4pjsg3]
{
FMOD_DSP_DESCRIPTION dspdesc;

    memset(&dspdesc, 0, sizeof(FMOD_DSP_DESCRIPTION)); 

    strcpy(dspdesc.name, "Signature Detector"); 
    dspdesc.channels     = 0;                   // 0 = whatever comes in, else specify. 
    dspdesc.read         = signatureDSPCallback; 
    dspdesc.userdata     = (void *)0x12345678; 

    result = system->createDSP(&dspdesc, &dspsignature); 
    [self ERRCHECK:result]; 
}

result = dspsignature->setBypass(false);
[self ERRCHECK:result];

result = dspsignature->setActive(true);
[self ERRCHECK:result];

result = system->addDSP(dspsignature, NULL);
[self ERRCHECK:result];

[/code:3q4pjsg3]

In my Call back the value being passed on the input buffer was always zero, is it a case that because I have set the volume to be 0 for the output. Is it a case that if the the volume value is set to 0, all data being passed to the the DSP will always be zero?

If that is the case, is there a way to listen to the incoming stream using a DSP or other method without having the "history" contained within the record buffer?

I was previously access the wave data using:
[code:3q4pjsg3]
result = channel->getWaveData(wavedata, SPECTRUMSIZE, 0);
[/code:3q4pjsg3]

but wanted to move to using a DSP to have "tick" level view of the audio stream.

Any help would be greatly appreciated!

  • You must to post comments
0
0

Bump, any body got an idea why this is happening for me?

  • You must to post comments
0
0

If you want to get a visual of what’s going on with the signal chain I would recommend using FMOD Profiler. You would see your DSP attached to the head of the network and the volume 0 causing silence to come from the channel.

If you just want to process the recording signal but don’t want to hear it, you can simply add your DSP to the channel instead of the system.

  • You must to post comments
0
0

Mathew,

Thanks for the input, will give it a try and report back how I get on.

Thanks again.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.