Sorry in advance for the importance of this question, this is my first research on the sound side of iOS programming.
I use the AVAudioRecorder class to record microphone input using the following settings dictionary.
NSMutableDictionary *settings = [[NSMutableDictionary alloc] init]; [settings setValue:[NSNumber numberWithInt:kAudioFormatLinearPCM] forKey:AVFormatIDKey]; [settings setValue:[NSNumber numberWithFloat:11025.0] forKey:AVSampleRateKey]; [settings setValue:[NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey]; [settings setValue:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey]; [settings setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey]; [settings setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];
This works fine, the problem occurs when I try to use the echonest-codegen library to create a fingerprint to identify the music that was played.
Do not worry if you have never used it before, basically I have to run this function:
Codegen * pCodegen = new Codegen(const float* pcm[], int number_of_samples, int samples_offset);
Where const float * pcm [] is the sample buffer. I need to convert my input to a โfloat bufferโ. I pointed to the ExtAudioFile docs, but they don't make much sense. Can someone point me in the right direction? I am completely lost!
Many thanks!
source share