Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

how to run BeatTrackerDegara in c++ standard mode? #1458

Open
feibuguocanghai opened this issue Jan 17, 2025 · 0 comments
Open

how to run BeatTrackerDegara in c++ standard mode? #1458

feibuguocanghai opened this issue Jan 17, 2025 · 0 comments

Comments

@feibuguocanghai
Copy link

feibuguocanghai commented Jan 17, 2025

Although Essentia provides a large amount of documentation, but I still haven't found an example of inputting audio from a buffer and then running an algorithm. The following is the code I wrote to run the beat tracking algorithm.

 essentia::init();
AlgorithmFactory&` factory = standard::AlgorithmFactory::instance();
Algorithm* beatTracker = factory.create("BeatTrackerDegara");
Pool pool;
vector<Real> audioBuffer; 
vector<Real> ticks;  
audioBuffer.resize(1024);

beatTracker->input("signal").set(state->audioBuffer); 
beatTracker->output("ticks").set(state->ticks);

// read data from file and convert to float
 for (int i = 0;i < 1024;i++) {
        state->audioBuffer[i] = audio_in[i] / 32768.0f;
}
beatTracker->compute();
state->pool.add("ticks", state->ticks);
const auto& beat_ticks = state->pool.value<vector<Real>>("ticks");

Then I encountered the error:

terminate called after throwing an instance of 'essentia::EssentiaException'
  what():  Descriptor name 'ticks' of type std::vector<Real> not found

Why does this problem occur and how can it be fixed?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant