Skip to content

Unable to get BPM Value #2

Description

@loretoparisi

I have a wave file. I go through 1025 bytes samples and read the wav

std::vector<float> floatVect[ 1024 ];

while (inFile->eof() == 0) {

     // Read a chunk of samples from the input file
    num = inFile->read(shortBuffer, BUFF_SIZE);
    samples = num / nChannels;

     //// here we calculate FFT with AccelerateToolbox in output vector
     ////// short int shortBuffer go to FFT samples in output
     ///// now convert to float

   for(int i=0;i<samples;i++) {
        float fSample = output[ i ] / 32768.0f;
        floatVect->push_back(fSample);   //// <---- push to the float vector
    }

}



 /// calculate BPM
 bpmDetect->process( inFile->getLengthMS()/1000.0f, *floatVect);
  bpm = bpmDetect->winning_bpm;
 bpmDetect->reset();

 inFile->rewind();

The resulting bpm is always bpm = 0.

Is that right to accumulate the float samples from the FFT and then pass the vector to the process() method with the wav duration expressed in seconds ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions