pytimbre.spectral.timbral_model.timbral_util

Functions

butter_bandpass(lowcut, highcut, fs[, order])

Design a butterworth bandpass filter

calculate_attack_time(envelope_samples, fs)

Calculate the attack time from the envelope of a signal.

calculate_bandwidth_gradient(...)

Calculate the gradient ferom the bandwidth array

calculate_onsets(audio_samples, ...[, ...])

Calculates the onset times using a look backwards recursive function to identify actual note onsets, and weights

calculate_rms_enveope(audio_samples[, ...])

Calculate the RMS envelope of the audio signal.

channel_reduction(audio_samples[, ...])

Algorithm for reducing the number of channels in a read-in audio file

check_upsampling(audio_samples, fs[, lowest_fs])

Check if upsampling needfs to be applied, then perform it if necessary

db2mag(dB)

Converts from dB to linear magnitude.

detect_peaks(array[, freq, cthr, ...])

Function detects the peaks in array, based from the mirpeaks algorithm.

fast_hilbert(array[, use_matlab_hilbert])

Calculates the hilbert transform of the array by segmenting signal first to speed up calculation.

fast_hilbert_spectrum(array[, ...])

Calculates the hilbert transform of the array by segmenting signal first to speed up calculation.

file_read(fname[, fs, phase_correction, ...])

Read in audio file, but check if it's already an array

filter_audio_bandpass(audio_samples, f0, ...)

Calculate and apply an n/octave butterworth bandpass filter, centred at f0 Hz.

filter_audio_highpass(audio_samples, ...[, ...])

Calculate and apply a high-pass filter, with a -3dB point of crossover.

filter_audio_lowpass(audio_samples, ...[, order])

Calculate and apply a low-pass filter, with a -3dB point of crossover.

filter_design2(Fc, fs, N)

Design Butterworth 2nd-order one-third-octave filter.

get_bandwidth_array(audio_samples, fs[, ...])

Calculate the bandwidth array estimate for an audio signal.

get_percussive_audio(audio_samples[, ...])

Gets the percussive comonent of the audio file.

get_spectral_features(audio, fs[, lf_limit, ...])

This function calculates the spectral centroid and spectral spread of an audio array.

isodd(num)

log_sum(array)

This function calculates the log sum of an array

loud_norm(audio[, fs, target_loudness])

Takes in audio data and returns the same audio loudness normalised

matlab_hilbert(signal)

Define a method for calculating the hilbert transform of a 1D array using the method from Matlab

normal_dist(array[, theta, mean])

output_clip(score[, min_score, max_score])

Limits the output of the score between min_score and max_score

return_loop(onset_loc, envelope, ...[, nperseg])

This function is used by the calculate_onsets method.

sample_and_hold_envelope_calculation(...[, ...])

Calculates the envelope of audio_samples with a 'sample and hold' style function.

sigmoid(x[, offset, n])

specific_loudness(x[, ...])

Calculates loudness in 3rd octave bands based on ISO 532 B / DIN 45631 Source: BASIC code in J Acoust Soc Jpn( E) 12, 1(1991)

spectral_flux(spectrogram[, method])

This computes the spectral flux: the difference between sucesive spectrogram time frames

weighted_bark_level(audio_samples, fs[, ...])

window_audio(audio_samples[, window_length])

Segment the audio samples into a numpy array the correct size and shape, so that each row is a new window of audio