-
Notifications
You must be signed in to change notification settings - Fork 4
Lmclient ‒ the Power of Console Audio Analysis
This article describes some more advanced functionality of the library and its console client. The basics are covered in the corresponding wiki page.
Why start with the boring ones? Let's play the trump card and watch Pitch Class Profile of the audio piece right from terminal!
% bin/lmclient --pcp -n 1 ../music-dsp/tests/test_sounds/chords_separate/C_chord_construction_guitarlessonworld.wav
|
| |
| | |
| | |
| | |
| | |
| | |
| | | |
| | | |
| | | | | |
C C# D D# E F F# G G# A A# B C C# D D# E F F# G G# A A# B
Here you go! We chose a test sound with only one chord played, used --pcp
for PCP output and -n 1
to print PCP for only one window. The lib has done its math and found corresponding amplitudes for all notes. What that means? Look for the answer in the next section.
Play with -w
to see how window size affects results.
Check studies below to find more information on the PCP term and understand why it's built of 24 notes instead of 12.
- Takuya Fujishima - Realtime Chord Recognition of Musical Sound: A System Using Common Lisp Music
- Matthias Mauch, Simon Dixon - Simultaneous Estimation of Chords and Musical Context From Audio
Now it's time to know which chord does that PCP from the previous section correspond to.
% bin/lmclient -c ../music-dsp/tests/test_sounds/chords_separate/C_chord_construction_guitarlessonworld.wav
0: ?? [0, 0.09]
1: C [0.09, 2.38]
The library has detected chord C
in the time interval from 0.09 to 2.38 seconds.
Play with -w
to see how window size affects results.
In current version -c
option benefits from HMM-based library chord detection mechanism. That means that chord detection is performed not on per PCP basis, but it takes into account all sequence.
In order to find which chord that PCP corresponds to, the above used command has to be change to the following:
bin/lmclient -c -n 1 --legacy ../music-dsp/tests/test_sounds/chords_separate/C_chord_construction_guitarlessonworld.wav
Let's see how the library will cope with automatic BPM detection task on "Losing my Religion" by R.E.M.:
% bin/lmclient -b ~/Music/rem_-_losing-my-religion.wav
62.7491
While the song has original BPM of 125-126, the lib was having troubles distinguishing between those notes fractions and cut BPM in half - which is still accurate.
You can have even more fun this feature by plotting beats along with audio time domain data. Here's how to do it step by step:
- Check
lmclient -h
‒ it's full of useful hints, e.g.-b detect BPM of the input audio In combination with -t prints peaks at the beat indices along with time domain.
- Use it!
% bin/lmclient -b -t ~/Music/rem_-_losing-my-religion.wav > time_data.txt
- Plot the data:
gnuplot> set datafile separator "," gnuplot> plot 'time_data.txt' using 1:2 with lines, '' using 1:3 with lines linewidth 2
- Observe the results. If the algorithm did its job correctly, you'll see vertical lines nicely matching peaks along the waveform: