Repository navigation
Conversation
For signalType 'power', _ifft multiplied the whole half spectrum into the AC slice [1:, :], one row short, so building a SignalObj from a spectrum (domain='freq') raised a broadcast error. Index [1:, :] on both sides; the round trip time -> freq -> time closes at the float32 floor. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Smooth the magnitude spectrum over 1 / nthOct octave and keep the phase. The magnitude is interpolated onto a 1 cent logarithmic grid spanning the 20 octaves below Nyquist, box averaged over 1200 / nthOct cents (made odd, shrinking at the ends of the grid) and interpolated back onto the bins with a not-a-knot cubic spline. The DC bin is copied. Follows the LogFreqOctave1 smoothing of ita_smooth in the ITA-Toolbox (RWTH Aachen). Tests pin each rule on spectra built bin by bin and compare 1, 1/3 and 1/12 octave with the ITA-Toolbox output stored in tests/golden/smooth_frequency_ita.mat, which tests/golden/make_smooth_frequency_ita.m regenerates with MATLAB. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
smooth_notches(signalObj, nthOct=3, threshold=3, squeeze=0.3)topytta.functions, the "compare and squeeze" ofita_smooth_notchesof the ITA-Toolbox (after S. Müller), which makes the notches of a spectrum shallower before it is inverted, e.g. for loudspeaker equalization.The magnitude is compared with its smoothing over 1 / nthOct octave (
smooth_frequencyof #50, the 'LogFreqOctave1' smoothing of the ITA-Toolbox). Every notch deeper thanthresholddB below the smoothed curve is taken from where the magnitude last crossed it to where it crosses it again. There the ratio of the two is raised tosqueeze, so that the notch keepssqueezetimes its depth in dB, and the phase is kept. Withthreshold0, every bin below the smoothed curve is squeezed.The ITA-Toolbox smooths with a Savitzky-Golay filter when the Curve Fitting Toolbox is there; here the box smoothing of
smooth_frequencyis used. The ITA code was read for its semantics only and nothing was copied.This pull request builds on #50 and shows its commit until #50 is merged.
The tests in
tests/test_smooth_notches.pyuse the spectrum of a peaking filter at 1 kHz:SignalObj).Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of
development(3 intest_h5io.py, 4 intest_pyttasave.py) are the same with and without this change.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com