Sunday, 16 August 2015

Piano Trainer

I've been taking piano lessons for a little less than a year. As I have never been playing music before that, my score reading skills are still pretty poor. This gets a bit frustrating especially when discovering a new piece of music, I spend ages reading the notes.

To get better at it, I wrote a little training program.


It's very simple: it randomly displays a note on a grand staff, wait for a key to be pressed on the piano (using MIDI), checks the result and displays an OK/Fail! message. It then continues with a new note until you realize it's diner time. Here it is in action:


The applications logs some statistics about the user's performance into a CSV file. Basically, for each note drawn, it measures the time the user took to press a key. It looks like this:

#DateTime;Count;NoteToFindNum;NoteToFindName;AnsweredNoteNum;AnsweredNoteName;AnswerTimeInMs;OK
dim. août 16 15:07:16 2015;1;65;Fa 4;65;Fa 4;2954;0;
dim. août 16 15:07:18 2015;2;48;Do 3;48;Do 3;1374;0;
dim. août 16 15:07:20 2015;3;79;Sol 5;79;Sol 5;1409;0;
dim. août 16 15:07:23 2015;4;65;Fa 4;65;Fa 4;2237;0;
dim. août 16 15:07:24 2015;5;65;Fa 4;65;Fa 4;463;0;
...

When importing that into a spreadsheet program, it's then possible to draw some cool graphs showing the effect of the training (hopefully positive!).

The code is available on GitHub. The application can use the PC keyboard as input. But if you have a digital piano, all you need is a MIDI adapter like this one (it cost me about 5 euros).


Note that another very similar Piano-Trainer program exists on GitHub. It's made by Philipp Otto. It's web-based and it's pretty cool! However it's probably aimed at more experienced music readers as it deals with chords and not single notes like mine.

No comments:

Post a Comment