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.

[Discussion] CQT, VQT, energy preservation, and frequency band alignment

See original GitHub issue

I wanted to make a separate issue to consolidate the discussion around a number of related points that have popped up in the implementation of VQT #1018, inverse CQT #165, and so on. @lostanlen and I have discussed these things in various places (often offline), but it would be helpful to have a more permanent record.

Frequency band definitions

In the CQT implementation, we follow the SK2010 definition of the frequency bands, which are essentially left-aligned: [f, a * f] (for some constant a). This works well enough, but it makes some calculations awkward, eg in the VQT. Later on in the CQT toolbox, the definition shifted to a centered representation, eg [f / sqrt(a), f * sqrt(a)] (again for some constant a), so that the frequency of each filter is centered within the band.

Some questions:

  • Should we add support for centered frequency bands? I don’t think it would change much, except possibly some boundary effects at the top end of octaves.
  • Should we make centering the default? Should we even bother with left-aligned bands anymore?

Energy preservation

Our CQT implementation has historically had a bunch of headaches around normalization and energy preservation. Of course we can’t exactly preserve energy with a lossy frequency representation, but our current cqt/icqt round trip gets pretty close. However, other feature representations (notably Mel) are not so forgiving, and it would be nice if we could strive for consistency here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:37 (32 by maintainers)

github_iconTop GitHub Comments

1reaction
bmcfeecommented, Nov 17, 2021

Yeah, that’s loosely speaking what I had in mind. A couple of caveats:

  1. We can’t just take the max frequency anymore, because the max frequency could have a narrower bandwidth than the one below it. Instead, we can do something like this inside wavelet_length:
    f_cutoff = max(freqs * (1 + 0.5 * window_bandwidth(window) / Q) + 0.5 * gamma)
    
    if f_cutoff > sr / 2.0:
        raise ParameterError(f"Filter at frequency={???:.2f} would exceed Nyquist={sr/2}")

(I guess we’re cool with a per-frequency gamma?)

  1. We actually need this f_cutoff in vqt to enable early downsampling. Actually, it might make sense to migrate the Nyquist check out of the filter constructor and into the vqt function itself. This would effectively mean that wavelet_lengths should return both the filter lengths and the cutoff frequency. A little awkward, but probably a better compromise overall.
1reaction
lostanlencommented, Nov 16, 2021

I think @lostanlen’s post above had a typo in the alpha_high calculation, where it should subtract freq[-2] not freq[-1].

Yes, sorry, i hadn’t tested it. freq[-2] of course

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simple linear response model for predicting energy band ...
We show that the DFT band alignment is best predicted by the linear response model, which falls in between the Anderson and midgap...
Read more >
ITS DISCUSSION OF DIFFERENCES ITS Section 3.4B: Reactor ...
ANO response (dated December 21, 1990) to Generic Letter 90-06 indicates that the pressurizer electromatic (power operated) relief valve (ERV) is not ...
Read more >
https://www.cs.virginia.edu/cs1112/datasets/text/m...
... county american photo game members power while care network down computer ... self council away includes track australia discussion archive once others ......
Read more >
US8658086B2 - Systems and methods for interior energy-activation ...
The method places in a vicinity of the medium at least one energy modulation ... frequency band, different than baseband, by modulating a...
Read more >
FINAL ENVIRONMENTAL IMPACT STATEMENT - William J ...
Conservation Authority. State Water Quality Criteria. Letter from the Southwest Power and Light. Public Hearing Notice. Airport Vicinity Model Summary.
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