I did lots of R&D but did not get any good answer. I am working on music type app in iphone and i have to categorized songs on the basis of beats per minute.So my first task
Get Bpm of audio songs within minute:
BASS_SetConfig(BASS_CONFIG_IOS_MIXAUDIO, 0); // Disable mixing. To be called before BASS_Init.
if (HIWORD(BASS_GetVersion()) != BASSVERSION) {
NSLog(@"An incorrect version of BASS was loaded");
}
// Initialize default device.
if (!BASS_Init(-1, 44100, 0, NULL, NULL)) {
NSLog(@"Can't initialize device");
}
//NSArray *array = [NSArray arrayWithObject:@""
NSString *respath = [[NSBundle mainBundle] pathForResource:@"[Songs.PK] Paathshaala - 01 - Aye Khuda" ofType:@"mp3"];
DWORD chan1;
if(!(chan1=BASS_StreamCreateFile(FALSE, [respath UTF8String], 0, 0, BASS_SAMPLE_LOOP))) {
NSLog(@"Can't load stream!");
}
mainStream=BASS_StreamCreateFile(FALSE, [respath cStringUsingEncoding:NSUTF8StringEncoding], 0, 0, BASS_SAMPLE_FLOAT|BASS_STREAM_PRESCAN|BASS_STREAM_DECODE);
float playBackDuration=BASS_ChannelBytes2Seconds(mainStream, BASS_ChannelGetLength(mainStream, BASS_POS_BYTE));
NSLog(@"Play back duration is %f",playBackDuration);
HSTREAM bpmStream=BASS_StreamCreateFile(FALSE, [respath UTF8String], 0, 0, BASS_STREAM_PRESCAN|BASS_SAMPLE_FLOAT|BASS_STREAM_DECODE);
//BASS_ChannelPlay(bpmStream,FALSE);
BpmValue= BASS_FX_BPM_DecodeGet(bpmStream,0.0,
playBackDuration,
MAKELONG(45,256),
BASS_FX_BPM_MULT2,
NULL);
NSLog(@"BPM is %f",BpmValue);