MCPcopy Index your code
hub / github.com/tyiannak/pyAudioAnalysis

github.com/tyiannak/pyAudioAnalysis @main sqlite

repository ↗ · DeepWiki ↗
139 symbols 394 edges 19 files 72 documented · 52%
README

A Python library for audio feature extraction, classification, segmentation and applications

This is general info. Click here for the complete wiki and here for a more generic intro to audio data handling

News

  • [2025-03-29] Check Behavioral Signals Python SDK that demonstrates how to use Behavioral Signals' API to send speech data and retrieve predictions related to emotions and behaviors using Python code. It works in both batch and streaming mode. Now Behavioral Signals' API also supports a Speaker Agnostic Deep Fake Detector.
  • [2021-08-06] deep-audio-features deep audio classification and feature extraction using CNNs and Pytorch
  • Check out paura a Python script for realtime recording and analysis of audio data

General

pyAudioAnalysis is a Python library covering a wide range of audio analysis tasks. Through pyAudioAnalysis you can: * Extract audio features and representations (e.g. mfccs, spectrogram, chromagram) * Train, parameter tune and evaluate classifiers of audio segments * Classify unknown sounds * Detect audio events and exclude silence periods from long recordings * Perform supervised segmentation (joint segmentation - classification) * Perform unsupervised segmentation (e.g. speaker diarization) and extract audio thumbnails * Train and use audio regression models (example application: emotion recognition) * Apply dimensionality reduction to visualize audio data and content similarities

Installation

  • Clone the source of this library: git clone https://github.com/tyiannak/pyAudioAnalysis.git
  • Install dependencies: pip install -r ./requirements.txt
  • Install using pip: pip install -e .

An audio classification example

More examples and detailed tutorials can be found at the wiki

pyAudioAnalysis provides easy-to-call wrappers to execute audio analysis tasks. Eg, this code first trains an audio segment classifier, given a set of WAV files stored in folders (each folder representing a different class) and then the trained classifier is used to classify an unknown audio WAV file

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")

Result: (0.0, array([ 0.90156761, 0.09843239]), ['music', 'speech'])

In addition, command-line support is provided for all functionalities. E.g. the following command extracts the spectrogram of an audio signal stored in a WAV file: python audioAnalysis.py fileSpectrogram -i data/doremi.wav

Further reading

Apart from this README file, to bettern understand how to use this library one should read the following: * Audio Handling Basics: Process Audio Files In Command-Line or Python, if you want to learn how to handle audio files from command line, and some basic programming on audio signal processing. Start with that if you don't know anything about audio. * Intro to Audio Analysis: Recognizing Sounds Using Machine Learning This goes a bit deeper than the previous article, by providing a complete intro to theory and practice of audio feature extraction, classification and segmentation (includes many Python examples). * The library's wiki * How to Use Machine Learning to Color Your Lighting Based on Music Mood. An interesting use-case of using this lib to train a real-time music mood estimator. * A more general and theoretic description of the adopted methods (along with several experiments on particular use-cases) is presented in this publication. Please use the following citation when citing pyAudioAnalysis in your research work:

@article{giannakopoulos2015pyaudioanalysis,
  title={pyAudioAnalysis: An Open-Source Python Library for Audio Signal Analysis},
  author={Giannakopoulos, Theodoros},
  journal={PloS one},
  volume={10},
  number={12},
  year={2015},
  publisher={Public Library of Science}
}

For Matlab-related audio analysis material check this book.

Author

Theodoros Giannakopoulos, Principal Researcher of Multimodal Machine Learning at the Multimedia Analysis Group of the Computational Intelligence Lab (MagCIL) of the Institute of Informatics and Telecommunications, of the National Center for Scientific Research "Demokritos"

Core symbols most depended-on inside this repo

read_segmentation_gt
called by 5
pyAudioAnalysis/audioSegmentation.py
mid_feature_extraction
called by 4
pyAudioAnalysis/MidTermFeatures.py
dc_normalize
called by 4
pyAudioAnalysis/ShortTermFeatures.py
segments_to_labels
called by 4
pyAudioAnalysis/audioSegmentation.py
train_hmm_compute_statistics
called by 3
pyAudioAnalysis/audioSegmentation.py
read_audio_generic
called by 2
pyAudioAnalysis/audioBasicIO.py
generateColorMap
called by 2
pyAudioAnalysis/audioVisualization.py
annotation2files
called by 2
pyAudioAnalysis/audacityAnnotation2WAVs.py

Shape

Function 128
Method 9
Class 2

Languages

Python100%

Modules by API surface

pyAudioAnalysis/audioTrainTest.py30 symbols
pyAudioAnalysis/audioAnalysis.py23 symbols
pyAudioAnalysis/audioSegmentation.py22 symbols
pyAudioAnalysis/ShortTermFeatures.py18 symbols
pyAudioAnalysis/data/recordRadio.py10 symbols
pyAudioAnalysis/MidTermFeatures.py7 symbols
pyAudioAnalysis/audioBasicIO.py6 symbols
pyAudioAnalysis/audioVisualization.py5 symbols
pyAudioAnalysis/utilities.py4 symbols
pyAudioAnalysis/audacityAnnotation2WAVs.py4 symbols
pytests/test_segmentation.py2 symbols
pytests/test_feature_extraction.py2 symbols

Dependencies from manifests, versioned

eyeD30.9.6 · 1×
hmmlearn0.2.5 · 1×
matplotlib3.4.2 · 1×
numpy1.20.3 · 1×
pandas1.2.4 · 1×
plotly5.3.1 · 1×
pydub0.25.1 · 1×
scikit_learn0.24.2 · 1×
scipy1.6.3 · 1×
simplejson3.16.0 · 1×
tqdm4.52.0 · 1×

For agents

$ claude mcp add pyAudioAnalysis \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact