Skip to content
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

PredominantPitchMelodia requires reinstantiation for sequential audio processing #1374

Closed
daminnock opened this issue Sep 11, 2023 · 2 comments
Labels

Comments

@daminnock
Copy link

Issue Description:

I'm experiencing an issue with the Essentia library in Python. I'm using the PredominantPitchMelodia algorithm, and I noticed that when I create an instance of the algorithm and use it to extract pitch information from an audio signal, it works as expected the first time. However, when I use the same instance of the algorithm again to process another audio signal, the pitch information is empty.

This code is just an example to show the behaviour.

Code Snippet:

import essentia.standard as es

# Create an instance of PredominantPitchMelodia
pitch_extractor = es.PredominantPitchMelodia()

# First extraction works fine
pitch1, _ = pitch_extractor(samples)

# Second extraction returns an empty array
pitch2, _ = pitch_extractor(samples)

print("First Pitch:", pitch1)
# [  0.        0.        0.      ...   0.      372.14197   0.     ]
print("Second Pitch:", pitch2)
# []

Expected Behavior:

I expected the PredominantPitchMelodia instance to print the same result twice:
[ 0. 0. 0. ... 0. 372.14197 0. ]
[ 0. 0. 0. ... 0. 372.14197 0. ]

However, it seems like the second extraction with the same instance results in an empty pitch array and the output is:
[ 0. 0. 0. ... 0. 372.14197 0. ]
[]

Questions:

  • Is there something specific I need to do to reinitialize the PredominantPitchMelodia instance before using it again?

Any insights or suggestions would be greatly appreciated. Thank you!

@andresbrocco
Copy link

Same issue here!

@dbogdanov
Copy link
Member

Thanks for reporting, this should be fixed in the master branch now. PyPI wheels will be updated later. As a workaround for using current Python wheels, you can explicitly call pitch_extractor.reset() after each compute.

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

No branches or pull requests

3 participants