I noticed that the incomming DSP buffer has an unwanted pitch shift..

I’m recording using the microphone and want to apply some processing on it.

I dumped the raw data at 2 different placed :
– inside the main loop, using System::getRecordPosition() (as seen in the recordtodisk sample inside the SDK folder) to PCM16
[code:rtut45h9]static unsigned int lastrecordpos = 0;
unsigned int recordpos = mSoundSystem->GetCurrentRecordPos();
if (recordpos != lastrecordpos)
void *ptr1, *ptr2;
int blocklength;
unsigned int len1, len2;

blocklength = (int)recordpos - (int)lastrecordpos;
if (blocklength < 0)
    blocklength += soundlength;
mInput->Lock(lastrecordpos * 1 * 2, blocklength * 1 * 2, &ptr1, &ptr2, &len1, &len2);  
if (ptr1 && len1)
    fwrite(ptr1, 1, len1, fp2);
if (ptr2 && len2)
    fwrite(ptr2, 1, len2, fp2);
mInput->UnLock(ptr1, ptr2, len1, len2);

lastrecordpos = recordpos;[/code:rtut45h9]
– doing a plain fwrite inside the DSP read callback to 32bit float
[code:rtut45h9]FMOD_RESULT F_CALLBACK FMODCallback_Recognizer(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels)


memcpy(outbuffer,inbuffer,length * outchannels * sizeof(float) ); //copy it over, no changes made

I commented all other code inside the DSP to make sure it wasn’t something I did (only a plain memcpy from the inbuffer to the outbuffer).

IThis is how it looks in Audacity.
How is this possible? any help on this ?

Thx !

  • You must to post comments

ok, I’m an idiot.
if the output sample rate is not the same as the file, it’s normal the buffers don’t line up as expected :roll:

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.