Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - djjoy

Pages: [1]
1
Plugin Development / Help to get exact bpm count and beatgrid
« on: September 21, 2016, 17:56:10 »
Hello everybody,
I'm newbie in vamp and also in c++.
I have a DJ application that uses bass.dll, but the bpm counter of bass.dll is not very precise, and I want proccess the song throught vapm plugins to get the exact bpm.

If I use fixedtempo:0 with output = 0 (tempo), modifing your vamp-simple-host example to use with bass:
I get this:
0.002902494, 59.998911565: 51.3587 51.4 bpm
when the real bpm ( in traktor and virtual dj ) is 93.232

I use bass decode to send data to process:
BASS_Init(-1,44100,BASS_DEVICE_MONO,0,NULL);  //only one channel
stream = BASS_StreamCreateFile(FALSE,filename,0,0, BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT);  //open the song in decode float samples mode


//loop to fill data in the plugin

    // Here we iterate over the frames, avoiding asking the numframes in case it's streaming input.
    do {

        int count;

        if ((blockSize==stepSize) || (currentStep==0)) {
            // read a full fresh block
         count = BASS_ChannelGetData(stream, filebuf, blockSize );
            if (count  < 0)
         {
                cerr << "ERROR: sf_readf_float failed: "  << endl;
                break;
            }
            if (count != blockSize) --finalStepsRemaining;
        } else {
            //  otherwise shunt the existing data down and read the remainder.
            memmove(filebuf, filebuf + (stepSize * channels), overlapSize * channels * sizeof(float));
         count = BASS_ChannelGetData(stream, filebuf + (overlapSize * channels ), stepSize );
            if (count < 0) {
                cerr << "ERROR: sf_readf_float failed: " <<  endl;
                break;
            }
            if (count != stepSize) --finalStepsRemaining;
            count += overlapSize;
        }

        for (int c = 0; c < channels; ++c) {
            int j = 0;
            while (j < count) {
                plugbuf[c][j] = filebuf[j * info.chans + c];
                ++j;
            }
            while (j < blockSize) {
                plugbuf[c][j] = 0.0f;
                ++j;
            }
        }

        rt = RealTime::frame2RealTime(currentStep * stepSize, info.freq);

        printFeatures
            (RealTime::realTime2Frame(rt + adjustment, info.freq),
             info.freq, outputNo, plugin->process(plugbuf, rt),
             out, useFrames);
      int frames;
      frames = BASS_ChannelGetLength(stream, BASS_POS_BYTE);
        if (frames > 0){
            int pp = progress;
            progress = (int)((float(currentStep * stepSize) / frames) * 100.f + 0.5f);
            if (progress != pp && out) {
                cerr << "\r" << progress << "%";
            }
        }

        ++currentStep;

    } while (finalStepsRemaining > 0);


Can you helpme about this? What's wrong?

Best Regards,

DJ Joy









Pages: [1]