New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with Windowing and Spectrum methods #240
Comments
Is the input file mono and are you sure that monoloader_frame and audioloader_frame are equal value by value? AudioLoader return stereo signal, so that the 0-th index will correspond to the left channel. |
I've reproduced the experiment getting similar results to @ghost.
The same applies for the |
Ok, this is a problem interleaved representation of vectors of StereoSamples.
a new array object is created, but it does not allocate additional memory for the array's data. Instead, it creates a "view" that shares the original array's data buffer. Therefore, while printing monoloader_frame looks fine in python, passing that back to C++ algorithm produces an error. Addressing the first 1024 floats results in interleaved left/right channel values for 512 samples. Casting to |
The same issue seems to appear for any slicing. Giving any numpy array object created by slicing to Essentia algorithm would result in incorrect memory access. For example, monoloader_frame[::2] should have 512 value with every second value from monoloader_frame, but the resulting vector input will have the first 512 values instead. To sum up, we should implement a check for if the input is a copy or a view when passing input to Essentia algorithms in the wrapper. In the case it is a view, we should create a new copy and pass that. |
We should implement a base python test for that too. |
If it is a view it creates a copy
Fixed in #555 |
I'm playing with Essentia and I get some weird results with Windowing and Spectrum algorithms when using AudioLoader.
First Windowing:
Both frame are the same, but I get weird windowed data with AudioLoader (one every two value is 0).
Same thing with Spectrum: I get the expected result when using MonoLoader and weird result with AudioLoader: I set the
size
parameter to 1024, which from the doc is the audio input size.From a spectrum function I would expect either the whole symmetric magnitude spectrum on 1024 points, or half the spectrum on 513 points. With the
Spectrum
method I get the whole (symmetric) spectrum on 513 points. What am I missing?The text was updated successfully, but these errors were encountered: