Top Related Projects
Python library for audio and music analysis
C++ library for audio and music analysis, description and synthesis, including Python bindings
Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk
Magenta: Music and Art Generation with Machine Intelligence
Quick Overview
Aubio is an open-source library for audio and music analysis. It provides tools for tasks such as pitch detection, onset detection, beat tracking, and tempo estimation. Aubio is designed to be efficient and can be used in real-time applications.
Pros
- Cross-platform compatibility (Linux, macOS, Windows, iOS, Android)
- Supports multiple programming languages (C, Python, JavaScript)
- Efficient and suitable for real-time processing
- Comprehensive set of audio analysis tools
Cons
- Documentation could be more extensive and user-friendly
- Limited community support compared to larger audio processing libraries
- Some advanced features may require deeper understanding of audio processing concepts
- Occasional stability issues reported by users
Code Examples
- Pitch detection using aubio in Python:
import aubio
# Create a pitch detection object
pitch_o = aubio.pitch("yin", 1024, 512, 44100)
# Process audio frames and get pitch
def get_pitch(audio_frame):
pitch = pitch_o(audio_frame)[0]
confidence = pitch_o.get_confidence()
return pitch, confidence
- Onset detection in Python:
import aubio
# Create an onset detection object
onset_o = aubio.onset("default", 1024, 512, 44100)
# Process audio frames and detect onsets
def detect_onset(audio_frame):
is_onset = onset_o(audio_frame)[0]
return bool(is_onset)
- Beat tracking in Python:
import aubio
# Create a tempo detection object
tempo_o = aubio.tempo("default", 1024, 512, 44100)
# Process audio frames and track beats
def track_beats(audio_frame):
is_beat = tempo_o(audio_frame)[0]
return bool(is_beat)
Getting Started
To get started with aubio in Python:
- Install aubio:
pip install aubio
- Import aubio in your Python script:
import aubio
- Create an audio source:
source = aubio.source("input_audio.wav", samplerate=44100, hop_size=512)
- Create analysis objects (e.g., pitch detection):
pitch_o = aubio.pitch("yin", 1024, 512, 44100)
- Process audio frames:
while True:
samples, read = source()
if read < source.hop_size:
break
pitch = pitch_o(samples)[0]
print(f"Pitch: {pitch:.2f} Hz")
This example reads an audio file, performs pitch detection, and prints the detected pitch for each frame.
Competitor Comparisons
Python library for audio and music analysis
Pros of librosa
- More comprehensive and feature-rich library for music and audio analysis
- Extensive documentation and tutorials, making it easier for beginners
- Active community and frequent updates
Cons of librosa
- Slower performance compared to aubio, especially for real-time processing
- Larger dependency footprint, which may increase project complexity
- Python-only implementation, limiting its use in other programming environments
Code Comparison
librosa:
import librosa
y, sr = librosa.load('audio.wav')
tempo, beat_frames = librosa.beat.beat_track(y=y, sr=sr)
chroma = librosa.feature.chroma_stft(y=y, sr=sr)
aubio:
import aubio
source = aubio.source('audio.wav')
tempo = aubio.tempo("default", 1024, 512, source.samplerate)
pitch = aubio.pitch("yin", 1024, 512, source.samplerate)
Both libraries offer audio analysis capabilities, but librosa provides a more comprehensive set of features and is easier to use for beginners. Aubio, on the other hand, is faster and more suitable for real-time processing. The code examples demonstrate the difference in syntax and approach between the two libraries for similar tasks.
C++ library for audio and music analysis, description and synthesis, including Python bindings
Pros of Essentia
- More extensive feature set, including advanced music information retrieval algorithms
- Better documentation and examples for various use cases
- Active development with frequent updates and community contributions
Cons of Essentia
- Steeper learning curve due to its comprehensive nature
- Larger codebase and dependencies, potentially leading to longer compilation times
- May be overkill for simpler audio processing tasks
Code Comparison
Aubio (pitch detection):
aubio_pitch_t *pitch = new_aubio_pitch("default", 2048, 512, 44100);
aubio_pitch_do(pitch, input_buffer, output_buffer);
Essentia (pitch detection):
AlgorithmFactory& factory = standard::AlgorithmFactory::instance();
Algorithm* pitchYin = factory.create("PitchYinFFT");
pitchYin->input("spectrum").set(spectrum);
pitchYin->output("pitch").set(pitch);
pitchYin->output("pitchConfidence").set(pitchConfidence);
pitchYin->compute();
Both libraries offer pitch detection, but Essentia's implementation provides additional confidence information and uses a different algorithm (YinFFT). Essentia's code is more verbose but offers more control over the process.
Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk
Pros of Annoy
- Specialized for approximate nearest neighbor search, making it highly efficient for this specific task
- Supports multiple distance metrics (Euclidean, Manhattan, Cosine, Hamming)
- Lightweight and easy to integrate into existing projects
Cons of Annoy
- Limited to a specific use case (nearest neighbor search), unlike Aubio's broader audio processing capabilities
- Less active development and community support compared to Aubio
- Fewer language bindings available (primarily C++ and Python)
Code Comparison
Annoy (C++):
AnnoyIndex<int, float, Euclidean, Kiss32Random> index(f);
index.add_item(0, v0);
index.add_item(1, v1);
index.build(10);
index.save("test.ann");
Aubio (C):
aubio_pitch_t *pitch = new_aubio_pitch("default", win_size, hop_size, samplerate);
aubio_pitch_do(pitch, input, output);
smpl_t pitch_value = output->data[0];
del_aubio_pitch(pitch);
Summary
Annoy is a specialized library for approximate nearest neighbor search, offering high performance for this specific task. It supports multiple distance metrics and is easy to integrate. However, it has a narrower focus compared to Aubio, which provides a broader range of audio processing capabilities. Aubio offers more extensive language bindings and has a more active development community. The code examples demonstrate the different use cases, with Annoy focusing on indexing and searching, while Aubio showcases audio pitch detection.
Magenta: Music and Art Generation with Machine Intelligence
Pros of Magenta
- Broader scope, focusing on machine learning for creative applications beyond just audio
- More active development and larger community support
- Extensive documentation and tutorials for getting started
Cons of Magenta
- Steeper learning curve due to its complexity and reliance on TensorFlow
- Heavier resource requirements for running models and generating content
- Less focused on low-level audio processing compared to Aubio
Code Comparison
Aubio (C):
aubio_pitch_t *pitch = new_aubio_pitch("default", 2048, 512, 44100);
aubio_pitch_do(pitch, input_buffer, output_buffer);
Magenta (Python):
model = music_vae.MusicVAE('cat-mel_2bar_small')
generated_sequences = model.sample(n=1, length=32, temperature=1.0)
Summary
Magenta is a more comprehensive toolkit for creative AI applications, including music generation and style transfer. It offers a wider range of features but requires more computational resources and machine learning expertise. Aubio, on the other hand, is a lightweight library focused specifically on audio analysis and processing, making it more suitable for real-time applications and low-level audio tasks.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
aubio
aubio is a library to label music and sounds. It listens to audio signals and attempts to detect events. For instance, when a drum is hit, at which frequency is a note, or at what tempo is a rhythmic melody.
Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio.
aubio provide several algorithms and routines, including:
- several onset detection methods
- different pitch detection methods
- tempo tracking and beat detection
- MFCC (mel-frequency cepstrum coefficients)
- FFT and phase vocoder
- up/down-sampling
- digital filters (low pass, high pass, and more)
- spectral filtering
- transient/steady-state separation
- sound file read and write access
- various mathematics utilities for music applications
The name aubio comes from audio with a typo: some errors are likely to be found in the results.
Python module
A python module for aubio is provided. For more information on how to use it,
please see the file python/README.md
and the
manual .
Tools
The python module comes with the following command line tools:
aubio
extracts informations from sound filesaubiocut
slices sound files at onset or beat timestamps
Additional command line tools are included along with the library:
aubioonset
outputs the time stamp of detected note onsetsaubiopitch
attempts to identify a fundamental frequency, or pitch, for each frame of the input soundaubiomfcc
computes Mel-frequency Cepstrum Coefficientsaubiotrack
outputs the time stamp of detected beatsaubionotes
emits midi-like notes, with an onset, a pitch, and a durationaubioquiet
extracts quiet and loud regions
Documentation
- manual, generated with sphinx
- developer documentation, generated with Doxygen
The latest version of the documentation can be found at:
https://aubio.org/documentation
Build Instructions
aubio compiles on Linux, Mac OS X, Windows, Cygwin, and iOS.
To compile aubio, you should be able to simply run:
make
To compile the python module:
./setup.py build
See the manual for more information about installing aubio.
Citation
Please use the DOI link above to cite this release in your publications. For more information, see also the about page in aubio manual.
Homepage
The home page of this project can be found at: https://aubio.org/
License
aubio is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Contributing
Patches are welcome: please fork the latest git repository and create a feature branch. Submitted requests should pass all continuous integration tests.
Top Related Projects
Python library for audio and music analysis
C++ library for audio and music analysis, description and synthesis, including Python bindings
Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk
Magenta: Music and Art Generation with Machine Intelligence
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot