pyAudioAnalysis Documentation

repository·master·Indexed 27 days ago

https://github.com/tyiannak/pyaudioanalysis

A comprehensive Python library for audio feature extraction, classification, segmentation, and machine learning applications. It provides tools for extracting mfccs, spectrograms, and chromagrams, as well as modules for training audio segment classifiers, performing supervised and unsupervised segmentation, audio regression, and data visualization.

Tokens
584
Snippets
3
Records
4
Agent score
42%

What's inside pyAudioAnalysis

  1. Overview of pyAudioAnalysis capabilities

    master

    pyAudioAnalysis is a library for various audio analysis tasks, including:

    • Feature Extraction: Extracting representations like mfccs, spectrogram, and chromagram.
    • Classification: Training, tuning, and evaluating classifiers for audio segments and classifying unknown sounds.
    • Detection & Segmentation: Detecting audio events, excluding silence, performing supervised segmentation (joint segmentation-classification), and unsupervised segmentation (e.g., speaker diarization).
    • Regression: Training and using audio regression models (e.g., for emotion recognition).
    • Visualization: Applying dimensionality reduction to visualize audio data and content similarities.
  2. Install pyAudioAnalysis

    master

    To install pyAudioAnalysis, clone the repository, install the required dependencies, and then install the package in editable mode using pip.

    git clone https://github.com/tyiannak/pyAudioAnalysis.git
    pip install -r ./requirements.txt
    pip install -e .
  3. Train and use an audio segment classifier

    master

    You can use the audioTrainTest module (aliased as aT in the example) to train a classifier using folders of WAV files (where each folder name represents a class) and then classify an unknown audio file.

    Note: The extract_features_and_train function requires windowing parameters like aT.shortTermWindow and aT.shortTermStep.

    from pyAudioAnalysis import audioTrainTest as aT
    aT.extract_features_and_train(["classifierData/music","classifierData/speech"], 1.0, 1.0, aT.shortTermWindow, aT.shortTermStep, "svm", "svmSMtemp", False)
    aT.file_classification("data/doremi.wav", "svmSMtemp","svm")
  4. Extract audio spectrogram via CLI

    master

    pyAudioAnalysis provides command-line support for its functionalities. To extract the spectrogram of a WAV file, use the audioAnalysis.py script with the fileSpectrogram command and the -i flag for the input file.

    python audioAnalysis.py fileSpectrogram -i data/doremi.wav