audio_dspy package¶
Submodules¶
audio_dspy.adaptive_filt module¶
-
audio_dspy.adaptive_filt.
LMS
(input, desired, mu, L)¶ Performs LMS adpative filtering on input signal
Parameters: input : array-like
Input signa;- desired : array-like
- Desired signal
- mu : float
- Learning rate
- L : int
- Length of adaptive filter
Return: y : array-like
Filtered signal- e : array-like
- Error signal
- w : array-like
- Final filter coefficients (of length L)
-
audio_dspy.adaptive_filt.
NLMS
(input, desired, mu=0.1, L=7)¶ Performs Norm LMS adpative filtering on input signal
Parameters: input : array-like
Input signa;- desired : array-like
- Desired signal
- mu : float
- Learning rate
- L : int
- Length of adaptive filter
Return: y : array-like
Filtered signal- e : array-like
- Error signal
- w : array-like
- Final filter coefficients (of length L)
-
audio_dspy.adaptive_filt.
NL_LMS
(input, desired, mu, L, g, g_prime)¶ Performs Nonlinear LMS adaptive filtering on input signal
Parameters: input : array-like
Input signa;- desired : array-like
- Desired signal
- mu : float
- Learning rate
- L : int
- Length of adaptive filter
- g : lambda (float) : float
- Nonlinear function, ex: tanh(x)
- g_prime : lambda (float) : float
- Derivative of nonlinear function, ex 1/cosh(x)^2
Return: y : array-like
Filtered signal- e : array-like
- Error signal
- w : array-like
- Final filter coefficients (of length L)
audio_dspy.delay_utils module¶
-
audio_dspy.delay_utils.
delay_feedback_gain_for_t60
(delay_samp, fs, t60)¶ Calculate the gain needed in a feedback delay line to achieve a desired T60
Parameters: - delay_samp (int) – The delay length in samples
- fs (float) – Sample rate
- t60 (float) – The desired T60 [seconds]
Returns: g – The gain needed to achieve the desired T60 [linear gain]
Return type: float
audio_dspy.eq module¶
-
class
audio_dspy.eq.
EQ
(fs)¶ Bases:
object
An audio equalizer object. Functionally, this this object holds several filters all of which can be created with the eq_design module, and provides several useful functions for interacting with them, including processing, reseting, and plotting.
-
add_HPF
(fc, Q)¶ Add a highpass filter to the EQ
Parameters: - fc (float) – Cutoff frequency
- Q (float) – Q factor
-
add_LPF
(fc, Q)¶ Add a lowpass filter to the EQ
Parameters: - fc (float) – Cutoff frequency
- Q (float) – Q factor
-
add_bell
(fc, Q, gain)¶ Add a bell filter to the EQ
Parameters: - fc (float) – Cutoff frequency
- Q (float) – Q factor
- gain (float) – gain in linear units
-
add_highshelf
(fc, Q, gain)¶ Add a highshelf filter to the EQ
Parameters: - fc (float) – Cutoff frequency
- Q (float) – Q factor
- gain (float) – gain in linear units
-
add_lowshelf
(fc, Q, gain)¶ Add a lowshelf filter to the EQ
Parameters: - fc (float) – Cutoff frequency
- Q (float) – Q factor
- gain (float) – gain in linear units
-
add_notch
(fc, Q)¶ Add a notch filter to the EQ
Parameters: - fc (float) – Cutoff frequency
- Q (float) – Q factor
-
plot_eq_curve
(worN=512)¶ Plots the magnitude response of the EQ
- worN: {None, int, array_like}, optional
- If a single integer, then compute at that many frequencies (default is N=512). If an array_like, compute the response at the frequencies given. These are in the same units as fs.
-
print_eq_info
()¶ Print the specs of the EQ
-
process_block
(block)¶ Process a block of samples.
Parameters: block (array-like) – The block of samples to process Returns: output – Block of output samples Return type: array-like
-
reset
()¶ Resets the state of the EQ
-
-
class
audio_dspy.eq.
Filter
(order, fs, type='Other')¶ Bases:
object
A filter that was created with a function from the eq_design module. Includes useful methods for processing, reseting, and plotting.
-
has_been_reset
()¶ Returns true if the filter state has been cleared
-
process_block
(block)¶ Process a block of samples.
Parameters: block (array-like) – The block of samples to process Returns: output – Block of output samples Return type: array-like
-
process_sample
(x)¶ Processes a sample through the filter, using the Transposed Direct Form II filter form (https://ccrma.stanford.edu/~jos/filters/Transposed_Direct_Forms.html)
Parameters: x (float) – Input sample Returns: y – Output sample Return type: float
-
reset
()¶ Resets the state of the filter
-
set_coefs
(b, a)¶ Set the coefficients of the filter
Parameters: - b (array-like) – Feed-forward coefficients. Must of the length order + 1
- a (array-like) – Feed-back coefficients. Must of the length order + 1
-
audio_dspy.eq_design module¶
-
audio_dspy.eq_design.
add_to_sos
(sos, b, a)¶ Add a new filter to a set of second order sections
Parameters: - sos (array-like) – Set of second order sections
- b (array-like) – feed-forward coefficients of filter to add
- a (array-like) – feed-back coefficients of filter to add
Returns: sos – New set of second order sections
Return type: array-like
-
audio_dspy.eq_design.
bilinear_biquad
(b_s, a_s, fs, matchPole=False)¶ Compute the bilinear transform for a biquad filter with optional pole matching
Parameters: - b_s (array-like) – Analog numerator coefficients
- a_s (array-like) – Analog denominator coefficients
- fs (float) – Sample rate
- matchPole (bool, optional) – Should match the pole frequency with frequency warping
-
audio_dspy.eq_design.
butter_Qs
(n)¶ Generate Q-values for an n-th order Butterworth filter
Parameters: n : int
order of filter to generate Q values forReturns: q_values – Set of Q-values for this order filter Return type: array-like
-
audio_dspy.eq_design.
design_HPF1
(fc, fs)¶ Calculates filter coefficients for a 1st-order highpass filter
Parameters: - fc (float) – Cutoff frequency of the filter in Hz
- fs (float) – Sample rate in Hz
Returns: - b (ndarray) – “b” (feedforward) coefficients of the filter
- a (ndarray) – “a” (feedback) coefficients of the filter
-
audio_dspy.eq_design.
design_HPF2
(fc, Q, fs)¶ Calculates filter coefficients for a 2nd-order highpass filter
Parameters: - fc (float) – Cutoff frequency of the filter in Hz
- Q (float) – Quality factor of the filter
- fs (float) – Sample rate in Hz
Returns: - b (ndarray) – “b” (feedforward) coefficients of the filter
- a (ndarray) – “a” (feedback) coefficients of the filter
-
audio_dspy.eq_design.
design_HPFN
(fc, Q, N, fs)¶ Calculates filter coefficients for a Nth-order highpass filter
Parameters: - fc (float) – Cutoff frequency of the filter in Hz
- Q (float) – Quality factor of the filter
- N (int) – Desired filter order
- fs (float) – Sample rate in Hz
Returns: sos – Filter coefficients as a set of second-order sections
Return type: ndarray
-
audio_dspy.eq_design.
design_LPF1
(fc, fs)¶ Calculates filter coefficients for a 1st-order lowpass filter
Parameters: - fc (float) – Cutoff frequency of the filter in Hz
- fs (float) – Sample rate in Hz
Returns: - b (ndarray) – “b” (feedforward) coefficients of the filter
- a (ndarray) – “a” (feedback) coefficients of the filter
-
audio_dspy.eq_design.
design_LPF2
(fc, Q, fs)¶ Calculates filter coefficients for a 2nd-order lowpass filter
Parameters: - fc (float) – Cutoff frequency of the filter in Hz
- Q (float) – Quality factor of the filter
- fs (float) – Sample rate in Hz
Returns: - b (ndarray) – “b” (feedforward) coefficients of the filter
- a (ndarray) – “a” (feedback) coefficients of the filter
-
audio_dspy.eq_design.
design_LPFN
(fc, Q, N, fs)¶ Calculates filter coefficients for a Nth-order lowpass filter
Parameters: - fc (float) – Cutoff frequency of the filter in Hz
- Q (float) – Quality factor of the filter
- N (int) – Desired filter order
- fs (float) – Sample rate in Hz
Returns: sos – Filter coefficients as a set of second-order sections
Return type: ndarray
-
audio_dspy.eq_design.
design_allpass1
(rho)¶ Design a first-order allpass filter with a set pole location
Parameters: rho (float (-1, 1)) – Pole location Returns: - b (array-like) – Feedforward filter coefficients
- a (array-like) – Feedback filter coefficients
-
audio_dspy.eq_design.
design_bell
(fc, Q, gain, fs)¶ Calculates filter coefficients for a bell filter.
Parameters: - fc (float) – Center frequency of the filter in Hz
- Q (float) – Quality factor of the filter
- gain (float) – Linear gain for the center frequency of the filter
- fs (float) – Sample rate in Hz
Returns: - b (ndarray) – “b” (feedforward) coefficients of the filter
- a (ndarray) – “a” (feedback) coefficients of the filter
-
audio_dspy.eq_design.
design_high_low_shelf
(low_gain, high_gain, fc, fs)¶ Design a first-order shelf filter
Parameters: - low_gain (float) – Low frequency gain
- high_gain (float) – High frequency gain
- fc (float) – Transition frequency
- fs (float) – Sample rate
Returns: - b (array-like) – Feedforward filter coefficients
- a (array-like) – Feedback filter coefficients
- [1] https (//ccrma.stanford.edu/courses/424/handouts.2004/424_Handout22_Filters4_LectureNotes.pdf)
-
audio_dspy.eq_design.
design_highshelf
(fc, Q, gain, fs)¶ Calculates filter coefficients for a High Shelf filter.
Parameters: - fc (float) – Center frequency of the filter in Hz
- Q (float) – Quality factor of the filter
- gain (float) – Linear gain for the shelved frequencies
- fs (float) – Sample rate in Hz
Returns: - b (ndarray) – “b” (feedforward) coefficients of the filter
- a (ndarray) – “a” (feedback) coefficients of the filter
-
audio_dspy.eq_design.
design_lowshelf
(fc, Q, gain, fs)¶ Calculates filter coefficients for a Low Shelf filter.
Parameters: - fc (float) – Center frequency of the filter in Hz
- Q (float) – Quality factor of the filter
- gain (float) – Linear gain for the shelved frequencies
- fs (float) – Sample rate in Hz
Returns: - b (ndarray) – “b” (feedforward) coefficients of the filter
- a (ndarray) – “a” (feedback) coefficients of the filter
-
audio_dspy.eq_design.
design_notch
(fc, Q, fs)¶ Calculates filter coefficients for a notch filter.
Parameters: - fc (float) – Center frequency of the filter in Hz
- Q (float) – Quality factor of the filter
- fs (float) – Sample rate in Hz
Returns: - b (ndarray) – “b” (feedforward) coefficients of the filter
- a (ndarray) – “a” (feedback) coefficients of the filter
audio_dspy.level_detector module¶
-
audio_dspy.level_detector.
level_detect
(x, fs, attack_ms=0.1, release_ms=100, mode='peak')¶ Performs level detection on an input signal
Parameters: - x (ndarray) – Input vector
- fs (float) – Sample rate [Hz]
- attack_ms (float, optional) – Time constant for attack [ms]
- release_ms (float, optional) – Time constant for release [ms]
- mode (string, optional) –
Type of detector. Should be one of:
- ’peak’ (peak detector, default)
- ’rms’ (rms detector)
- ’analog’ (analog style detector, based on detector circuit with Shockley diode)
Returns: y – Output vector
Return type: ndarray
audio_dspy.modal_tools module¶
-
audio_dspy.modal_tools.
design_modal_filter
(amp, freq, tau, fs, fs_measure=None)¶ Designs a modal filter for a modal model
Parameters: - amp (complex float) – Complex amplitude of the mode
- freq (float) – Frequency of the mode [Hz]
- tau (float) – Decay rate of the mode [gain/sample]
- fs (float) – Sample rate
- fs_measure (float, optional) – The sample rate at which the measurements at which the decay rates were measured. To use the same value as fs, set to “None”
Returns: - b (ndarray) – Feed-forward filter coefficients
- a (ndarray) – Feed-back filter coefficients
-
audio_dspy.modal_tools.
energy_envelope
(sig, fs, eta=0.01)¶ Find the energy envelope of a signal
Parameters: - sig (ndarray) – Signal to analyze
- fs (float) – Sample rate of the signal
- eta (float, optional) – Speed of the envelope filter
Returns: envelope – The envelop of the signal
Return type: ndarray
-
audio_dspy.modal_tools.
filt_mode
(x, freq, fs, width, order=4)¶ Filter the signal around a mode frequency
Parameters: - x (ndarray) – The original signal
- freq (float) – The mode frequency to filter out
- fs (float) – The sample rate of the signal
- width (float) – The width of frequencies around the mode to filter
- order (int, optional) – The order of filter to use
Returns: x_filt – The signal filtered around the mode frequency
Return type: ndarray
-
audio_dspy.modal_tools.
find_complex_amplitudes
(freqs, taus, T, x, fs)¶ Find optimal complex amplitudes for the modal frequencies using least squares.
Parameters: - freqs (ndarray) – Mode frequencies [Hz]
- taus (ndarray) – Mode decay rates [gain/sample]
- T (int) – Length of the time vector [samples] to use for optimization
- x (ndarray) – The time domain signal to optimize for
- fs (float) – The sampel rate of the time domain signal
Returns: amps – The complex amplitudes of the modes
Return type: ndarray
-
audio_dspy.modal_tools.
find_decay_rates
(freqs, x, fs, filt_width, thresh=-60, eta=0.01, plot=False)¶ Find the decay rate of a set of modes
Parameters: - freqs (ndarray) – The mode frequencies
- x (ndarray) – The original signal
- fs (float) – Sample rate
- filt_width (float) – The range of frequencies to filter about each mode
- thresh (float, optional) – The threshold at which to stop fitting the decay rate [dB]
- eta (float, optional) – The speed of the filter to use to find the energy envelope of the mode
- plot (bool, optiona;) – Should plot the decay rate model for each mode
Returns: taus – The decay rates in units [gain/sample]
Return type: ndarray
-
audio_dspy.modal_tools.
find_freqs
(x, fs, thresh=30, above=0, frac_off=0.1, plot=False)¶ Find the mode frequencies of a signal
Parameters: - x (ndarray) – signal to analyze
- fs (float) – sample rate of the signal
- thresh (float, optional) – threshold to use for finding modes [dB]
- above (float, optional) – lower limit frequency to look for modes
- frac_off (float, optional) – to avoid finding multiple peaks for the same mode, this parameter defines a fractional offset for frequency breaks between modes
- plot (bool, optional) – should plot this analysis
Returns: - freqs (ndarray) – Mode frequencies [Hz]
- peaks (ndarray) – Mode magnitudes [gain]
-
audio_dspy.modal_tools.
generate_modal_signal
(amps, freqs, taus, num_modes, N, fs, fs_measure=None)¶ Generates a modal signal from modal model information
Parameters: - amps (array-like) – The complex amplitudes of the modes
- freqs (array-like) – The frequencies of the modes [Hz]
- taus (array-like) – The decay rates of the modes [gain/sample]
- num_modes (int) – The number of modes
- N (int) – The length of the signal to generates [samples]
- fs (float) – The sample rate
- fs_measure (float, optional) – The sample rate at which the measurements at which the decay rates were measured. To use the same value as fs, set to “None”
audio_dspy.nonlinearities module¶
-
audio_dspy.nonlinearities.
diodeRect
(x, alpha=1.79, beta=0.2)¶ Implementation of a simple Schottky diode rectifier
Parameters: - x ({float, ndarray}) – input signal
- alpha (float) – input scale factor
- beta (float) – output scale factor
Returns: y – output signal
Return type: {float, ndarray}
-
audio_dspy.nonlinearities.
dropout
(x, width=0.5)¶ Implementation of dropout nonlinearity
Parameters: - x ({float, ndarray}) – input to the nonlinearity
- width (float, optional) – width of the dropout region
Returns: y – output of the nonlinearity
Return type: {float, ndarray}
-
audio_dspy.nonlinearities.
halfWaveRect
(x)¶ Implementation of an ideal half wave rectifier
Parameters: x ({float, ndarray}) – input signal Returns: y – output signal Return type: {float, ndarray}
-
audio_dspy.nonlinearities.
hard_clipper
(x)¶ Implementation of a hard clipper
Parameters: x ({float, ndarray}) – input to the hard clipper Returns: y – output of the hard clipper Return type: {float, ndarray}
-
audio_dspy.nonlinearities.
soft_clipper
(x, deg=3)¶ Implementation of a cubic soft clipper
Parameters: - x ({float, ndarray}) – input to the soft clipper
- deg (int, optional) – polynomial degree of the soft clipper
Returns: y – output of the soft clipper
Return type: {float, ndarray}
audio_dspy.plotting module¶
-
audio_dspy.plotting.
plot_dynamic_curve
(function, freq=100, fs=44100, gain=10, num=1000)¶ Plots the dynamic curve of a nonlinear function at a specific frequency
Parameters: - function (lambda (float) : float) – function to plot the dynamic curve for
- freq (float, optional) – frequency [Hz] to plot the dynamic curve for, defaults to 100 Hz
- fs (float, optional) – sample rate [Hz] to use for the simulation, defaults to 44.1 kHz
- gain (float, optional) – range of gains on which to plot the dynamic curve [-gain, gain]
- num (int, optional) – number of points to plot
-
audio_dspy.plotting.
plot_freqz_angle
(w, H, log=True)¶ Plots the phase output of the scipy.signal.freqz function
Parameters: - w (ndarray) – w output of freqz
- H (ndarray) – H output of freqz
- log (bool, optional) – Should plot log scale
-
audio_dspy.plotting.
plot_freqz_mag
(w, H, norm=False)¶ Plots the magnitude output of the scipy.signal.freqz function
Parameters: - w (ndarray) – w output of freqz
- H (ndarray) – H output of freqz
- norm (bool, optional) – Should normalize the magnitude response
-
audio_dspy.plotting.
plot_harmonic_response
(function, freq=100, fs=44100, gain=0.1, num=10000)¶ Plots the harmonic response of a nonlinear function at a specific frequency
Parameters: - function (lambda (float) : float) – function to plot the harmonic response for
- freq (float, optional) – frequency [Hz] to plot the harmonic response for, defaults to 100 Hz
- fs (float, optional) – sample rate [Hz] to use for the simulation, defaults to 44.1 kHz
- gain (float, optional) – gain to use for the input signal, defaults to 0.1
- num (int, optional) – number of points to plot
-
audio_dspy.plotting.
plot_magnitude_response
(b, a, worN=512, fs=6.283185307179586, norm=False)¶ Plots the magnitude response of a digital filter in dB, using second order sections
Parameters: - b (ndarray) – numerator (feed-forward) coefficients of the filter
- a (ndarray) – denominator (feed-backward) coefficients of the filter
- worN ({None, int, array_like}, optional) – If a single integer, then compute at that many frequencies (default is N=512). If an array_like, compute the response at the frequencies given. These are in the same units as fs.
- fs (float, optional) – sample rate of the filter
- norm (bool, optional) – Should normalize the magnitude response
-
audio_dspy.plotting.
plot_magnitude_response_sos
(sos, worN=512, fs=6.283185307179586, norm=False)¶ Plots the magnitude response of a digital filter in dB
Parameters: - sos (array-like) – Filter to plot as a series of second-order sections
- worN ({None, int, array_like}, optional) – If a single integer, then compute at that many frequencies (default is N=512). If an array_like, compute the response at the frequencies given. These are in the same units as fs.
- fs (float, optional) – sample rate of the filter
- norm (bool, optional) – Should normalize the magnitude response
-
audio_dspy.plotting.
plot_phase_response
(b, a, worN=512, fs=6.283185307179586, log=True)¶ Plots the phase response of a digital filter in radians
Parameters: - b (ndarray) – numerator (feed-forward) coefficients of the filter
- a (ndarray) – denominator (feed-backward) coefficients of the filter
- worN ({None, int, array_like}, optional) – If a single integer, then compute at that many frequencies (default is N=512). If an array_like, compute the response at the frequencies given. These are in the same units as fs.
- fs (float, optional) – sample rate of the filter
- log (bool, optional) – Should plot log scale
-
audio_dspy.plotting.
plot_phase_response_sos
(sos, worN=512, fs=6.283185307179586, log=True)¶ Plots the phase response of a digital filter in radians, using second order sections
Parameters: - sos (array-like) – Filter to plot as a series of second-order sections
- worN ({None, int, array_like}, optional) – If a single integer, then compute at that many frequencies (default is N=512). If an array_like, compute the response at the frequencies given. These are in the same units as fs.
- fs (float, optional) – sample rate of the filter
- log (bool, optional) – Should plot log scale
-
audio_dspy.plotting.
plot_spectrogram
(x, fs, win_size=1024, dbRange=180, title='')¶ Plots a dB spectrogram of the input signal and takes care of most of the formatting to get a standard log frequency scale spectrogram.
Parameters: - x (array-like) – Signal to plot the spectrogram of
- fs (float) – Sample rate of the signal
- win_size (int, optional) – Window size to use (default 1024)
- dbRange (float, optional) – The range of Decibels to include in the spectrogram (default 180)
- title (string, optional) – The title to use for the figure
-
audio_dspy.plotting.
plot_static_curve
(function, gain=10, num=1000)¶ Plots the static curve of a nonlinear function
Parameters: - function (lambda (float) : float) – function to plot the static curve for
- gain (float, optional) – range of gains on which to plot the static curve [-gain, gain]
- num (int, optional) – number of points to plot
-
audio_dspy.plotting.
zplane
(b, a, radius=1.5)¶ Plots the pole-zero response of a digital filter
Parameters: - b (array-like) – feed-forward coefficients
- a (array-like) – feed-back coefficients
- radius (float) – The radius to plot for (default 1.5)
audio_dspy.prony module¶
-
audio_dspy.prony.
allpass_warp
(rho, h)¶ Performs allpass warping on a transfer function
Parameters: - rho (float) – Amount of warping to perform. On the range (-1, 1). Positive warping “expands” the spectrum, negative warping “shrinks”
- h (ndarray) – The transfer function to warp
Returns: h_warped – The warped transfer function
Return type: ndarray
-
audio_dspy.prony.
allpass_warp_roots
(rho, b)¶ Performs allpass warping on a filter coefficients
Parameters: - rho (float) – Amount of warping to perform. On the range (-1, 1). Positive warping “expands” the spectrum, negative warping “shrinks”
- b (ndarray) – The filter coefficients
Returns: b_warped – The warped filter coefficients
Return type: ndarray
-
audio_dspy.prony.
prony
(x, nb, na)¶ Uses Prony’s method to generate IIR filter coefficients that optimally match a given transfer function
Parameters: - x (ndarray) – Numpy array containing the transfer function
- nb (int) – Number of feedforward coefficients in the resulting filter
- na (int) – Number of feedback coefficients in the resulting filter
Returns: - b (ndarray) – Feedforward coefficients
- a (ndarray) – Feedback coefficients
-
audio_dspy.prony.
prony_warped
(x, nb, na, rho)¶ Uses Prony’s method with frequency warping to generate IIR filter coefficients that optimally match a given transfer function
Parameters: - x (ndarray) – Numpy array containing the transfer function
- nb (int) – Number of feedforward coefficients in the resulting filter
- na (int) – Number of feedback coefficients in the resulting filter
- rho (float) – Amount of warping to perform. On the range (-1, 1). Positive warping “expands” the spectrum, negative warping “shrinks”
Returns: - b (ndarray) – Feedforward coefficients
- a (ndarray) – Feedback coefficients
audio_dspy.sweeps module¶
-
audio_dspy.sweeps.
sweep2ir
(dry_sweep, wet_sweep)¶ Converts a pair of input/output sine sweeps into an impulse response
Parameters: - dry_sweep (ndarray) – The dry sine sweep used as input to the system
- wet_sweep (ndarray) – The wet sine sweep, output of the system
Returns: h – The impulse response of the system
Return type: ndarray
-
audio_dspy.sweeps.
sweep_lin
(f0, f1, duration, fs)¶ Generates a linear sine sweep
Parameters: - f0 (float) – The frequency [Hz] at which to begin the sine sweep
- f1 (float) – The frequency [Hz] at which to stop the sine sweep
- duration (float) – The length of time [seconds] over which to sweep the signal
- fs (float) – The sample rate [Hz]
Returns: x – A numpy array containing the sine sweep signal
Return type: ndarray
-
audio_dspy.sweeps.
sweep_log
(f0, f1, duration, fs)¶ Generates a logarithmic sine sweep
Parameters: - f0 (float) – The frequency [Hz] at which to begin the sine sweep
- f1 (float) – The frequency [Hz] at which to stop the sine sweep
- duration (float) – The length of time [seconds] over which to sweep the signal
- fs (float) – The sample rate [Hz]
Returns: x – A numpy array containing the sine sweep signal
Return type: ndarray
audio_dspy.transfer_function_tools module¶
-
audio_dspy.transfer_function_tools.
tf2linphase
(h, normalize=True)¶ Converts a transfer function to linear phase
Parameters: h (ndarray) – Numpy array containing the original transfer function Returns: h_lin – Numpy array containing the linear phase transfer function Return type: ndarray
-
audio_dspy.transfer_function_tools.
tf2minphase
(h, normalize=True)¶ Converts a transfer function to minimum phase
Parameters: h (ndarray) – Numpy array containing the original transfer function Returns: h_min – Numpy array containing the minimum phase transfer function Return type: ndarray
Module contents¶
-
audio_dspy.
impulse
(N)¶ Create an impulse of length N
Parameters: N (int) – Length of the impulse Returns: h – Generated impulse response Return type: array-like
-
audio_dspy.
normalize
(x)¶ Normalize an array of data (real or complex)
Parameters: x (array-like) – Data to be normalized Returns: y – Normalized data Return type: array-like