A rudimentary score player for smart phones


PyAdagio is a Python script that can play simple polyphonic music on a smart phone. It is designed for students of harmony that want to listen to their exercises (typically one line or so of four part music): they input their work, then listen to it. If they have a smart phone running S60, they can input and listen to their exercises anywhere even with no piano or computer around.

PyAdagio takes text as input and generates sound as output (internally, a MIDI file is produced along the process). This means that there is no graphical user interface: you'll have to enter some text using the phone's keyboard and listen. You may find it awkward, but it works for me.

System requirements

PyAdagio v1.8 has been tested on Nokia N73 and E52 smart phones running Symbian S60 3rd Edition with PyS60 version 2.0.0.


  1. Download and install the PyS60 Python interpreter. To install PyS60 you can, for example, download the PythonForS60_2.0.0.tar.gz archive, then extract and install Python_2.0.0.sis and PythonScriptShell_2.0.0_high_capas.sis.
  2. Download PyAdagio and unzip the archive
  3. Copy the folder pyadagio into your smartphone where python is installed, ie in C:/data/python, E:/data/python, C:/python, or E:/python
  4. install pyadagio_v1.8.0.sis

Getting started

Here is a reminder of the control keys that will be used:

NOTE: If your phone is missing the Edit key, use the # key instead.

When you launch PyAdagio, it will start in navigation mode, where you can browse the files available to the program. The package comes with three sample pieces called




In the navigation screen these files will show in a list. You can move the focus up and down along the list using the joystick, or Up and Down arrow. If instead you pull up the Options menu pressing the "Left Soft Key" you will see what you can do from here:

Playplay the selected file
Newcreate a new file
Openopen the selected file
Renamerename the selected file
Copy ascreate a copy of the selected file
Deletedelete the selected file
Exitexit the program

Apart from that, the following buttons will also trigger an action in navigation mode:

Cthe Backspace Key will delete the selected file
equivalent to Options > Delete
Selectpressing the joystick, or Select Key, will open the selected file
equivalent to Options > Open
Exitthe "Right Soft Key" labeled Exit will exit the program
equivalent to Options > Exit

Why don't you take a tour of the sample files selecting them one by one and choosing Play (a pair of earbuds will significantly improve your experience).

When you open a file (Options > Open) PyAdagio enters the editing mode. The text content of the selected file will be shown on a white pad. You may find the language a little obscure, but don't be discouraged just yet: as you will see shortly, it is simpler than you may think. Get now familiar with the controls in editing mode:

If you now open the Options menu the following actions will be possible from here:

Playplay the opened file
Savecommit any changes done on the file
Save assave the text with a different name
Clearclear all the text
Deletedelete the opened file and return to navigation mode
Closeclose the file without saving and return to navigation mode

Apart from that, the following button will also trigger an action in editing mode:

Exitthe "Right Soft Key" labeled Exit will exit the file
equivalent to Options > Close

Why don't you enter some music now? This is going to be a very simple test run, just a two-note motive: F-E. Close any open file and start from navigation mode. Choose Options > New and enter the following text:

P: f e
which exactly says PyAdagio that you want one voice (P as in part) to be the two notes F and E. You can choose Options > Play to listen to your work. You don't need to save your changes before playing: the Play function considers whatever you have on your screen at the time. Anyway, before closing the file, remember to save it or your changes will be lost. If you close the file, its name will now show in the navigation screen. Open again and amuse yourself with different notes or longer tunes.

Now you want to add a second voice under the first one, a bass voice. To signify the bass role, use "pb" instead of just "p":

P: f e
pb: g c
It was so easy that we now want to add a third voice so the harmony is complete. An alto voice will be introduced by "pa", as you might expect:
P: f e
pa: b c
pb: g c
The order of the lines doesn't really matter, as does it not the case of the letters (uppercase or lowercase). How to produce a four-part perfect cadence by adding a tenor part is left to you as an exercise. You are now ready to learn more about the syntax of the text files.

Syntax of the input file

This is an exhaustive account of PyAdagio language.

In a PyAdagio input file every line is a key-value assignment, with a colon separating the key from its value:

key1: value1
key2: value2
The input syntax is case insensitive. Do not put spaces at the beginning of a line before the key name. However, you can put spaces around the colon and at the end of the line at leisure: they will be ignored. The valid keys are the following:
TTempo (quarter notes per minute) [default is 120]
VVolume on a 0-127 scale [default is 120]. Besides, instead of having one volume for all voices, you can specify the volume of each voice, all on a line, separated by space. How about making the cantus (assuming it is the first part given) stand out above the three-voice accompaniment?
I: 120 90 90 90 
IMidi instrument number in the range 1 to 128, eg 1=acoustic grand piano, 20=church organ [default is 1]. Please refer to any General Midi Level 1 sound set documentation for a complete list, and be aware that not all standard instruments are supported by all Midi players. Instead of having one instrument for all voices, you can specify the instrument of all voices on a line, separated by space. How about a string quartet:
I: 41 42 42 43 
KKey signature of the piece, expressed in number of accidentals: a positive number refers to sharps, a negative one refers to flats; eg, 2 could be C sharp minor, -3 could be E flat major (PyAdagio doesn't really care if a piece is major or minor, it just needs to know the implied accidentals) [default is 0]
PPart, ie voice line, optionally followed by a clef indicator, see below. The value of a P key is the sequence of notes in that part, formatted with the note syntax explained below.
OPanning order of voices. Imagine the parts are numbered starting from 1 in the order they appear in the text, then you can use the O key to locate them in the stereo sound image, left to right. For example, if you enter soprano, then alto, then tenor, then bass, and you want to have soprano near the center of the stereo image because it stands out a lot, for example T (far left), S, A, B (far right), you can specify
O: 3 1 2 4 

You can have several V, I, and of course P assignments. PyAdagio aggregates all V directives together, then assigns them to the parts in order, and the same happens with I. So, if you want to assign a different instrument to each voice, you can do either

V: 41 42 42 43
Ps: ...
Pa: ...
Pt: ...
Pb: ...
V: 41
Ps: ...
V: 42
Pa: ...
V: 42
Pt: ...
V: 43
Pb: ...
and the same goes for the volume. Several T, K, O assignments will not generate error, but all but the last will be ignored.

Legal clef indicators to be used in the P key are:

Vtreble clef ("violino" clef in Italian): this is the default
Ssoprano clef
Mmezzosoprano clef
Aalto clef
Ttenor clef
Br or Rbaritone clef
Bbass clef
T8 or 8treble clef lowered by an octave, used for tenors

WARNING: Any line of the form key: value attempting to define an invalid key, or assigning an illegal value to a valid key, will generate an error (in Python console) and cause the piece not to be played. Any string made of letters, numbers and the underscore _ is considered a key, be it valid or not.

Any line not complying to the key: value format and any blank line will be ignored. You can use this fact to freely write comments and annotations in your files. As a matter of style, I suggest to make your comments stand out in a consistent manner:

| Frère Jacques
| by Anonymous
| 11/9/2008
t: 180
p: c4 d e c c d e c e f g2 e4 f g2 ...
p: r1 r1 c4 d e c c d e c ...

The note syntax is designed to allow the most music with the least typing, so that the input is as easy and fast as possible even using the awkward keyboard of a cell phone. It is a language based on Lilypond syntax, with borrowings from ABC.

You must describe each note in the order given above: note, accidental, octave, duration, dot, thus composing a string of signs, or "token". You can then think of a "part" as a string of tokens, each representing one note or rest, or a ligature of two or more notes or rests, as described above. All tokens must be separated by one or more spaces and must contain no spaces (spaces around the tilde ~ are allowed and ignored). In other words, a token is defined by being separated from the others by spaces. PyAdagio examines the tokens one by one, and any token not conforming to the syntax is ignored. You can use this fact to make your files clearer and less error prone, eg putting bars, or perhaps some symbol of your choice as signum congruentiae.
| Frère Jacques
| by Anonymous
| 11/9/2008
t: 180
p: c4 d e c c d e c  #2nd_part_gets_in#  e f g2 e4 f g2 | ...
p: r1 r1 | c4 d e c c d e c | e f g2 e4 f g2 | ...
p: r1 r1 | r1 r1 | c4 d e c c d e c | ...
Finally, the ampersand symbol & is a special token that, if the last on a line, means continuation to the next line: this will allow you to break long lines and improve legibility in the narrow screen of a cell phone. Use it also to your advantage to manage longer or complex files.
| Frère Jacques
| by Anonymous
| 11/9/2008
t: 180

p: &
  1.  c4 d e c c d e c &
  2.  e f g2 e4 f g2 &
  3.  g8 a g f e4 c g'8 a g f e4 c &
  4.  c g c2 c4 g c2
p: &
  1.  r1 r1 &
  2.  c4 d e c c d e c &
  3.  e f g2 e4 f g2 &
  4.  g8 a g f e4 c g'8 a g f e4 c
p: &
  1.  r1 r1 &
  2.  r1 r1 &
  3.  c4 d e c c d e c &
  4.  e f g2 e4 f g2

Complete examples

At this point, how about trying some "real world" music? Let's take the following couterpoint example from Fux's Gradus ad Parnassum:

t: 180
ps: g^1 a f e c' c e c a g^
pa: e1 c d c a a' g e f e
pb: r2 e f. e4 d e f g a e a2~a4 g f2~f4 g a b c2 c,~c4 d e2~e d e1

It may seem hard work to type all that weird text, but please consider that entering music in a computer or even writing a manuscript takes always considerable time: it sure can't get any faster on a cell phone!

For your reference, here are the scores for the three sample pieces that come with the package.


t: 60
i: 1
v: 120
k: 1
pv: e, e g g a a b b b d c b a. a8 g2
pv: b, b e e e a8 f g4 g g g g8 f g4 g f d2
pb: g g b b c d d d d d8 b c d d4 e8 c a d16 c b2
pb: e8 f g f e d c b a g f d g4 g' g,8 a b e a, d g, b c a d4 g,2


t: 120
i: 24
v: 90
ps: r2 a~a4 f a b c g c2~c b~b c^ d4 a d2~d4 c f2~f e~e4 a, d2~d c^ d1
pa: d1 f e d g f a g f e d
pt: a1 f g g g a a c a a a
pb: d1 d c g' e d f c d a d


t: 180
i: 25
v: 120
pa: e1 c d c a a' g e f e
pt: r2 g^ a. g4 f d8 e f4 g a f8 g a4 b c2. b4 a b c d e2 e,4 f g2 c~c b4 a g^1
pb: e1 f d f f f c c d e


Current version is v1.8 released on 13 August 2010.

This software is free under the terms of the GNU General Public License: use it, share it and have fun! If you use this software and are happy with it, please consider donating.


This is PyAdagio v1.8 - a rudimentary score player for smart phones.

Copyright © 2010 Alberto Longhi <>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

For more information on the GNU General Public License please see

This program includes the Python Midi package by Max M,

Copyright © 2010