Muze
Muze is a Ruby audio feature extraction library that provides a full pipeline from audio loading to spectral analysis, feature extraction, rhythm analysis, effects, and lightweight visualization.
Installation
Add this line to your application's Gemfile:
gem "muze"Then execute:
bundle installOr install directly:
gem install muzeQuick Start
require "muze"
y, sr = RAF.load("sample.wav", sr: 22_050)
mel = RAF.melspectrogram(y:, sr:)
mfcc = RAF.mfcc(y:, sr:, n_mfcc: 13)
tempo, beats = RAF.beat_track(y:, sr:)
RAF.specshow(Muze.power_to_db(mel), output: "mel.svg")Main Features
| Area | APIs |
|---|---|
| Audio I/O |
RAF.load (wav, flac, mp3, ogg) |
| STFT stack |
RAF.stft, RAF.istft, RAF.magphase
|
| Scale helpers |
RAF.power_to_db, RAF.amplitude_to_db
|
| Filters |
RAF.mel, RAF.chroma
|
| Features |
RAF.melspectrogram, RAF.mfcc, RAF.delta
|
| Spectral descriptors | centroid, bandwidth, rolloff, flatness, contrast, zcr, rms |
| Rhythm |
RAF.onset_strength, RAF.onset_detect, RAF.beat_track, RAF.tempogram
|
| Effects |
RAF.hpss, RAF.time_stretch, RAF.pitch_shift, RAF.trim
|
| Visualization |
RAF.specshow, RAF.waveshow
|
wav is loaded with wavify, and flac/mp3/ogg requires ffmpeg + ffprobe
available on PATH.
Development
bundle install
bundle exec rspecBenchmark and regression check:
bundle exec rake benchThis writes a JSON report to benchmarks/reports/latest.json and compares metrics
against benchmarks/baseline.json. To refresh the baseline:
MUZE_BENCH_UPDATE_BASELINE=1 bundle exec rake benchQuality regression thresholds for effects are documented in
benchmarks/quality_thresholds.md.
Optional native extension:
bundle exec rake compileGenerate API docs:
bundle exec yard docLicense
Muze is available under the MIT License.