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:
result = system->recordStart(0, sound, true);
///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];
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:
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];
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:
result = channel->getWaveData(wavedata, SPECTRUMSIZE, 0);
but wanted to move to using a DSP to have "tick" level view of the audio stream.
Any help would be greatly appreciated!
- chavezirl asked 5 years ago
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.
Please login first to submit.