Improvements to adaptive waveplot
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- data-visualization
Research direction
Start by locating the AdaptiveWaveplot class and the waveshow entry point, then trace how the viewport threshold selects the step or envelope view. Work out the unresolved downsampling-pyramid and figure-DPI decisions before implementation; done means selecting the lowest suitable envelope resolution without the blocky display described for long signals.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
Documenting this conversation with @achabotl -
The AdaptiveWaveplot class is used by waveshow to dynamically switch between a step plot of the raw samples and an fill_between plot of the amplitude envelope based on the size of the viewport. If the viewport is smaller than max_points / sr, then the step plot is shown; otherwise, the envelope is shown.
To balance memory usage between the two views, the envelope plot is constructed so that it has about max_points horizontal steps. This works well enough for most cases, but if the signal is very long, and the user zooms in to just above the threshold for switching to step plots, it will result in a very blocky display.
Describe the solution you'd like
Instead of having only two modes (step and envelope), it might be worth maintaining a downsampling pyramid of envelopes at different resolutions.
This way, we'd never be off by more than a factor of two from a reasonably high-resolution display.
While this sounds expensive up front, I think it could end up being cheaper overall if we use more aggressive decimation in constructing the envelopes. Rather than pinning the number of horizontal steps to the sample threshold, we could instead derive a meaningful limit by querying the figure for its DPI.
The only change to the logic here would be that instead of one threshold, we have multiple, and switch to the lowest resolution that still provides reasonable resolution. (Some details to be fleshed out here.)
- Dominant language
- Python
- Stars
- 8.6k
- Forks
- 1.1k
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from librosa/librosa
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
discussion Staged
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement Typing
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100