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>
…horn profile to pytta.loudspeaker Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…eaker 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 to
pytta.loudspeakerthe loudspeaker tools of the measurement application of the ITA-Toolbox that build on the Thiele-Small parameters (ita_thielesmall2velocity,ita_loudspeakertools_maxSPL,ita_radiation_impedance,ita_enclosure_fitfor the closed box,ita_calculate_horn_geometry,ita_thiele_small_fit,ita_thiele_small_fit_weighted,ita_inductance_fitandita_curvefit_inductance):response(params, freq, area, voltage=2.83, distance=1): the small signal response of the driver in an infinite baffle, with the diaphragm velocity and displacement, the current, the pressure on axis and its SPL, the radiated power and the efficiency.max_spl(params, freq, area, xmax, power_max): the largest SPL at each frequency limited by the peak excursion and by the power in Re, with the voltage and which limit applies.radiation_impedance(freq, radius): the impedance of a rigid piston in an infinite baffle, with the Bessel and Struve functions (Beranek and Mellow, Acoustics: Sound Fields and Transducers, 2012, eqs. 13.117 and 13.118).closed_box(params, Vb): fc = fs √(1 + Vas / Vb) and Qtc = Qts √(1 + Vas / Vb) without box losses (Small 1972; Beranek and Mellow, eq. 7.28).horn_profile(throat_area, cutoff, length, a=1): the area along a hyperbolic-exponential horn, from hyperbolic (a = 0) to exponential (a = 1), with xT = c / (2π fc) (Beranek and Mellow, eqs. 9.39, 9.51 and 9.58).fit_with_velocity(freq, impedance, velocity, weights=None): Re, Le, Bl, Rms, Mms and Cms from the impedance and the diaphragm velocity per volt measured together, by two linear least squares problems, Z = Re + jωLe + Bl G and Bl / G = Rms + jωMms + 1 / (jωCms) with G = v / i, optionally weighted per frequency.voice_coil_model(params, freq)andfit_voice_coil(freq, blocked, model='L2R2', Re=None): the blocked impedance of the voice coil, Re + jωLe, the L2R2 model with an eddy current branch, or Re + K (jω)^n (Leach, "Loudspeaker voice-coil inductance losses", J. Audio Eng. Soc. 50(6), 2002), and its least squares fit.This pull request builds on #82 and shows its commits until #82 is merged. The ITA functions belong to an application of the ITA-Toolbox whose license is "all rights reserved", so only their help text was read and the functions are written from the references. The equalization, IIR model and impulse response shortening of that application are covered by
invert_spectrum(#113),invfreqz(#110) andtime_window(#49).The tests, added to
tests/test_loudspeaker.py, print the measured values:max_splgives the voltage at which the peak excursion is exactly xmax at 20 and 40 Hz and the power in Re exactlypower_maxat 1 kHz.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