Not A Note
Not A Note
Bachelor thesis
Petra Kalinov
Supervisor:
iv
Declaration
I hereby declare that I have completed this thesis independently and that I have listed all
the literature and publications used.
I have no objection to usage of this work in compliance with the act 60 Zkona
. 121/2000Sb. (copyright law), and with the rights connected with the copyright act
including the changes in the act.
.............................................................
vi
Abstract
The purpose of this work is to design and implement an application used by beginner
pianists to play songs using an electronic keyboard connected to the computer via a Musical
Instrument Digital Interface (MIDI). The program can serve as an educational tool as well
as a means of entertainment for people who have already mastered playing the piano, due
to its style diering from standard musical notation by the way it symbolizes the tones
which are being played. An educational element is represented by the set of editable lessons
containing individual instructions and references to particular songs in Standard MIDI File
Format. Each session may focus on a specic piano playing problem and while the song is
practised an evaluation is provided.
Abstrakt
Zmrem tto prce je navrhnout a implementovat aplikaci umoujc zanajcm pianistm hrt skladby na elektronick klvesy pipojen k potai pomoc rozhran MIDI.
Tento program me slouit nejen jako vukov pomcka, ale tak jako zdroj zbavy pro
uivatele, ktei u zkladn techniku hry na klavr ovldaj, protoe zpsob, jakm je
skladba zapsna se li od bn pouvan hudebn notace tm, jak jsou symbolizovny
jednotliv noty, kter se maj hrt. Vukov element je reprezentovn formou editovatelnch lekc, kter obsahuj konkrtn pokyny a odkazy na skladby uloen v MIDI souboru.
Kad lekce se tak me zamit na specick problm. Hodnocen hre probh jendotliv po kad pehran skladb a slou jako rozhodovac faktor pro jeho postup na
dal obtnostn rove.
vii
viii
Contents
List of Figures
xi
1 Introduction
1.1
1.2
2.2
2.3
2.4
System requirements . . .
Requirements specication
3.2.1 Evaluating system
3.2.2 Playback system .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
systems
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5.2
6.2
3
3
4
4
5
5
5
6
6
7
8
8
9
11
11
12
12
12
13
Components . . . . . . . . . . . .
5.1.1 MIDI module . . . . . . .
5.1.2 System module . . . . . .
Management of input and output
5.2.1 Screen management . . .
5.2.2 Data management . . . .
5.2.3 Graphics management . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
6 Implementation
6.1
1
2
Representation of music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Representation of piano keyboard . . . . . . . . . . . . . . . . . . . . . . . . 15
5 System architecture
5.1
ix
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
17
17
17
17
18
18
19
20
21
21
21
21
22
22
23
6.2.1
6.2.2
6.2.3
6.2.4
6.2.5
Application graphics . . . . . . . .
PianoRoll library overview . . . . .
XML object loader . . . . . . . . .
Input from keyboard . . . . . . . .
External tools for lesson authoring
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
23
24
25
25
25
7 Testing
27
8 Conclusion
29
9 Bibliography
31
A List of acronyms
33
B UML diagrams
35
C Application screenshots
39
41
E User manual
43
F CD Content
45
7.1
7.2
8.1
Test setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Testing process and results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
List of Figures
2.1
2.2
2.3
2.4
2.5
2.6
2.7
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
3
4
6
7
8
9
4.1
4.2
4.3
4.4
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
13
14
14
15
5.1
5.2
5.3
5.4
Hierarchy of modules . . . . . . . .
Diagram of application's menu ow
Diagram of objects in XML le . .
Graphics lifecycle in application . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
17
19
20
20
6.1
6.2
6.3
6.4
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
22
24
24
26
7.1
B.1
B.2
B.3
B.4
.
.
.
.
.
.
.
.
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
PianoRollLibrary members
. . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
35
36
37
38
xi
xii
CHAPTER 1.
INTRODUCTION
1 Introduction
Playing the piano is a skill usually learnt during childhood from professional teachers,
typically in weekly sessions. Although the grand piano has limited mobility and is often
expensive, it is still one of the most familiar musical instruments and the most favoured to
begin with. In recent years, popularity of keyboard instruments has been boosted by the
increasing quality and the decreasing price of more portable versions of piano the digital
piano and the electronic keyboard.
Looking at the age of beginner pianists there is a signicant amount of adults who decide
to learn to play the piano. However, most potential students give up the idea even without
trying. The reasons might dier from case to case but the majority are frightened by
the necessity of the traditional education system which could appear to be too pedantic.
Furthermore, there is the musical notation which might scare o another group of people,
although reading music is not as hard as it seems at rst sight.
Having a talent for music is not the key point to successfully learn playing any musical
instrument as it requires lot of patience as well as regular exercising and nothing can express
the whole principle more accurately than the phrase: Practise makes perfect. In addition
the gained skills must be maintained by occasional training and can be even completely
forgotten after some time.
CHAPTER 1.
INTRODUCTION
electronic tutorial is not the right one. As it applies mostly to motor skills; the bad habits
gained at the beginning are later hard to get rid of. At least an occasional supervision by
a professional piano teacher who checks the technique and recommends suitable exercises
for further training is necessary.
CHAPTER 2.
CHAPTER 2.
2.1.2 Klavarskribo
Klavarskribo is a music notation introduced in 1931 by the Dutchman Cornelis Pot. It
distinguishes from the conventional notation by being easily readable. However, it hasn't
met with great success among music teachers and the only signicant group of people using
the notation in practice nowadays are the members of the promoting organizations in the
Netherlands [10]. Although the notation is universal for all instruments and for singing it
suits keyboard instruments the most since the design logic is based on the piano keyboard.
The example of Klavarscribo can be seen in Figure 2.3.
The klavar notation itself is unique in the way the stave is placed on the page and
corresponds to the real piano keyboard more than the traditional layout which consists
of ve horizontal lines and four spaces whereas in the klavar stave, the notes are written
vertically and the music is read from top to bottom. The lines match the position of the
black keys on the keyboard thus each note has its own individual place and no sharps, ats
or even any key signature are needed. In other words, Klavarskribo presents a notation in
its straightforward form, stripped of the music theory. Whether the note is played by right
or left hand is indicated by the orientation of note's stem. The Klavarskribo Foundation
has transcribed over 25,000 pieces and custom composition can be transcribed easily with
the aid of specialized software, the KlavarScript.
CHAPTER 2.
representation of the sound depends on the current synthesizer. Another advantage over
the wave storage system is ease of editing, composing or recording the music data including
the possibility of its conversion to the printable standard notation eventually.
SMF is dierent from native MIDI protocol, because the events are time-stamped for
playback in the proper sequence. The data are stored in hexadecimal form and are structured into two dierent types of chunks, header and track. The le does not contain only
the notes but also stores the information about instrument used to replay the track in
a form of specic instrument patch which is identied by a Program Number parameter
with a range of 128 possible values where each number corresponds to one melodic sound.
The portability between several synthesizers is ensured by the instrument table dened in
General MIDI (GM) standard.
2.1.4 MusicXML
This type of music notation is not meant to be used by the players directly but can serve as
a storage format further used by music production software. The transcription is based on
Extensible Markup Language (XML) which is the format widely used by automated tools
to be parsed and manipulated. MusicXML was designed for the interchange of scores.
Although it can be possibly written by hand, a more practical approach is to use an
interactive score writing program. More details can be found in [12].
CHAPTER 2.
CHAPTER 2.
CHAPTER 2.
CHAPTER 2.
10
CHAPTER 2.
CHAPTER 3.
11
The system allows the user to play the songs without the player's knowledge of
musical notation.
The system provides the instruction information about piano playing in the form of
complete lessons.
Lessons have a specied number of songs which are required for their completion.
Lessons consist of an individual amount of songs and it is up to user which songs
they choose to play.
A song is considered completed when a required percentage of score points is gained
by the player.
Before the song starts playing, the user can choose to play the song in a slower tempo
but is penalized as the score is evaluated.
While playing the song the user is informed about the remaining time of the song
and the amount of score points gained.
The song's playback can be paused by the user.
When the song is nished the user is informed of their achievement.
An electronic keyboard and PC are connected together via a MIDI interface.
Lessons data are dened in an external le which is possible to edit.
The songs are identied by their names; the song's author might be added as well.
The application can be exited at any point by pressing and conrming the escape
command.
The system's behavior from the user's point of view is described in a use case diagram
placed in Figure B.1. End users of the system are people of any age who are willing to
connect two devices together and spend their free time playing the keyboard in front of
their computer.
12
CHAPTER 3.
CHAPTER 4.
13
14
CHAPTER 4.
CHAPTER 4.
15
16
CHAPTER 4.
CHAPTER 5.
SYSTEM ARCHITECTURE
17
5 System architecture
After we got through the specication of the program's functions and we have a rough idea
of its graphical look, it is time to plan the solution from the software architectural view
and to build preliminary data models. The rst steps involve the division of the system
into its separate objects so the application can be later easily implemented using object
oriented programming. The goal of the design is extensibility so the new capabilities can
be added to the software without major changes to the underlying work. The ideas for
future work are introduced in the nal part of this thesis.
5.1 Components
Beginning with the design from the global view, we have decided to split the system
as a whole into three logical parts where each part has its own functionality capability.
The hierarchy of those parts including the MIDI API is shown in Figure 5.1. The rst
module, which uses services of the MIDI API is the library managing the MIDI commands,
the second is the system library containing the graphical and MIDI related objects and
methods. The last but not least is the part where the application's entry point is placed
and which is responsible for the screen and data management.
18
CHAPTER 5.
MIDI
SYSTEM ARCHITECTURE
methods and objects which communicate directly with the MIDI library.
Recognizing, identifying and communicating with MIDI input and output devices.
Classes for sending and receiving various MIDI messages.
Song
methods working with objects storing the data from MIDI song le.
Parsing the content of the SMF and saving them into tracks which consist of notes
where each note has its pitch and duration.
Class which gathers needed data and perform the MIDI song playback with its own
MIDI clock. Also includes the displaying of 3D models.
3D model
Input
Exception
Score
calculating the score points when the piano key is pressed. The amount depends
on the actual timestamp and other parameters.
Screen manager
maintains a stack of screens and calls their update and draw methods
and routes the input to the active screen.
Game screen
screen which has its own update and draw logic and serves as a parent
screen for all screens which description follows.
Splash screen
Message box
Info screen
Menu screen
base class for screens that contain a menu of options which can be navigated and selected by the user
CHAPTER 5.
19
SYSTEM ARCHITECTURE
1 Main Menu
3 Songs
2 Players
Training
Player #1
Quickplay
Player #2
Song #2
Output device
Options
- New Player -
Song #3
Resolution
About
- New Player -
Exit
Back
6 Lessons
Song #1
Song #4
1
Back
Input device
Full screen
6/1
Back
Continue
Lesson #1
9 Playback
8 Loading
7 Lesson #1
5 About
4 Options
Back
10 Results
10
Song
Instructions
Lesson
Instructions
Lesson #2
Lesson #3
Back
Continue
Tempo
Back
Back
9
6/1
Back
Replay
Back
Background screen
age.
Playback screen
stays behind all the menu screens and draws the background im-
Loading screen
HUD
a screen which displays graphics loaded in 2D textures onto the playback screen.
Whole concept of managing the screen states has been designed according to the sample
created by Microsoft and published on their community web pages of XNA Creators Club
[8].
20
CHAPTER 5.
SYSTEM ARCHITECTURE
CHAPTER 6.
IMPLEMENTATION
21
6 Implementation
6.1 Software development tools and libraries
Before we move toward the implementation part itself, the chosen technologies will be presented together with the particular reasons for their selection from other possible options.
The research has been focused on technologies supporting Rapid Application Development
(RAD), a type of software development methodology. This technique is suitable for our
project since its principle is based on minimal planning in favor of rapid prototyping and
allows an iterative development process.
22
CHAPTER 6.
IMPLEMENTATION
CHAPTER 6.
IMPLEMENTATION
23
by 64-bit applications and is no longer part of the latest's versions of DirectX SDK [7].
Another option for how to deal with MIDI data is the package javax.sound.midi provided
by Java 2 Standard Edition Platform as a part of Java Sound API. While implementing
our application we have decided to use the winmm.dll library regarding the selection of
other development tools discussed earlier in this chapter.
To encapsulate the function of low level library, wrapping a frequently used DLL function
in a managed class is an eective approach to follow. In our application we needed to
nd a way to realize communication between a computer and MIDI devices using MIDI
messages on the programming level. We are going to use the winmm.dll library, written in
C programming language. Instead of writing our own C# wrapper we will take advantage
of the complete solution to speed up the process of development.
We have found two remarkable .NET MIDI libraries. The rst is NAudio [6], the library
of which development started in 2001, with currently released 1.2 version from June 2008
published under the Microsoft Public License. NAudio is a complete solution for working
with variety of audio le formats, not only MIDI. The second is C# MIDI Toolkit [13]
which has been developed by the author since February 2004 now in its fth version from
April 2007 licensed under the MIT License.
Both toolkits have their source code available to browse together with demo applications
thus we could have made our decision according to the suitability of the projects capabilities
to our application by looking at available objects and methods in detail and did not have
to rely on their documentation. Although NAudio is robust project it is still marked as in
beta version. At the end we have decided to go with C# MIDI Toolkit due to its MIDI
orientation only, its complex structure and standalone sequencer.
24
CHAPTER 6.
IMPLEMENTATION
CHAPTER 6.
IMPLEMENTATION
25
SongPlayer's class method PlayTrack() since they are dependent on the parameters of
currently played track. Lines representing the boxes' path are static and drawn together
with the keyboard whereas the note boxes and bar lines are dynamically added or removed
from the lists according the actual position of the timer in the song.
26
CHAPTER 6.
IMPLEMENTATION
CHAPTER 7.
TESTING
27
7 Testing
While testing our application, we will focus on usability tests which examine if the product
meets the requirements from the user's point of view and how easy and intuitive its usage
is. The aim is to discover errors and areas of improvement while observing people using the
product. The tracked aspects are eciency, accuracy, recall and emotional response. The
person who leads the test, a moderator, rst nds out information about the participant
in the form of questionnaire, then he gives him concrete instructions and instead of asking
questions or showing what to do. Moderator watches the reactions and the actual steps
the user makes. An interview about person's feelings and impressions of the system closes
the testing process. Participants are identied in the report by alphabet letters since their
true identity is not relevant to the test and should stay annonymous.
28
CHAPTER 7.
TESTING
CHAPTER 8.
CONCLUSION
29
8 Conclusion
I have implemented a tutorial system which is targeted at users who are going to learn
to play the piano using an electronic keyboard and a computer. The application supports
playback of songs stored in MIDI le format and oers the user the possibility of participating either in Training or Quickplay mode. The player's knowledge of musical notation
is not required since the program represents music in a visual form.
I have chosen the subject of this work because of my personal knowledge of the piano
playing educational system. I found there is a lack of encouragement which prevented me
from returning to playing after a few years of pause. Therefore my goal was to create a
piano playing tutorial system which would be educative and entertaining at the same time.
When designing the application itself I was mainly inspired by my experience with Guitar
Hero whose concept seemed to me to be applicable for educational purposes if applied to
the real musical instrument.
First of all I had to look closely at the current situation regarding available tools and have
learnt from their drawbacks and took advantage from their successful points. I studied in
detail the MIDI technology to learn how to handle communication between an instrument
and a computer program. I also searched for the most suitable option of handling the
MIDI commands in my program.
Through testing I have conrmed that players who are not familiar with standard musical
notation can use the program prociently and with a clear fun element. Though the
system's data needs to be precisely adjusted to ensure their adequate diculty. I am
aware of the necessity of cooperation with a professional teacher for creating the lesson
data to ensure the eectiveness of the educational element.
30
CHAPTER 8.
CONCLUSION
CHAPTER 9.
BIBLIOGRAPHY
31
9 Bibliography
[1] MIDI Manufacturers Associatio. MIDI.
http://www.midi.org/.
[2] Jan Dostal.
32
CHAPTER 9.
BIBLIOGRAPHY
APPENDIX A.
LIST OF ACRONYMS
A List of acronyms
2D
Two-Dimensional
3D
Three-Dimensional
API
DDR
DTD
GM
General MIDI
GUI
HUD
Heads-Up Display
MIDI
MMA
RAD
SMF
UI
User Interface
XML
YMS
33
34
APPENDIX A.
LIST OF ACRONYMS
APPENDIX B.
UML DIAGRAMS
B UML diagrams
Use cases
35
36
APPENDIX B.
Class diagrams
UML DIAGRAMS
APPENDIX B.
UML DIAGRAMS
37
38
APPENDIX B.
UML DIAGRAMS
APPENDIX C.
APPLICATION SCREENSHOTS
C Application screenshots
Menu screen
39
40
APPENDIX C.
APPLICATION SCREENSHOTS
Playback screen
APPENDIX D.
41
42
APPENDIX D.
APPENDIX E.
USER MANUAL
43
E User manual
System requirements
Supported operating systems: MS Windows XP SP3, MS Windows Vista SP1.
A graphics card that supports DirectX 9.0 and Shader Model 1.1.
Installed Microsoft XNA Framework Redistributable 3.0.
Installed Microsoft .NET Framework 2.0 or higher.
Electronic keyboard connected to the computer via MIDI.
Installation instructions
Application installation is not required, user can run the le directly by opening the le
PianoRoll.exe.
Select
Cancel
Down
Up
Left
Right
44
APPENDIX E.
USER MANUAL
APPENDIX F.
45
CD CONTENT
F CD Content
CD
|-|-|-|
|
\--
PianoRoll
src
text
|--latex
\--thesis.pdf
readme.txt
- Executable file
- Source files of the application
- Source files of this text
- PDF version of this text
- User manual
46
APPENDIX F.
CD CONTENT