An algorithm for piano pedagogy through MIDI protocol and computer software
1. An Algorithm for Piano Pedagogy through
MIDI Protocol and Computer Software
Lee Cheng
The University of Hong Kong
leecheng@hku.hk
CITE Research Symposium 2010
4. Introduction
How about Piano Pedagogy?
It tells you when to play the notes.
Students cannot learn rhythms!
What about
Dynamics?
Phrasing?
Tempo?
CITE Research Symposium 2010
5. How the Computer Interpret Music?
Note - Number
(C4 = 60, C#4 = 61, etc)
Time - Timestamp
(1st beat = 0s, 2nd beat = 3s, 3rd beat = 6s, etc)
Dynamics - Velocity
(f/forte = 90, mf/mezzo forte = 60)
Duration - Timestamp from NoteOn to NoteOff
(NoteOn at 3s, NoteOff at 7.5s, Duration = 4.5s)
CITE Research Symposium 2010
6. The Problem
Pianist have different tempo (speed) with the score.
How can the computer know where the pianist is playing?
CITE Research Symposium 2010
7. The Algorithm for Piano Pedagogy
An integrated algorithm including:
Longest Common Music Subsequence (LCMS) Algorithm
(for music-to-score alignment)
Note Correctness
Tempo Change
Phrasing
Dynamic Change
CITE Research Symposium 2010
8. LCMS Algorithm
Derived from Longest Common Subsequence (LCS) algorithm.
function LCS (X[1..m], Y[1..n]) func%on
LCMS
(X[1..m],
Y[1..n])
C = array[0..m,0..n] C = array[0..m,0..n]
for i := 0..m for i := 0..m
C[i,0] = 0 C[i,0] = 0
for j := 0..n for j := 0..n
C[0,j] = 0 C[0,j] = 0
for i := 1..m for i := 1..m
for j := 1..n for j := 1..n
if X[i] = Y[j] for k := 0..9
C[i,j] := C[i-1,j-1] + 1 if X[i].note[0] = Y[j]note[k]
else C[i,j] := C[i-1,j-1] + 1
C[i,j] := max(C[i,j-1], C[i-1,j]) break
return C[m,n] C[i,j] := max(C[i,j-1], C[i-1,j])
return C[m,n]
CITE Research Symposium 2010
9. LCMS Algorithm
The function of LCS algorithm:
Seq. 1: ABCFEGFDE
Seq.2: ABCEAFDE
LCS(Seq.1, Seq2): ABCEFDE
What is more for LCMS algorithm:
Handle chords
i.e. more than one elements at the same time
A D G
FEDBCBGABE
D G C
CITE Research Symposium 2010
10. Note Correctness
Playing the right note?
Playing at the right time?
Playing for the right duration?
CITE Research Symposium 2010
11. Tempo Change
Global Tempo Change
Pianist’s self-assigned tempo
vs.
Tempo listed on score
Tempo Consistence
Is the pianist playing at the same tempo throughout
the piece?
Check the timestamp of music against the score
CITE Research Symposium 2010
12. Phrasing
Is a note played within the acceptable time range?
Is a note played harder/softer than the previous note?
Dynamic Change
Is the piece played at the acceptable dynamic range?
Is a phrase played harder/softer than the previous phrase?
CITE Research Symposium 2010
14. Conclusion
It is possible to learn elementary piano playing through
computer means.
For advanced level of piano learning, more to consider:
Style, interpretation of score, etc
Implementation in school music lesson?
Venue change from music room to computer room
Every computer to have MIDI keyboard equipped
CITE Research Symposium 2010