Analysis

class untwist.analysis.ZCR[source]

Zero-crossing rate (can be used as rough pitch estimator or as feature).

process(wave)[source]
class untwist.analysis.HPS(n_harms=8, min_pitch=50, max_pitch=5000)[source]

Harmonic product spectrum pitch estimator. Based on implementation in: Lerch, A. (2012). An introduction to audio content analysis: Applications in signal processing and music informatics. John Wiley & Sons.

process(X)[source]
class untwist.analysis.YINFFT(n_bins, sample_rate, min_pitch=100, max_pitch=5000, interp=True)[source]

YINFFT F0 estimation algorithm Brossier, P. M. (2006). Automatic annotation of musical audio for interactive applications (Doctoral dissertation, Queen Mary University of London). Based on Essentia C++ implementation http://essentia.upf.edu

compute_weights()[source]
freq_mask = [0.0, 20.0, 25.0, 31.5, 40.0, 50.0, 63.0, 80.0, 100.0, 125.0, 160.0, 200.0, 250.0, 315.0, 400.0, 500.0, 630.0, 800.0, 1000.0, 1250.0, 1600.0, 2000.0, 2500.0, 3150.0, 4000.0, 5000.0, 6300.0, 8000.0, 9000.0, 10000.0, 12500.0, 15000.0, 20000.0, 25100]
process(spectrogram)[source]
weight_mask = [-75.8, -70.1, -60.8, -52.1, -44.2, -37.5, -31.3, -25.6, -20.9, -16.5, -12.6, -9.6, -7.0, -4.7, -3.0, -1.8, -0.8, -0.2, -0.0, 0.5, 1.6, 3.2, 5.4, 7.8, 8.1, 5.3, -2.4, -11.1, -12.8, -12.2, -7.4, -17.8, -17.8, -17.8]
class untwist.analysis.OnsetDetector(func='hfc', threshold=-0.5, moving_size=4, median_size=401)[source]

Onset detector based on comon detection functions. Based on: Bello, J. P., Daudet, L., Abdallah, S., Duxbury, C., Davies, M., & Sandler, M. B. (2005). A tutorial on onset detection in music signals. IEEE Transactions on speech and audio processing, 13(5), 1035-1047.

complex_diff(X)[source]

Complex difference

energy(X)[source]

Spectrum energy

hfc(X)[source]

High frequency content

mag_diff(X)[source]

Magnitude difference

phase_diff(X)[source]

Phase difference

process(X)[source]