Chord Analyzer
by @ctwww
Analyze music audio files to extract chord progressions, key signature, tempo, and song structure. Use when user wants to identify chords, analyze a song's h...
clawhub install chord-analyzerπ About This Skill
name: chord-analyzer description: "Analyze music audio files to extract chord progressions, key signature, tempo, and song structure. Use when user wants to identify chords, analyze a song's harmony, or extract musical information from audio files (mp3, wav, m4a, etc.)." homepage: https://github.com/librosa/librosa metadata: { "openclaw": { "emoji": "πΈ", "requires": { "bins": ["python3"], "pip": ["librosa", "numpy"] } } }
Chord Analyzer Skill
Analyze music audio files to extract chord progressions, key signature, tempo, and song structure.
When to Use
β USE this skill when:
When NOT to Use
β DON'T use this skill when:
Supported Formats
Installation
First time use requires installing dependencies:
pip3 install librosa numpy scipy scikit-learn soundfile
Usage
Basic Analysis
# Analyze an audio file
python3 chord_analyzer.pyEdit the script to change the audio path
Default: /Users/chentiewen/Music/η½ζδΊι³δΉ/example.mp3
Script Integration
Copy the chord_analyzer.py script to your workspace and modify the audio_path variable:
audio_path = "/path/to/your/song.mp3"
result = analyze_audio(audio_path)
Output
The analyzer provides:
1. Key Signature: Detected musical key (e.g., C, F#m, G) 2. Tempo: Speed in BPM with rhythm classification 3. Chord Progression: Complete chord sequence with timestamps 4. Chord Statistics: Most frequently used chords 5. Song Structure: Intro/Verse/Outro segmentation (basic)
Sample Output
θ°ζ§: F#m
ιεΊ¦: 123.0 BPM
θε₯: εΏ«ζΏ (Allegro)εεΌ¦θ΅°ε:
F#mdim β A β D β Bm β E β A β D β Bm β E ...
δΈ»θ¦εεΌ¦:
A: 15欑 (20.3%)
E: 14欑 (18.9%)
D: 12欑 (16.2%)
How It Works
1. Load Audio: Uses librosa.load() to read audio at 22.05kHz
2. Extract Chroma: Computes chroma features (pitch class profiles) using STFT
3. Detect Key: Analyzes chroma energy across all 12 keys (major + minor)
4. Track Tempo: Uses librosa.beat.beat_track() for tempo detection
5. Analyze Chords: Samples chroma at measure boundaries and matches against chord templates
6. Merge & Simplify: Combines consecutive identical chords
Limitations
For Complete Transcription
For professional music transcription, recommend:
Notes
β‘ When to Use
π‘ Examples
Basic Analysis
# Analyze an audio file
python3 chord_analyzer.pyEdit the script to change the audio path
Default: /Users/chentiewen/Music/η½ζδΊι³δΉ/example.mp3
Script Integration
Copy the chord_analyzer.py script to your workspace and modify the audio_path variable:
audio_path = "/path/to/your/song.mp3"
result = analyze_audio(audio_path)