Repository navigation
Conversation
New module pytta.loudspeaker estimates the small signal parameters of an electrodynamic loudspeaker from its electrical impedance, given as a SignalObj or as (freq, Z) arrays. thiele_small reads fs, Re, Qms, Qes and Qts from the impedance peak and the two frequencies where |Z| = sqrt(Rmax Re) (Small 1972; Beranek and Mellow 2012, section 6.10). A second curve with an added mass or in a closed box of known volume gives Mms, Cms, Rms, Bl and Vas. With fit=True every curve is refined by a least squares fit of the lumped model, which also returns Le and removes the bias that Le causes in the closed form. impedance_model returns Z = Re + j w Le + Zmot of the same model. Six tests: recovery of the parameters from synthetic curves for the impedance, added mass, added volume and fit methods, parity with ita_linear_loudspeaker and ita_thiele_small of the ITA-Toolbox (golden data and generator script in tests/golden), and rejection of invalid input. 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
pytta.loudspeakerwith the Thiele-Small parameters of a loudspeaker from its electrical impedance, asita_thiele_smallin the ITA-Toolbox. The ITA code was read for its semantics only and nothing was copied.impedance_model(params, freq): the impedance of the lumped model, Z = Re + j ω Le + Re (Qms/Qes) / (1 + j Qms (f/fs - fs/f)).thiele_small(impedance, Re=None, area=None, added_mass=None, impedance_with_mass=None, added_volume=None, impedance_in_box=None, fit=False, c=343.2, rho=1.204): the impedance is a SignalObj or a(freq, Z)pair.fit=True, the closed form is refined by a least squares fit of Re, fs, Qms, Qes and Le to the whole curve (scipy.optimize.least_squares).The equations follow Beranek and Mellow, Acoustics: Sound Fields and Transducers (2012), section 6.10, eq. 6.58 and 6.59 for the Q values, 6.66 for the added mass and 6.69 to 6.72 for the closed box, and the technical note "Measuring Thiele/Small parameters" of SB Acoustics.
The tests in
tests/test_loudspeaker.pyprint the measured differences:impedance_modelwithin 6.5e-7, relative.tests/golden/make_thiele_small_ita.m(MATLAB R2026b):impedance_modelmatchesita_linear_loudspeakerwithin 8e-16, and the estimates matchita_thiele_smallwithin 0.53 %. That remaining difference comes from ITA reading the peak and the bandwidth at whole bins, while this module interpolates. Against the true values the estimates of this module are within 4e-5.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