Repository navigation
Constant-Q in au4 spectrogram - #10142
Conversation
|
@saintmatthieu Do you think we are ready to discuss required GUI changes? This should probably be done in a separate issue. I could draft an issue - or how do you prefer to proceed? Looking forward to your comments! Regards, Klaus |
|
Happy new year to you, @kgramhans ! I'm first taking a superficial look at this PR. A few early thoughts:
I just ran your branch. I did this analysis which I think illustrates well what the wavelet transform is about. I'll share it with the team - I've explained what it was about already but this will help I think. Performance-wise it feels totally useable now, too!! Will keep you updated on the outcome of the discussion. |
|
@saintmatthieu
The square wave example is nice: When listening to the signal your ear also reveals both the pulse and sinusoidal natures Looking forward to your feedback! |
|
I think I understand the difference, thanks for the clarification. Is the wavelet transform invertible? (Even with a Gaussian window? I know why cosine-based windows make STFTs invertible, not sure about Gaussian-based ones.) I'm asking because that is a necessary condition for proper spectral editing. |
|
@saintmatthieu When working with signal analysis I think it is more relevant to favour localisation of analysing functions in frequency and time. This then sacrifices a straightforward inverse transform since coefficients in the time/frequency plane are correlated (as are components in a STFT) Both Wavelet and STFT can however allow for an inverse transform . In some cases (as for Hann window with special overlap) this can even be an exact inverse. Editing the transform is however not simple since there are correlations between points, for example the Hann window is not super localised in frequency. This means that you cannot just take out some blurp at low frequencies without affecting higher frequencies also Instead, you could visualize a different approach similar to using an eraser: An interactive tool that would let you smoothly subtract a small amount of time/frequency localized phase-aligned signal: As a user you could gradually erase more and a forward transform would interactively show the effect. Get the picture? I am working on fetching the TFT lib directly from the repo. Seems to work well - still fighting some CI issues that I expect to solve soon |
By "invertible" I meant indeed that It's understood that even the standard STFT must meet a certain window overlap to be transparent. My question is whether this can be the case for the wavelet transform, too, or, in other words, whether spectral editing can be implemented on the basis of the wavelet transform. Someone like @teetow manifested his interest in this, so that he wouldn't need to change the window size so often when spectral-editing events of contrasting time-frequency characteristics.
With appropriate signal, window choice and care, spectral-edit artefacts can be reduced to something inaudible. It'll mainly be the responsibility of the user to make sure it's that way. Ours will only be to enforce that editing is only available for invertible transforms (and maybe provide some intelligence in selection tools to reduce the risk of a frequency lobe being cut in its middle and only half of it removed). |
Yes, that'd be the part of the "intelligence in selection tools" I just mentioned. I'd probably start with the topic after the basic tools are implemented and user feedback is collected. |
|
So-called "tight frames" do exist for wavelet transforms, ie a combination of a wavelet function and a grid in the time/scale plane on which to calculate values. They also provide for reconstructing the original signal from the transform. But at the expense of diverting to "scale" instead of "frequency" which makes time/frequency interpretation more of a challenge. Also, the grid would be a dyadic grid which is very coarse on the scale (frequency) axis (one division per octave) and thus not really useful for audio sounds In the current implementation there are multiple divisions per octave. Due to constraints on discretisation (sampling is not continuous) it is not really practically feasible to perfectly re-construct the original signal. But by over-sampling in the time/frequency plane you can get pretty close - in theory. There are practical aspects related to the non-uniform areas related to sampling in the time/frequency plane - but my BELIEF is that this is should not be a practical obstacle As already expressed, I more tend to see the constant-Q spectrogram as nice tool for visualisation along with standard stft - but then again I know so little about Audacity use cases :-). It would be nice to look into some practical examples of what users would like to achieve |
|
Ok, pity that there isn't a straightforward way. I didn't quite understand your explanation about over-sampling. I don't necessarily have to either for now, interesting is mainly how much more complex it would be to make it transparent. (When you say "pretty close", what kind of SNR are we talking about?) If it's awkward and/or doesn't provide sufficient quality, then never mind, the wavelet transform would go in the can't-do-spectral-edits-with-your-settings category and just stay a nice analysis tool :) |
|
@saintmatthieu Regarding overlap in time/frequency plane: Overlap is a pragmatic definition from my side. Considering the bandwidth and duration of the gaussian wavelets constituting the transform, an area in the time/frequency plane pertaining to the wavelets can be defined. By over-populating the plane, an overlap occurs between the wavelet areas |
|
Interesting, thanks for sharing! |
Yes exactly |
|
@kgramhans hi! |
@saintmatthieu Hi again! Also, as a follow-up action from our discussions, I will conduct a practical experiment on the feasibility of reconstructing the original signal from the Constant-Q transform. I will do that in the context of the tft project, I have created on Github by extending its functionality. I will revert on that whenever I have something to share |
|
@kgramhans I opened a PR on your TFT repository that I'd like you to consider before we proceed with this PR: kgramhans/tft#1 |
saintmatthieu
left a comment
There was a problem hiding this comment.
I'm finished with this review iteration.
Thx for the input. I was working on re-structuring the code myself while introducing unit-testing on the project. Therefore I will silently close your PR and incorporate it into those changes |
|
@saintmatthieu |
|
About the failing check: I don't see why. Please try to rebase on latest master (cleaning your commit history in the doing) and let's hope it just goes away. |
LINUX compile issues fixed? Uncrustify && LINUX build errors Fixing unittest compile issue Using FetchContent for building tft lib This may be the reason for a failing MAC build? Working on Win compile Making Constant-Q Spectrogram dead code for now as suggested during review Code style issue Review comment: Simplifying project files Review comments Fixing checks Review
8dbf852 to
d0f119f
Compare
Seems like it cured it. I have then nothing more on the to-do list :-) |


Resolves: #9509
Constant-Q Spectrogram into Audacity 4
The current Pull request deals with optimised calculation of Constant-Q spectrogram which was already added to Audacity 3 code base
Recommended:
QA: