AudioSamples Python

Documentation

  • Moving from librosa
    • Install it from source
    • Evidence
      • Whole benchmark
      • Reading files
      • Start-up
      • Threads
      • Install
      • Agreement with librosa
    • A complete pipeline, side by side
    • The differences that will trip you up
      • The audio carries its rate
      • Reading a file changes nothing
      • Precision follows the input
      • Some defaults are different on purpose
      • Boolean results
      • Shapes and channel layout
      • Errors where librosa warns or carries on
      • Resampling is not soxr
      • Keyword names
    • Getting librosa’s exact results
    • Recipes
      • Features for machine learning
      • Batch processing a directory, with threads
      • Beat tracking
      • Harmonic-percussive separation
      • Pitch tracking with pYIN
      • Time-stretch and pitch-shift
      • Griffin-Lim
      • Plotting
      • Example audio
      • Other file formats
      • To NumPy, PyTorch and scikit-learn
    • Checking your code
    • Migrating gradually
    • When to stay on librosa
  • Coming from librosa
    • Conventions
    • Examples
      • STFT and inverse STFT
      • Mel spectrogram in dB, MFCC and deltas
      • Spectral features and chroma
      • Onsets, tempo and beats
      • Effects and resampling
      • Pitch tracking
    • Equivalence tables
      • Core: audio
      • Core: spectral representations
      • Core: constant-Q
      • Core: pitch, tuning and harmonics
      • Core: unit conversions (librosa.convert)
      • librosa.feature
      • librosa.effects
      • librosa.onset and librosa.beat
      • librosa.decompose
      • librosa.filters
      • librosa.util
      • librosa.segment and librosa.sequence
      • librosa.display
    • Differences from librosa
      • Shapes and types
      • Defaults that differ from librosa
      • Resampling (no soxr)
      • Errors where librosa warns or fails late
      • Randomness
      • Options reached through array forms
      • Options that are not supported
      • Deliberate behavioural differences
      • Methods that are not librosa-compatible
  • Tutorials: a short course in speech and audio processing
    • 01. Sampling and aliasing
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 02. Quantisation and dither
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 03. The DFT, windows and leakage
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 04. STFT and spectrograms
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 05. Convolution and FIR filters
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 06. IIR filters: design, poles, zeros and stability
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 07. Resampling
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 08. LPC, the source-filter model and formants
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 09. Pitch: autocorrelation and YIN
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 10. Cepstrum, mel and MFCC
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 11. Short-time energy, zero crossings and voice activity detection
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 12. Dynamics: compressors and limiters
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 13. Onsets and tempo
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
    • 14. Psychoacoustics and codecs
      • Concept
      • With the library
      • How it works
      • Ask the library to explain
      • Exercises
      • Common pitfalls
      • See also
      • References
  • For instructors
    • What the library gives a course
    • How the tutorials are organised
      • Making a student version
      • Everything is checked
    • Suggested labs
    • Verifying results against SciPy and librosa
    • Known limitations
    • Setting up a course environment
  • Examples
    • Example gallery
      • Loading and saving
        • Read and write WAV and FLAC
        • Read a long file in blocks
      • Spectrograms
        • Constant-Q transform
        • STFT spectrogram
      • Mel and MFCC
        • Chroma
        • Mel spectrogram
        • MFCC
        • Perceptual scales, loudness weighting and mu-law
      • Pitch
        • Harmonics of a tone
        • Pitch tracking with YIN and pYIN
      • Beats and onsets
        • Beat tracking and tempo
        • Onset detection
        • Tempogram
      • Separation
        • Harmonic and percussive separation
      • Effects
        • Compressor and limiter
        • Trim silence and find active regions
        • Time stretch and pitch shift
      • Resampling
        • Process many clips with threads
        • Resampling quality
      • Filters
        • Low-pass and high-pass filters
        • Parametric EQ
      • Plotting
        • One-call overview
        • Stereo channels
        • Waveform, spectrum and spectrogram
    • Going further
  • Threads and free-threaded Python
    • What you can do
    • What raises an exception
    • What you must not do
    • Thread pools
    • Scaling
  • API Reference
    • AudioSamples Core
      • AudioSamples Class
        • Key Features
      • Filter and EQ Configuration Classes
      • API Reference
        • AudioSamples
    • Spectral Analysis
      • AudioSamples methods
      • Array functions (audio_samples.spectral)
        • Transforms
        • Decibel conversions
        • Filterbanks and windows
        • Features from spectrograms
      • Unit conversions (audio_samples.utils)
        • hz_to_mel()
        • mel_to_hz()
        • mel_frequencies()
        • hz_to_midi()
        • midi_to_hz()
        • time_to_samples()
        • samples_to_frames()
        • frames_to_samples()
        • time_to_frames_floor()
        • frames_to_time()
        • time_to_frames()
        • times_like()
        • samples_like()
        • mu-law codes
      • Example
    • Features, Tonal, Constant-Q and Pitch Analysis
      • AudioSamples methods
        • Frame-wise features
        • Tonal
        • Constant-Q
        • Pitch tracking
      • Array functions (audio_samples.features)
        • Spectral descriptors
        • Frequency weighting
        • Tonal
        • Constant-Q
        • Pitch tracking and harmonics
      • Tuning, octave and key conversions (audio_samples.utils)
        • hz_to_octs()
        • octs_to_hz()
        • a4_to_tuning()
        • tuning_to_a4()
        • cqt_frequencies()
        • key_to_notes()
        • key_to_degrees()
    • Sequence Alignment and Decoding
      • Dynamic time warping
        • dtw()
        • dtw_backtracking()
      • Hidden Markov model decoding
        • viterbi()
        • viterbi_discriminative()
        • viterbi_binary()
      • Transition matrices
        • transition_uniform()
        • transition_loop()
        • transition_cycle()
        • transition_local()
      • Recurrence and similarity
        • recurrence_matrix()
        • cross_similarity()
        • recurrence_to_lag()
        • lag_to_recurrence()
        • rqa()
      • Aggregation
        • sync()
      • Example
    • Structure and Segmentation
      • TimelagFiltered
      • agglomerative()
      • diagonal_filter()
      • path_enhance()
      • subsegment()
      • timelag_filter()
    • Array Helpers
      • MAX_MEM_BLOCK
      • SparseRows
        • SparseRows.data
        • SparseRows.indices
        • SparseRows.indptr
        • SparseRows.nnz
        • SparseRows.shape
        • SparseRows.toarray()
        • SparseRows.tocsr()
      • abs2()
      • axis_sort()
      • buf_to_float()
      • chirp()
      • count_unique()
      • cyclic_gradient()
      • dtype_c2r()
      • dtype_r2c()
      • expand_to()
      • fill_off_diagonal()
      • find_files()
      • fix_frames()
      • index_to_slice()
      • interp1d()
      • interp_broadcast()
      • is_positive_int()
      • is_unique()
      • localmax()
      • localmin()
      • match_events()
      • match_intervals()
      • pad_center()
      • phasor()
      • shear()
      • sparsify_rows()
      • stack()
      • tiny()
      • tone()
      • valid_audio()
      • valid_int()
      • valid_intervals()
      • zero_crossings()
    • Array Forms and Options
      • beat_track()
      • chroma_cens()
      • chroma_cqt()
      • chroma_vqt()
      • frame()
      • get_duration()
      • istft()
      • onset_detect()
      • onset_strength()
      • pitch_shift()
      • read_segment()
      • reassigned_spectrogram()
      • resample()
      • salience()
      • stft()
      • stream_blocks()
      • tempogram_ratio()
      • to_mono()
      • to_multi()
      • to_stereo()
    • Linear Algebra
      • eigh()
      • nnls()
      • pinv()
      • svd()
    • Mel and MFCC Inversion
      • mel_to_audio()
      • mel_to_stft()
      • mfcc_to_audio()
      • mfcc_to_mel()
    • Matrix Factorisation
      • Nmf
        • Nmf.components_
        • Nmf.fit_transform()
        • Nmf.n_iter_
        • Nmf.reconstruction_err_
        • Nmf.transform()
      • decompose()
    • Semitone Filterbank
      • iirt()
      • mr_frequencies()
      • semitone_filterbank()
    • Tuning and Notation
      • fifths_to_note()
      • hz_to_fjs()
      • hz_to_note()
      • hz_to_svara_c()
      • hz_to_svara_h()
      • interval_frequencies()
      • interval_to_fjs()
      • list_mela()
      • list_thaat()
      • mela_to_degrees()
      • mela_to_svara()
      • midi_to_note()
      • midi_to_svara_c()
      • midi_to_svara_h()
      • note_to_hz()
      • note_to_midi()
      • note_to_svara_c()
      • note_to_svara_h()
      • plimit_intervals()
      • pythagorean_intervals()
      • thaat_to_degrees()
    • Rhythm: Onsets, Tempo and Beats
      • AudioSamples methods
      • Onsets
        • onset_strength()
        • onset_strength_multi()
        • onset_detect()
        • onset_backtrack()
        • peak_pick()
      • Tempograms and tempo
        • tempo_frequencies()
        • fourier_tempo_frequencies()
        • tempogram()
        • fourier_tempogram()
        • tempo()
        • tempogram_ratio()
        • hybrid_tempogram()
        • metrogram()
      • Beats
        • beat_track()
        • beat_track_with_bpm()
        • plp()
    • Effects and Decomposition
      • AudioSamples methods
      • Array functions
        • phase_vocoder()
        • preemphasis()
        • deemphasis()
        • softmask()
        • hpss()
        • nn_filter()
        • griffinlim()
        • lpc()
        • clicks()
    • Signal Generation
      • Basic Waveforms
        • sine_wave()
        • cosine_wave()
        • sawtooth_wave()
        • square_wave()
        • triangle_wave()
      • Advanced Signals
        • chirp()
        • impulse()
        • silence()
      • Band-limited Waveforms
        • sawtooth_wave_bandlimited()
        • square_wave_bandlimited()
        • triangle_wave_bandlimited()
      • Modulated and Compound Signals
        • am_signal()
        • fm_signal()
        • compound_tone()
        • exponential_chirp()
        • exponential_bursts()
      • Stereo Signals
        • stereo_chirp()
        • stereo_silence()
        • stereo_sine_wave()
      • Noise Generators
        • white_noise()
        • pink_noise()
        • brown_noise()
      • Example Clips
        • example_clip()
        • example_clip_names()
        • example_speech_f0()
      • Examples
        • Basic Waveform Generation
        • Multi-tone Generation
        • Noise Generation
        • Frequency Sweeps
    • File I/O Operations
      • Reading Audio Files
        • read()
        • read_with_info()
      • Writing Audio Files
        • save()
        • write_with_options()
        • write_with_metadata()
      • Resampling on Read
        • read_and_resample()
        • peek_native_type()
      • Streaming I/O
        • StreamedAudioReader
        • StreamedAudioWriter
        • WavSink
        • StreamedFrameIterator
      • Options and Metadata
        • WriteOptions
        • CompressionLevel
        • WavMetadata
        • InfoMetadata
        • CuePoint
        • VorbisComment
        • StreamInfo
        • read_flac_stream_info()
        • read_wav_cue_points()
        • read_wav_info_tags()
      • File Information
        • info()
        • AudioInfo
      • Examples
        • Basic File Operations
        • Reading with Type Conversion
        • File Information Inspection
        • Format Conversion During Save
        • Batch Processing
        • Performance Considerations
    • Types
      • AdaptiveThresholdConfig
        • AdaptiveThresholdConfig.combined()
        • AdaptiveThresholdConfig.default()
        • AdaptiveThresholdConfig.delta()
        • AdaptiveThresholdConfig.max_threshold
        • AdaptiveThresholdConfig.min_threshold
        • AdaptiveThresholdConfig.percentile()
        • AdaptiveThresholdConfig.validate()
      • AdaptiveThresholdMethod
        • AdaptiveThresholdMethod.combined
        • AdaptiveThresholdMethod.default()
        • AdaptiveThresholdMethod.delta
        • AdaptiveThresholdMethod.percentile
      • BeatTrackingConfig
        • BeatTrackingConfig.onset_config
        • BeatTrackingConfig.tempo_bpm
        • BeatTrackingConfig.tolerance
      • BeatTrackingData
        • BeatTrackingData.beat_times
        • BeatTrackingData.config
        • BeatTrackingData.tempo_bpm
      • ChannelReduction
        • ChannelReduction.average
        • ChannelReduction.channel()
        • ChannelReduction.default()
        • ChannelReduction.error
        • ChannelReduction.first
      • ComplexOnsetConfig
        • ComplexOnsetConfig.cqt_params
        • ComplexOnsetConfig.hop_size
        • ComplexOnsetConfig.log_compression
        • ComplexOnsetConfig.magnitude_rectify
        • ComplexOnsetConfig.magnitude_weight
        • ComplexOnsetConfig.musical()
        • ComplexOnsetConfig.peak_picking
        • ComplexOnsetConfig.percussive()
        • ComplexOnsetConfig.phase_rectify
        • ComplexOnsetConfig.phase_weight
        • ComplexOnsetConfig.set_weights()
        • ComplexOnsetConfig.speech()
        • ComplexOnsetConfig.validate()
        • ComplexOnsetConfig.window_size
      • CompressorConfig
        • CompressorConfig.attack_ms
        • CompressorConfig.bus
        • CompressorConfig.default()
        • CompressorConfig.detection_method
        • CompressorConfig.drum
        • CompressorConfig.explain()
        • CompressorConfig.knee_type
        • CompressorConfig.knee_width_db
        • CompressorConfig.lookahead_ms
        • CompressorConfig.makeup_gain_db
        • CompressorConfig.ratio
        • CompressorConfig.release_ms
        • CompressorConfig.side_chain
        • CompressorConfig.threshold_db
        • CompressorConfig.validate()
        • CompressorConfig.vocal
      • DynamicRangeMethod
        • DynamicRangeMethod.default()
        • DynamicRangeMethod.hybrid
        • DynamicRangeMethod.peak
        • DynamicRangeMethod.rms
      • EnvelopeFollower
        • EnvelopeFollower.default()
        • EnvelopeFollower.process()
        • EnvelopeFollower.process_array()
        • EnvelopeFollower.reset()
      • EqBand
        • EqBand.enabled
        • EqBand.explain()
        • EqBand.frequency
        • EqBand.gain_db
        • EqBand.high_shelf()
        • EqBand.low_shelf()
        • EqBand.peak()
        • EqBand.q_factor
      • EqBandType
        • EqBandType.band_pass
        • EqBandType.band_stop
        • EqBandType.default()
        • EqBandType.high_pass
        • EqBandType.high_shelf
        • EqBandType.low_pass
        • EqBandType.low_shelf
        • EqBandType.peak
      • ExpanderConfig
        • ExpanderConfig.attack_ms
        • ExpanderConfig.default()
        • ExpanderConfig.gentle
        • ExpanderConfig.ratio
        • ExpanderConfig.release_ms
        • ExpanderConfig.threshold_db
        • ExpanderConfig.validate()
      • FadeCurve
        • FadeCurve.default()
        • FadeCurve.exponential
        • FadeCurve.linear
        • FadeCurve.logarithmic
        • FadeCurve.smooth_step
      • FilterResponse
        • FilterResponse.bandpass
        • FilterResponse.bandstop
        • FilterResponse.default()
        • FilterResponse.highpass
        • FilterResponse.lowpass
      • GateConfig
        • GateConfig.attack_ms
        • GateConfig.default()
        • GateConfig.noise_gate
        • GateConfig.ratio
        • GateConfig.release_ms
        • GateConfig.threshold_db
        • GateConfig.validate()
      • HpssConfig
        • HpssConfig.freq_resolution()
        • HpssConfig.harmonic
        • HpssConfig.musical
        • HpssConfig.num_freq_bins()
        • HpssConfig.percussive
        • HpssConfig.realtime
        • HpssConfig.set_filter_sizes()
        • HpssConfig.set_mask_softness()
        • HpssConfig.set_stft_params()
        • HpssConfig.time_resolution()
      • IirFilterDesign
        • IirFilterDesign.bessel()
        • IirFilterDesign.bessel_band()
        • IirFilterDesign.bessel_norm
        • IirFilterDesign.butterworth_bandpass()
        • IirFilterDesign.butterworth_bandstop()
        • IirFilterDesign.butterworth_highpass()
        • IirFilterDesign.butterworth_lowpass()
        • IirFilterDesign.chebyshev_i()
        • IirFilterDesign.chebyshev_i_band()
        • IirFilterDesign.chebyshev_ii()
        • IirFilterDesign.chebyshev_ii_band()
        • IirFilterDesign.cutoff_frequency
        • IirFilterDesign.elliptic()
        • IirFilterDesign.elliptic_band()
        • IirFilterDesign.explain()
        • IirFilterDesign.filter_type
        • IirFilterDesign.frequency_response()
        • IirFilterDesign.high_frequency
        • IirFilterDesign.low_frequency
        • IirFilterDesign.order
        • IirFilterDesign.passband_ripple
        • IirFilterDesign.response
        • IirFilterDesign.sos()
        • IirFilterDesign.stopband_attenuation
      • IirFilterType
        • IirFilterType.bessel
        • IirFilterType.butterworth
        • IirFilterType.chebyshev_type_i
        • IirFilterType.chebyshev_type_ii
        • IirFilterType.default()
        • IirFilterType.elliptic
      • Key
        • Key.confidence
        • Key.mode
        • Key.tonic
      • KneeType
        • KneeType.default()
        • KneeType.hard
        • KneeType.soft
      • LimiterConfig
        • LimiterConfig.attack_ms
        • LimiterConfig.broadcast()
        • LimiterConfig.ceiling_db
        • LimiterConfig.default()
        • LimiterConfig.detection_method
        • LimiterConfig.explain()
        • LimiterConfig.isp_limiting
        • LimiterConfig.knee_type
        • LimiterConfig.knee_width_db
        • LimiterConfig.lookahead_ms
        • LimiterConfig.mastering()
        • LimiterConfig.release_ms
        • LimiterConfig.side_chain
        • LimiterConfig.transparent()
        • LimiterConfig.validate()
      • Mode
        • Mode.major
        • Mode.minor
      • MonoConversionMethod
        • MonoConversionMethod.average
        • MonoConversionMethod.center
        • MonoConversionMethod.default()
        • MonoConversionMethod.left
        • MonoConversionMethod.right
        • MonoConversionMethod.weighted()
      • NoiseColor
        • NoiseColor.brown
        • NoiseColor.default()
        • NoiseColor.pink
        • NoiseColor.white
      • NormalizationMethod
        • NormalizationMethod.default()
        • NormalizationMethod.mean
        • NormalizationMethod.median
        • NormalizationMethod.minmax
        • NormalizationMethod.peak
        • NormalizationMethod.zscore
      • OnsetDetectionConfig
        • OnsetDetectionConfig.adaptive_threshold
        • OnsetDetectionConfig.adaptive_threshold_multiplier
        • OnsetDetectionConfig.cqt_params
        • OnsetDetectionConfig.default()
        • OnsetDetectionConfig.explain()
        • OnsetDetectionConfig.hop_size
        • OnsetDetectionConfig.median_filter_length
        • OnsetDetectionConfig.musical()
        • OnsetDetectionConfig.peak_picking
        • OnsetDetectionConfig.percussive()
        • OnsetDetectionConfig.speech()
        • OnsetDetectionConfig.window_size
      • PadSide
        • PadSide.default()
        • PadSide.left
        • PadSide.right
      • ParametricEq
        • ParametricEq.add_band()
        • ParametricEq.bypassed
        • ParametricEq.output_gain_db
        • ParametricEq.remove_band()
      • PeakPickingConfig
        • PeakPickingConfig.default()
        • PeakPickingConfig.drums()
        • PeakPickingConfig.min_peak_separation
        • PeakPickingConfig.music()
        • PeakPickingConfig.set_median_filter()
        • PeakPickingConfig.set_min_peak_separation_ms()
        • PeakPickingConfig.set_pre_emphasis()
        • PeakPickingConfig.speech()
        • PeakPickingConfig.validate()
      • PerturbationConfig
        • PerturbationConfig.seed
        • PerturbationConfig.validate()
      • PerturbationMethod
        • PerturbationMethod.brown_noise()
        • PerturbationMethod.gaussian()
        • PerturbationMethod.high_pass_filter()
        • PerturbationMethod.high_pass_filter_with_slope()
        • PerturbationMethod.low_pass_filter()
        • PerturbationMethod.low_pass_filter_with_slope()
        • PerturbationMethod.pink_noise()
        • PerturbationMethod.pitch_shift()
        • PerturbationMethod.random_gain()
        • PerturbationMethod.validate()
        • PerturbationMethod.white_noise()
      • PitchClass
        • PitchClass.a
        • PitchClass.a_sharp
        • PitchClass.b
        • PitchClass.c
        • PitchClass.c_sharp
        • PitchClass.d
        • PitchClass.d_sharp
        • PitchClass.e
        • PitchClass.f
        • PitchClass.f_sharp
        • PitchClass.from_index()
        • PitchClass.g
        • PitchClass.g_sharp
        • PitchClass.to_index()
      • PitchContour
        • PitchContour.frames()
        • PitchContour.mean_pitch()
        • PitchContour.voiced_frames()
      • PitchDetectionMethod
        • PitchDetectionMethod.autocorrelation
        • PitchDetectionMethod.cepstrum
        • PitchDetectionMethod.default()
        • PitchDetectionMethod.harmonic_product
        • PitchDetectionMethod.yin
      • PitchFrame
        • PitchFrame.frequency
        • PitchFrame.time
        • PitchFrame.voiced
      • Psd
        • Psd.density
        • Psd.frequencies
        • Psd.into_parts()
      • ResamplingQuality
        • ResamplingQuality.default()
        • ResamplingQuality.fast
        • ResamplingQuality.high
        • ResamplingQuality.medium
        • ResamplingQuality.very_high
      • SampleType
        • SampleType.F32
        • SampleType.F64
        • SampleType.I16
        • SampleType.I24
        • SampleType.I32
        • SampleType.U8
      • SideChainConfig
        • SideChainConfig.default()
        • SideChainConfig.enabled
        • SideChainConfig.external_mix
        • SideChainConfig.high_pass_freq
        • SideChainConfig.low_pass_freq
        • SideChainConfig.pre_emphasis_db
      • SosFilter
        • SosFilter.filtfilt()
        • SosFilter.frequency_response()
        • SosFilter.from_design()
        • SosFilter.from_sos()
        • SosFilter.process_block()
        • SosFilter.process_sample()
        • SosFilter.process_samples()
        • SosFilter.process_samples_in_place()
        • SosFilter.reset()
        • SosFilter.sos()
      • SpectralFluxConfig
        • SpectralFluxConfig.complex
        • SpectralFluxConfig.cqt_params
        • SpectralFluxConfig.flux_method
        • SpectralFluxConfig.hop_size
        • SpectralFluxConfig.log_compression
        • SpectralFluxConfig.musical()
        • SpectralFluxConfig.peak_picking
        • SpectralFluxConfig.percussive()
        • SpectralFluxConfig.rectify
        • SpectralFluxConfig.validate()
        • SpectralFluxConfig.window_size
      • SpectralFluxMethod
        • SpectralFluxMethod.complex
        • SpectralFluxMethod.energy
        • SpectralFluxMethod.magnitude
        • SpectralFluxMethod.rectified_complex
      • SpectrogramScale
        • SpectrogramScale.default()
        • SpectrogramScale.linear
        • SpectrogramScale.log
        • SpectrogramScale.mel
      • StereoConversionMethod
        • StereoConversionMethod.default()
        • StereoConversionMethod.duplicate
        • StereoConversionMethod.left
        • StereoConversionMethod.pan()
        • StereoConversionMethod.right
      • ThreeBandEqConfig
        • ThreeBandEqConfig.default()
        • ThreeBandEqConfig.flat
        • ThreeBandEqConfig.high_freq
        • ThreeBandEqConfig.high_gain
        • ThreeBandEqConfig.low_freq
        • ThreeBandEqConfig.low_gain
        • ThreeBandEqConfig.mid_freq
        • ThreeBandEqConfig.mid_gain
        • ThreeBandEqConfig.mid_q
        • ThreeBandEqConfig.validate()
      • VadChannelPolicy
        • VadChannelPolicy.all_channels
        • VadChannelPolicy.any_channel
        • VadChannelPolicy.average_to_mono
        • VadChannelPolicy.channel()
        • VadChannelPolicy.default()
      • VadConfig
        • VadConfig.channel_policy
        • VadConfig.default()
        • VadConfig.energy_only
        • VadConfig.energy_threshold_db
        • VadConfig.explain()
        • VadConfig.frame_size
        • VadConfig.hangover_frames
        • VadConfig.hop_size
        • VadConfig.method
        • VadConfig.min_silence_frames
        • VadConfig.min_speech_frames
        • VadConfig.pad_end
        • VadConfig.smooth_frames
        • VadConfig.spectral_ratio_threshold
        • VadConfig.speech_band_high_hz
        • VadConfig.speech_band_low_hz
        • VadConfig.validate()
        • VadConfig.zcr_max
        • VadConfig.zcr_min
      • VadMethod
        • VadMethod.combined
        • VadMethod.default()
        • VadMethod.energy
        • VadMethod.spectral
        • VadMethod.zcr
      • WindowType
        • WindowType.blackman
        • WindowType.default()
        • WindowType.gaussian()
        • WindowType.hamming
        • WindowType.hanning
        • WindowType.kaiser()
        • WindowType.rectangular
  • Core Classes
  • Quick Reference

Development

  • Changelog
    • 0.3.0 - Unreleased
      • Added
      • Changed
      • Deprecated
      • Fixed
    • 0.2.4 - 2026-07-08
    • 0.2.3 - 2026-07-08
      • Changed
      • Added
    • 0.2.2 - 2026-04-29
      • Added
    • 0.2.1 - 2026-03-31
      • Changed
    • 0.2.0 - 2026-03-17
      • Changed
      • Added
    • 0.1.1 - 2026-01-04
      • Added
    • 0.1.0 - 2026-01-04
      • Added
  • GitHub Repository
AudioSamples Python
  • Examples
  • Example gallery
  • View page source

Example gallery

Short programs, grouped by task. The documentation build runs every one of them and fails if one raises or an assertion in it stops holding, so each plot and audio player below is the output of the code on its page. All signals are generated in the code, so a page can be copied and run with no audio files.

The longer explanations are in the tutorials. Each section below lists the notebooks that cover its topic. For the same tasks in Rust, see the gallery chapter of the crate’s book.

Loading and saving

Reading and writing WAV and FLAC files. See also the tutorial Quantisation and dither for what the sample types mean.

Read and write WAV and FLAC

Read and write WAV and FLAC

Read a long file in blocks

Read a long file in blocks

Spectrograms

Time-frequency representations. See also the tutorials The DFT, windows and leakage and STFT and spectrograms.

Constant-Q transform

Constant-Q transform

STFT spectrogram

STFT spectrogram

Mel and MFCC

Perceptual frequency scales and the features built on them. See also the tutorial Cepstrum, mel and MFCC and Psychoacoustics and codecs.

Chroma

Chroma

Mel spectrogram

Mel spectrogram

MFCC

MFCC

Perceptual scales, loudness weighting and mu-law

Perceptual scales, loudness weighting and mu-law

Pitch

Estimating the fundamental frequency. See also the tutorials Pitch: autocorrelation and YIN and LPC and formants.

Harmonics of a tone

Harmonics of a tone

Pitch tracking with YIN and pYIN

Pitch tracking with YIN and pYIN

Beats and onsets

Finding note starts and the pulse of a recording. See also the tutorial Onsets and tempo.

Beat tracking and tempo

Beat tracking and tempo

Onset detection

Onset detection

Tempogram

Tempogram

Separation

Splitting a signal into parts.

Harmonic and percussive separation

Harmonic and percussive separation

Effects

Dynamics, time and pitch changes, fades and silence. See also the tutorials Dynamics and Short-time energy, zero crossings and VAD.

Compressor and limiter

Compressor and limiter

Trim silence and find active regions

Trim silence and find active regions

Time stretch and pitch shift

Time stretch and pitch shift

Resampling

Changing the sample rate, alone or in a batch. See also the tutorials Sampling and aliasing and Resampling.

Process many clips with threads

Process many clips with threads

Resampling quality

Resampling quality

Filters

IIR filters and parametric EQ. See also the tutorials Convolution and FIR filters and IIR filters.

Low-pass and high-pass filters

Low-pass and high-pass filters

Parametric EQ

Parametric EQ

Plotting

audio_samples.mpl has ready-made Matplotlib figures for AudioSamples. It needs pip install "audio_samples[mpl]". Every function accepts ax= to draw into an existing figure and style= to change the look.

One-call overview

One-call overview

Stereo channels

Stereo channels

Waveform, spectrum and spectrogram

Waveform, spectrum and spectrogram
Previous Next

© Copyright 2025, Jack Geraghty.

Built with Sphinx using a theme provided by Read the Docs.