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

f0 contour sonification #1648

Open
bmcfee opened this issue Jan 26, 2023 · 3 comments
Open

f0 contour sonification #1648

bmcfee opened this issue Jan 26, 2023 · 3 comments
Assignees
Labels
functionality Does this add new functionality?

Comments

@bmcfee
Copy link
Member

bmcfee commented Jan 26, 2023

Is your feature request related to a problem? Please describe.
This is a very minor thing, but some of our advanced examples now include sonification of pitch contours. For this, we rely on mir_eval to build the documentation site, as it has a tool that's nearly perfect for this job. https://craffel.github.io/mir_eval/#mir_eval.sonify.pitch_contour

There's a reasonable case to be made that a function like this belongs in librosa as well, and implementing it here would let us drop one dependency from the doc build environment.

Describe the solution you'd like
The pitch contour sonification in mir_eval is basically fine, though there are a couple of enhancements that would make it integrate better with librosa:

  1. Graceful support of nan frequencies for unvoiced regions. This would make sonifying pyin outputs a bit easier in practice. Right now I hack around it by nan_to_num(f0), but this results in scoops at the onset/offset of voiced intervals. We could probably do better by replacing the cumsum for continuous f0 interpolation by a nancumsum.
  2. Allowing the sampling grid to be specified by frame parameters (sr, hop_length) instead of explicit time measurements. This would align the API a bit better with the rest of the package.

Describe alternatives you've considered
We could also put these enhancements into mir_eval, but especially (2) doesn't seem relevant over there.

@bmcfee bmcfee added the functionality Does this add new functionality? label Jan 26, 2023
@bmcfee bmcfee added this to the 0.10.1 milestone Jan 26, 2023
@lostanlen
Copy link
Contributor

Where would the function belong? librosa.core.audio ? Or is it time for a sonification/synthesis module that would also welcome clicks, tone, and chirp ?

@bmcfee
Copy link
Member Author

bmcfee commented Jan 27, 2023

Yeah, I was thinking core.audio with re-export at the top level. I know the top-level is feeling a bit bloated, but I'm not sure there's enough isolated functionality here to warrant a submodule.

@bmcfee bmcfee modified the milestones: 0.10.1, 0.10.2 Aug 15, 2023
@bmcfee bmcfee self-assigned this Oct 4, 2023
@bmcfee
Copy link
Member Author

bmcfee commented Apr 3, 2024

I have a PR out on mir_eval to add nan support to pitch sonification, and that should roll out in the next release. As such, I'll remove this feature from the upcoming milestone, but we can reconsider in the future.

@bmcfee bmcfee removed this from the 0.10.2 milestone Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functionality Does this add new functionality?
Development

No branches or pull requests

2 participants