question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tempogram ratio and f0 harmonic interpolation

See original GitHub issue

Is your feature request related to a problem? Please describe.

This was alluded to in #1426 , but it would be handy to finally provide an implementation of the tempogram ratio feature from (Peeters, 2005). It would look something like the following (bottom subplot):

image

  • Peeters, Geoffroy. “Rhythm Classification Using Spectral Rhythm Patterns.” ISMIR. 2005.

Describe the solution you’d like

The basic idea is to take a tempogram, extract a (time-varying) tempo estimate (corresponding to quarter-notes), and then use harmonic interpolation to measure tempogram energy for each frame at all musically important durations. The benefit of this over a raw tempogram is that it could locally normalize for tempo variation.

The underlying algorithm is somewhat similar to our interp_harmonics function, except that we want to pull out a different subset of frequencies for each frame. I imagine the implementation would use a vectorized interpolator in a similar fashion to what we do for reassigned spectrogram harmonics:

https://github.com/librosa/librosa/blob/7ac022a8496126e95b46a7d56ad880a328359bda/librosa/core/harmonic.py#L253-L265

but of course the details will be slightly different.

We could also support having a single, global tempo (much simpler), as well as aggregation over frames.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zafarrafiicommented, Jun 13, 2022

I am trying to understand how your idea is different from interp_harmonics, I am not familiar with that function. What I can say is that, in my case, I was trying to deconvolve a log-spectrum into some sort of energy-normalized pitch component and a pitch-normalized energy component. Since that energy component is pitch-normalized, you don’t need to estimate the f0 and you can find the energy of the harmonics easily then (works better in monophonic cases), hence the idea of using it to derive a simple timbre descriptor. Would you need to provide the f0 in your case then?

0reactions
bmcfeecommented, Aug 6, 2022

Poring over some old discussions, I just realized that this proposed functionality could also be useful in some unexpected ways. If f0 is fixed to a tonal center frequency (over all time), and the “harmonics” are allowed to be fractions (intervals, no technical reason to forbid this), then we can do pitch salience histograms as well as described here: https://github.com/librosa/librosa/issues/641#issuecomment-636593736

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tempo(gram) display with musical notation #1426 - GitHub
Tempo(gram) display with musical notation #1426. Open ... Tempogram ratio and f0 harmonic interpolation #1500. Open.
Read more >
Tempogram ratio and f0 harmonic interpolation issue ...
The basic idea is to take a tempogram, extract a (time-varying) tempo estimate (corresponding to quarter-notes), and then use harmonic interpolation to measure ......
Read more >
librosa.interp_harmonics — librosa 0.10.0.dev0 documentation
Compute the energy at harmonics of time-frequency representation. Given a frequency-based energy representation such as a spectrogram or tempogram, this ...
Read more >
Performance Evaluation of Subharmonic-to-Harmonic Ratio ...
Data Set I contained 2560 synthesized EGG signals with varying degrees of AM and FM, fundamental frequency (fo), periodicity, and signal-to-noise ratio (SNR)....
Read more >
Signal Processing for Music Analysis
Consonant harmonies (those that sound “pleasant”) tend to involve pitches with simple frequency ratios, indicating many shared harmonics. Fig. 2 shows middle C ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found