Comments (9)
Essentia compiles just fine as a C++ library, the python bindings are optional (as is TagLib, btw), so this should be no problem.
As for compiling on iOS, it hasn't been tried yet, but the code is standard C++ so there should be no major issue. Any input on the subject is welcome!
from essentia.
I was able to build against armv7 / iOS6.0 - iOS 7.0 stripping down dependencies like
- TagLib (even if there is a taglib.Framework that compile agains armv7/iOS5.0)
- libavcodec / FFmpeg and the io/ read & write classes
- Gaia
- Yaml
- libsamplerate
Now the issue is related to the TNT library and it is described here:
from essentia.
I added the Essentia iOS framework here:
https://github.com/loretoparisi/EssentiaTouch
The project need the XCode Universal Framework to build:
https://github.com/kstenerud/iOS-Universal-Framework
So far the framework builds, but it is far to be complete, since too many dependencies are missing.
from essentia.
I was able to compile and run the library on armv7 / armv7s:
A algorithm run is like
void Melody::calculatePredominantMelody(float* _audio, float* output) {
/////// PARAMS //////////////
// don't change these default values as they guarantee that pitch extractor output
// is correct, no tests were done on other values
int framesize = 1024;
int hopsize = 128;
int sr = 44100;
// instantiate algorithms
essentia::standard::AlgorithmFactory& factory = essentia::standard::AlgorithmFactory::instance();
essentia::standard::Algorithm* equalLoudness = factory.create("EqualLoudness");
essentia::standard::Algorithm* predominantMelody = factory.create("PredominantMelody",
"frameSize", framesize,
"hopSize", hopsize,
"sampleRate", sr);
// data storage
//essentia::Pool pool;
std::vector<essentia::Real> audio = ( std::vector<essentia::Real>)*_audio;
/// TODO: here we have to fill the real audio vector
equalLoudness->input("signal").set(audio);
std::vector<essentia::Real> audioEq;
equalLoudness->output("signal").set(audioEq);
predominantMelody->input("signal").set(audioEq);
std::vector<essentia::Real> pitches;
std::vector<essentia::Real> pitchConfidences;
predominantMelody->output("pitch").set(pitches);
predominantMelody->output("pitchConfidence").set(pitchConfidences);
//pool.add("tonal.predominant_melody.pitch",pitches);
//pool.add("tonal.predominant_melody.pitch_confidence",pitchConfidences);
predominantMelody->compute();
printf(".");
float tm = 0.0;
for (int i = 0; i<pitches.size(); i++)
{
tm = tm + float(hopsize)/float(sr);
printf("\n%f %f %f",pitches[i], pitchConfidences[i], tm);
output[i]=pitches[i];
}
/*
const std::vector<essentia::Real>& pitchesR = pool.value<std::vector<essentia::Real> >("tonal.predominant_melody.pitch");
const std::vector<essentia::Real>& confidenceR = pool.value<std::vector<essentia::Real> >("tonal.predominant_melody.pitch_confidence");
printf("number of frames: %lu", pool.value<std::vector<essentia::Real> >("tonal.predominant_melody.pitch").size() );
float tm = 0.0;
for (int i = 0; i<pitchesR.size(); i++)
{
tm = tm + float(hopsize)/float(sr);
printf("%f %f %f",pitchesR[i], confidenceR[i], tm);
output[i]=pitchesR[i];
}*/
// clean up
delete predominantMelody;
delete equalLoudness;
}
So far the result is the the arrays pitchesR and confidenceR have no elements.
Are there errors in the procedure ?
from essentia.
You are adding empty vectors to pool before they were actually updated by compute() method
//pool.add("tonal.predominant_melody.pitch",pitches);
//pool.add("tonal.predominant_melody.pitch_confidence",pitchConfidences);
predominantMelody->compute();
from essentia.
That makes sense. Is there any way to do not use the pool?
What the pool does internally. Is there any accumulator logic?
Thanks
Il giorno martedì 19 novembre 2013, Dmitry Bogdanov ha scritto:
You are adding empty vectors to pool before they were actually updated by
compute() method//pool.add("tonal.predominant_melody.pitch",pitches);
//pool.add("tonal.predominant_melody.pitch_confidence",pitchConfidences);predominantMelody->compute();
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-28819162
.
Dott. Ing. Loreto Parisi
Parisi Labs
Email: [email protected]
Blog: http://blog.parisilabs.com
Linkedin: http://www.linkedin.com/in/loretoparisi
from essentia.
I tried to add de commenting lines
pool.add("tonal.predominant_melody.pitch",pitches);
pool.add("tonal.predominant_melody.pitch_confidence",pitchConfidences);
but I have an error
libc++abi.dylib: terminating with uncaught exception of type essentia::EssentiaException: Descriptor name 'tonal.predominant_melody.pitch' of type std::vector not found
The code modified was
void Melody::calculatePredominantMelody(float* _audio, float* output) {
/////// PARAMS //////////////
// don't change these default values as they guarantee that pitch extractor output
// is correct, no tests were done on other values
int framesize = 2048;
int hopsize = 128;
int sr = 44100;
// instantiate algorithms
essentia::standard::AlgorithmFactory& factory = essentia::standard::AlgorithmFactory::instance();
essentia::standard::Algorithm* equalLoudness = factory.create("EqualLoudness");
essentia::standard::Algorithm* predominantMelody = factory.create("PredominantMelody",
"frameSize", framesize,
"hopSize", hopsize,
"sampleRate", sr);
// data storage
essentia::Pool pool;
std::vector<essentia::Real> audio = ( std::vector<essentia::Real>)*_audio;
/// TODO: here we have to fill the real audio vector
equalLoudness->input("signal").set(audio);
std::vector<essentia::Real> audioEq;
equalLoudness->output("signal").set(audioEq);
predominantMelody->input("signal").set(audioEq);
std::vector<essentia::Real> pitches;
std::vector<essentia::Real> pitchConfidences;
predominantMelody->output("pitch").set(pitches);
predominantMelody->output("pitchConfidence").set(pitchConfidences);
pool.add("tonal.predominant_melody.pitch",pitches);
pool.add("tonal.predominant_melody.pitch_confidence",pitchConfidences);
predominantMelody->compute();
const std::vector<essentia::Real>& pitchesR = pool.value<std::vector<essentia::Real> >("tonal.predominant_melody.pitch");
const std::vector<essentia::Real>& confidenceR = pool.value<std::vector<essentia::Real> >("tonal.predominant_melody.pitch_confidence");
printf("number of frames: %lu", pool.value<std::vector<essentia::Real> >("tonal.predominant_melody.pitch").size() );
float tm = 0.0;
for (int i = 0; i<pitchesR.size(); i++)
{
tm = tm + float(hopsize)/float(sr);
printf("%f %f %f",pitchesR[i], confidenceR[i], tm);
output[i]=pitchesR[i];
}
// clean up
delete predominantMelody;
delete equalLoudness;
}
from essentia.
again, you are adding values to pool before computing them.
predominantMelody->output("pitch").set(pitches);
predominantMelody->output("pitchConfidence").set(pitchConfidences);
pool.add("tonal.predominant_melody.pitch",pitches);
pool.add("tonal.predominant_melody.pitch_confidence",pitchConfidences);
predominantMelody->compute();
should be
predominantMelody->compute();
pool.add("tonal.predominant_melody.pitch",pitches);
pool.add("tonal.predominant_melody.pitch_confidence",pitchConfidences);
from essentia.
The advantage of pool is that it can be used to store different variables of different types just like a dictionary in Python. However, there is little sense to use it in the standard mode in the case if you simply want to compute one output of an algorithm. Your original code without pool was ok for that.
from essentia.
Related Issues (20)
- python essentia can't support M2 Max ? HOT 3
- PitchYin is 1-2 semitones off on iPhone XR (but not on other iOS devices) HOT 1
- Wrong implementation of the 'DerivativeSFX' algorithm
- Wrong implementation of the 'AutoCorrelation' algorithm HOT 2
- PredominantPitchMelodia requires reinstantiation for sequential audio processing HOT 2
- Installation issues HOT 1
- documentation website is down HOT 3
- Essentia and Unity
- Is there a model to determine the time-stamps to beat mapping? HOT 1
- RhythmExtractor2013 ticks doesn't accurately provide the information of when the first beat occurs HOT 2
- TempoCNN minimum expected audio length
- Problem: cannot import name [TensorflowPredict...] from essentia.streaming HOT 2
- Problem connecting the Pipeline for DiscogsEffnet ('StreamingAlgo' object has no attribute 'poolIn') HOT 3
- Extractor Docs: "See detailed documentation" link 404's. HOT 1
- Import and runtime error on M1 Mac. Is Essentia Python wheels compatible with older version like Big Sur? HOT 10
- cannot import name 'TensorflowPredictMusiCNN' from 'essentia.standard' HOT 4
- Adding CMake and VS2019/2022 support HOT 23
- Update Vamp plugin to the latest Vamp SDK
- MSVC Vamp plugin builds for Windows
- speech vs music algorithms HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from essentia.