essentia
essentia copied to clipboard
Expected std::vector<StereoSample>, received std::vector<StereoSample>
Hiya, hoping someone might be able to give me a hand with this, my code runs fine in Debug mode, but when I build for release mode and run it, this code snippet throws an exception:
void SpleeterWrapper::LoadFromWav(std::vector<StereoSample>& result, std::string path) { std::unique_ptr<Algorithm> audioLoader(AlgorithmFactory::create("AudioLoader", "filename", path)); Real sr; int nchnls, bitRate; std::string md5, codec; audioLoader->output("audio").set(result); audioLoader->output("sampleRate").set(sr); audioLoader->output("numberChannels").set(nchnls); audioLoader->output("md5").set(md5); audioLoader->output("bit_rate").set(bitRate); audioLoader->output("codec").set(codec); audioLoader->compute(); audioLoader->reset(); }
Error is:
libc++abi.dylib: terminating with uncaught exception of type essentia::EssentiaException: In AudioLoader::audio::set(): Error when checking types. Expected: std::vector<StereoSample>, received: std::vector<StereoSample>
anyone have any insight on this? on OSX compiling with Xcode as per the instructions in the FAQs
Seems like the type of result is wrong. Should be std:vector<StereoSample>.
https://essentia.upf.edu/doxygen/namespaceessentia.html#a4b3575ae1a1640a95c6e304deb53ca02
Seems like the type of result is wrong. Should be std:vector<StereoSample>.
https://essentia.upf.edu/doxygen/namespaceessentia.html#a4b3575ae1a1640a95c6e304deb53ca02
I think I must have fixed this (can't actually remember) but no idea why I'm just passing a vector& instead of a vector<StereoSample> lol, cheers for the response anyway!
Necroposting this (good job past self on passing a std::vector& with no type....) But yeah this still seems to be an issue, and the loading works if I skip the checkType<Type> call in the iotypewrappers header:
// BAD BAD BAD BAD BAD BAD BAD BAD
template<typename Type>
void InputBase::set(const Type& data) {
_data = &data;
}
this is only happening for me on an intel mac, works fine on my M1, the call is this:
void convertToMono() {
m_monoAudioData.reserve(m_audioData.size());
std::unique_ptr<essentia::standard::Algorithm> monoConverter(essentia::standard::AlgorithmFactory::instance().create("MonoMixer"));
monoConverter->input("audio").set(m_audioData);
monoConverter->input("numberChannels").set(2);
monoConverter->output("audio").set(m_monoAudioData);
monoConverter->compute();
}
where m_audioData is a member variable, filled elsewhere but declared with:
std::vector<essentia::StereoSample> m_audioData;
Bypassing the check type seems to have worked for now, but wondering if theres something wacky going on with that checkType function