Repository navigation
Conversation
…_pressure_gradient 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 four utilities that the ITA-Toolbox has (
ita_multitone,ita_xfade_spk,ita_cutImpulseTrainandita_velocity_from_pressure_gradient):pytta.generate.multitone(freqs, amplitude=1, phase=0, samplingRate=None, fftDegree=None): a sum of sines at the frequenciesfreqsrounded to the nearest DFT bin, so that every tone has a whole number of periods. The logarithmic and fixed factor spacings ofita_multitonearefreqs = numpy.geomspace(...), and the phase can be one for all tones or one per tone.crossfade_spectra(signal_low, signal_high, freqs): the spectrum ofsignal_lowbelowfreqs[0]and ofsignal_highabovefreqs[1], with raised cosine weights between them that add up to 1, asita_xfade_spk.cut_impulse_train(signal, threshold=0.7, length=1, start_before=0.004, ref_channel=0): the impulses of an impulse train, detected on one channel with the thresholdthreshold * L_max + (1 - threshold) * L_rmsofita_cutImpulseTrainand cut at the same samples in every channel. It returns oneSignalObjper channel, whose channels are the impulses, and the 0-based start samples.velocity_from_pressure_gradient(signal, distance, rho=1.2, c=343, normalized=False): the particle velocity midway between two microphones from Euler's equation, v = (p0 - p1) / (jωρd), times ρc ifnormalized.The ITA code was read for its semantics only and nothing was copied. Indices are 0-based.
The tests in
tests/test_dsp_misc.pyprint the measured differences:freqs[0]and of the high one abovefreqs[1](2.2e-8), and a signal crossfaded with itself comes back exactly.cut_impulse_traingives the start samples and the cuts ofita_cutImpulseTrainexactly, on a train of four decaying bursts in two channels fromtests/golden/make_cut_impulse_train_ita.m(MATLAB R2026b).multitonewith a NumPy array asfreqs, as in its docstring, needs #59, sinceSignalObjcompares the first local variable of the calling function with the new object; a list works without it. Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures ofdevelopment(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