Repository navigation
Conversation
Adds to pytta.functions nine editing utilities that the ITA-Toolbox has: envelope (ita_envelope, the magnitude of the analytic signal), start_ir (ita_start_IR, the start of an impulse response by ISO 3382-1, A.3), time_shift (ita_time_shift, cyclic, fractional shifts as a linear phase, or the start of the response to the first sample), append (ita_append), normalize (ita_normalize_dat and ita_normalize_spk), amplify_to (ita_amplify_to, to a mean RMS level), zero_phase, randomize_phase and quantize (ita_zerophase, ita_randomize_phase, ita_quantize). Tests check start_ir and quantize against the ITA-Toolbox on golden data from tests/golden/make_dsp_edit_ita.m (identical), the envelope of an AM tone against its formula and against ITA (1.2e-7), integer and fractional shifts, the peak and level rules, and that the phase edits keep the magnitude spectrum. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 31, 2026
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.functionsnine editing utilities that the ITA-Toolbox has (ita_envelope,ita_start_IR,ita_time_shift,ita_append,ita_normalize_dat,ita_normalize_spk,ita_amplify_to,ita_zerophase,ita_randomize_phaseandita_quantize):envelope(signal): the magnitude of the analytic signal, computed on twice the signal length, asita_envelope.start_ir(signal, threshold=20): the 0-based start sample of each channel of an impulse response, by ISO 3382-1:2009, A.3. It is the last sample before the peak that lies 20 dB below it, moved back to the last such sample before an earlier one 6 dB above that level (an oscillating onset), asita_start_IR.time_shift(signal, shift=None, unit='time'): a cyclic shift in seconds or samples, one for all channels or one per channel. A fraction of a sample is applied as a linear phase. With no shift, the earliest start of the response moves to the first sample.append(signal1, signal2): concatenation in time.normalize(signal, domain='time', per_channel=False): the signal scaled so that its largest magnitude, in time or in the spectrum, is 1, with the gain removed.amplify_to(signal, level): the signal scaled so that the mean RMS of its channels isleveldB, re 20 µPa for channels in Pa.zero_phase(signal)andrandomize_phase(signal, seed=None): the magnitude spectrum with zero or random phase.quantize(signal, bits=24): rounding to 2^(bits - 1) + 1 intervals across the peak, halves away from zero, asita_quantize.The ITA code was read for its semantics only and nothing was copied. Indices are 0-based.
The tests in
tests/test_dsp_edit.pyprint the measured differences:start_irgives the starts ofita_start_IRon three decaying responses with a weak lead-in, on golden data fromtests/golden/make_dsp_edit_ita.m(MATLAB R2026b).ita_envelopefor the same samples (1.2e-7).normalizebrings the peak to 1 and returns it, per channel too, andamplify_tosets the level of a signal in Pa to 70 dB.zero_phaseandrandomize_phasekeep the magnitude spectrum, and the zero-phase signal is even.appendconcatenates and rejects different sampling rates, andquantizegives the samples ofita_quantizeexactly.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