Hoquetus - an application to compose music and put it onto sheets


  1. Introduction

    1. Main goal
      The main goal of this is to end up with an application which can be used easily to compose (sheet-)music. To get this there will be a graphical UI to enter the chords, scores, metrics, lyrics, ..., of any piece of music and have the possibility to print it out. This UI will also have all usual features of any editor, like file handling, undo-redo, zoom, copy-paste, ... The application should be OS/platform independent.

    2. Advanced goal
      Advanced goal for this application could be to have these possibilities (list is not exhaustive):
      - export and import of MIDI-, lilypond-, abc-files or other music formats
      - ability to play music within the editor (MIDI?)
      - extraction of specific instruments out of the main score

    3. The meaning of Hoquetus
      The Hoquetus is a special structure of polyphony notation used in the middle age, (see http://de.wikipedia.org/wiki/Hoquetus for some details) where one voice takes the melody over if the other voice is on pause.
      The logo shows a simple example of a Hoquetus (theme of rondo of op. 61 from Ludwig van Beethoven)

    4. License
      The source code of the application will be licensed with the GNU General Public License, either version 2 or any later version. This documentation is licensed with the GNU Free Documentation License, either version 1.2 or any later version.
      Other free licenses might apply as well, but they should be compatible to GNU GPL and/or GNU FDL.

      • If not declared different, all copyrights of this documentation are

        Copyright (c) 2006,2007 Hans-Georg Bork <hgb@users.sourceforge.net>.
        Permission is granted to copy, distribute and/or modify this document
        under the terms of the GNU Free Documentation License, Version 1.2
        or any later version published by the Free Software Foundation;
        with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
        Texts. A copy of the license is included in the section entitled "GNU
        Free Documentation License".

      • If not declared different, the copyrights of all source files of the application are

        Copyright (c) 2006,2007 Hans-Georg Bork <hgb@users.sourceforge.net>.
        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 2 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.


  1. Definitions and declarations

    1. A sheet of music (see also image on, click for larger and detailed image)
      The content of a sheet of music could be just a simple melody for i.e. a flute, which can play only one tone at a time; it could also be a polyphonic melody written for a piano which can play chords or it could be a complete score for an orchestra.

      • Whatever it contains there will be a system which defines the parts which has to be played at the same time (if possible). For Hoquetus a system has one or more lines with notes on them and notes in a vertical order have to be played at the same time.

      • Every line contains measures in a defined time, e.g. 4/4, and all lines of a system have the same time at the same position.

      • Every measure has at the beginning a definition of its time (usually hidden and only shown at the begin of the music or at time changes), contain notes and has a bar line at the end.

      • Bar lines define the end of the measure (and the begin of the next measure), but are also used to define further steps, as there are: “end of the music”, “start or end of repetition”, “change of key or time”.

      • The notes are either single notes or chords or pauses; in Hoquetus all of those are seen as chords. So a chord contain either a pause or one or more notes which have to be played at the same time.

      • The chord itself is defined by its length (full note, half, quarter, ...) and the tones (notes) in it.

      • Every tone is defined by its frequency, e.g. the standard tone a' is defined with 440 Hz, the name, e.g. a' (a in the first octave) or C (c in the big octave) or G, (g in the contra octave) and the accidental. A frequency of 0 (zero) Hz defines a pause.

    2. Data structure / classes
      The description of the classes might look like program code, but are not meant to be used as such. I just tried to ease the things a bit by using terms like INT for an integer number, FLOAT for a floating point number, STRING for a string, // for a comment, ...

      • CLASS tone
        INT MIDI_No; // the tone as described in MIDI definitions, 0 (zero) to define a pause; MIDI is used since it's easier and more exact than the frequency in Hz
        STRING name; // the international name, e.g. A4 (a in the first octave) or C2 (c in the big octave) or G1 (g in the contra octave); the name might be useless in future ...
        INT accidental; // the accidental; values 0 for no change, 1 for a half tone higher, 2 for a whole tone higher, -1 for a half tone lower and -2 for a whole tone lower

      • CLASS chord
        ARRAY tones of CLASS tone; // the tones in this chord
        FLOAT length; // the length of the chord according to the value of the note, e.g. 2 for a double whole (brevis), 0.25 for a quarter, 0.166666 for a quarter in a triplet
        INT articulation; // articulation signs for the chord, e.g. 1 for staccato, 2 for accent, 3 for strong accent, 9 for legato (if within such bow) ...
        INT artic_corr; // with staccato or tenuto the play_length has to be corrected; -10 for staccato, +5 for tenuto, +10 for legato
        FLOAT length_play; // the real length if the chord is played; default value == length * ((90 + artic_corr) / 100)
        INT stem; // the direction of the stem of the notes, 0 for no stem, 1 for up, -1 for down

      • CLASS measure
        COMPLEX timing; // the timing of the measure, e.g. 2:2 for 2/2, 3:4 for 3/4, 7:8 for 7/8, ... a float is not sufficient, since the first number defines the amount of notes of the value of the second number, so the timing defines the absolute length of the measure in notes
        INT bar; // the bar at the end, 1 for single bar, 2 for double bar, 3 for start of repetition, 4 for end of repetition, 5 for end and start of new repetition, 6 for end of music
        INT clef; // the clef of the measure, e.g. 1 for G-clef, 2 for F-clef, 3 for C-clef, ... to be defined exactly later on (usually hidden except in the first measure of a line)
        INT key; // the key of the notes (accidentals), -7 for 7 b's (Ces-major or as-minor), 0 for no accidentals (C-major or a-minor), 7 for 7 #'s (Cis-major or ais-minor)
        ARRAY chords of CLASS chord; // the chords in the measure

      • CLASS line (the line is the main bar with 5 lines and 4 gaps in between on which the chords are placed)
        STRING long_name; // the instrument for which this line is, full name; usually used in the first system
        STRING short_name; // the instrument for which this line is, short name; usually used in second and further systems
        INT MIDI_Instr; // the number of the MIDI instrument to use if this line is played (0-127) see Appendix B
        INT top_distance; // distance on top of the line, e.g. distance to previous line
        INT bottom_distance; // distance on bottom of the line, e.g. distance to next line
        INT height; // the height of the line, measured by the height of the gaps; this height has to be used to define the print size of every note
        BOOL visible; // lines are sometimes invisible if the instrument in question has nothing to play; this makes a sheet easier readable
        ARRAY voice_1 of CLASS measure; // the measures of the first voice in the line, set all measure->chord->stem to 1 if voice_2 is not empty
        ARRAY voice_2 of CLASS measure; // the measures of the second voice in the line, set measure->chord->stem to -1 if this voice is not empty

      • CLASS instr_group (groups of lines per instrument, e.g. left and right hand of piano) // notated with { bracket
        STRING long_name; // full name of the group of instrument; usually used in first system
        STRING short_name; // short name of the group of instrument; usually used in second and further systems
        ARRAY lines of CLASS line; // the lines in the group; take all other values from line if there's only on in this group and use this like a line without [
        INT top_distance; // distance on top of the group, e.g. distance to previous group
        INT bottom_distance; // distance on bottom of the group, e.g. distance to next group

      • CLASS group (groups of instr_groups, e.g. all strings or all brass) // notated with [ bracket
        STRING long_name; // full name of the group of instruments; usually used in first system
        STRING short_name; // short name of the group of instruments; usually used in second and further systems
        ARRAY lines of CLASS instr_group; // the lines in the group
        INT top_distance; // distance on top of the group, e.g. distance to previous group
        INT bottom_distance; // distance on bottom of the group, e.g. distance to next group

      • CLASS system
        INT tempo; // the speed of the system in quarters per minute, also known as beat per minute or just bpm, calculation should be based on quarters
        ARRAY groups of CLASS group; // all lines in this system
        ARRAY songtext of type STRING; // additional lines to have a song text
        INT top_distance; // distance on top of the system, e.g. distance to previous system
        INT bottom_distance; // distance on bottom of the system, e.g. distance to next system

      • CLASS file
        STRING author; // author of this file
        ARRAY composer of type STRING; // the composer of the music and the arrangers of it
        ARRAY titles of type STRING; // title of music plus subtitles, e.g. “arrangement for brass band”
        ARRAY score of CLASS systems; // the score of all systems
        ARRAY header_lines of type STRING; // header lines of file or every print page
        ARRAY footer_lines of type STRING; // footer lines of file or every print page



  1. Interfaces

    1. User interface
      The main user interface will be a graphical window (GUI) with a menu, toolbars, a statusline and the main input area. From here all other interfaces are to be called in general, although it might be good to be able to call some interfaces, e.g. the MIDI-interface, from the command line without the need to start the GUI.
      On top of the window will be the menu (structure to be described later), followed by the toolbars which hold shortcuts for menuitems; the statusline will be at the bottom of the window and can be used to i.e. show short key for a specific function or the amount of characters in the clipboard or just for a one-line help.
      Between the toolbar and the statusline is the main input area, which shows as a default the content of a default template, e.g. an empty line with a G-clef in C-major in a 4/4 timing

    2. MIDI interface
      The MIDI interface allows to convert MIDI files to Hoquetus files and vice versa. It will also be possible to import MIDI files directly into the GUI and from there to export to MIDI.
      An implemented play-function will also use the MIDI interface to export on the fly into a sequencer.

    3. LilyPond interface
      The LilyPond interface allows to convert .ly files to Hoquetus files and vice versa. It will also be possible to import .ly files directly into the GUI and from there to export to LilyPond.
      This might be used to implement the printing of Hoquetus files.


< to be continued >



  1. Appendix A

    1. Table of MIDI tones
      The note letter together with the Octave form the international numbering, e.g. MIDI note number 66 will then be F#4

      Note: Not all notes are really used, since a grand piano only goes from A0 (21) till C8 (108)

Octave #

Note Numbers

C

C#

D

D#

E

F

F#

G

G#

A

A#

B

-1

0 (C,,,)

1

2

3

4

5

6

7

8

9

10

11

0

12 (C,,)

13

14

15

16

17

18

19

20

21

22

23

1

24 (C,)

25

26

27

28

29

30

31

32

33

34

35

2

36 (C)

37

38

39

40

41

42

43

44

45

46

47

3

48 (c)

49

50

51

52

53

54

55

56

57

58

59

4

60 (c')

61

62

63

64

65

66

67

68

69

70

71

5

72 (c'')

73

74

75

76

77

78

79

80

81

82

83

6

84 (c''')

85

86

87

88

89

90

91

92

93

94

95

7

96 (c'''')

97

98

99

100

101

102

103

104

105

106

107

8

108 (c''''')

109

110

111

112

113

114

115

116

117

118

119

9

120

121

122

123

124

125

126

127




  1. Appendix B

    1. Table of MIDI channels and the instruments behind


0

Acoustic Grand

64

Soprano Sax

1

Bright Acoustic

65

Alto Sax

2

Electric Grand

66

Tenor Sax

3

Honky-Tonk

67

Baritone Sax

4

Electric Piano 1

68

Oboe

5

Electric Piano 2

69

English Horn

6

Harpsichord

70

Bassoon

7

Clav

71

Clarinet

8

Celesta

72

Piccolo

9

Glockenspiel

73

Flute

10

Music Box

74

Recorder

11

Vibraphone

75

Pan Flute

12

Marimba

76

Blown Bottle

13

Xylophone

77

Skakuhachi

14

Tubular Bells

78

Whistle

15

Dulcimer

79

Ocarina

16

Drawbar Organ

80

Lead 1 (square)

17

Percussive Organ

81

Lead 2 (sawtooth)

18

Rock Organ

82

Lead 3 (calliope)

19

Church Organ

83

Lead 4 (chiff)

20

Reed Organ

84

Lead 5 (charang)

21

Accordion

85

Lead 6 (voice)

22

Harmonica

86

Lead 7 (fifths)

23

Tango Accordion

87

Lead 8 (bass+lead)

24

Acoustic Guitar(nylon)

88

Pad 1 (new age)

25

Acoustic Guitar(steel)

89

Pad 2 (warm)

26

Electric Guitar(jazz)

90

Pad 3 (polysynth)

27

Electric Guitar(clean)

91

Pad 4 (choir)

28

Electric Guitar(muted)

92

Pad 5 (bowed)

29

Overdriven Guitar

93

Pad 6 (metallic)

30

Distortion Guitar

94

Pad 7 (halo)

31

Guitar Harmonics

95

Pad 8 (sweep)

32

Acoustic Bass

96

FX 1 (rain)

33

Electric Bass(finger)

97

FX 2 (soundtrack)

34

Electric Bass(pick)

98

FX 3 (crystal)

35

Fretless Bass

99

FX 4 (atmosphere)

36

Slap Bass 1

100

FX 5 (brightness)

37

Slap Bass 2

101

FX 6 (goblins)

38

Synth Bass 1

102

FX 7 (echoes)

39

Synth Bass 2

103

FX 8 (sci-fi)

40

Violin

104

Sitar

41

Viola

105

Banjo

42

Cello

106

Shamisen

43

Contrabass

107

Koto

44

Tremolo Strings

108

Kalimba

45

Orchestral Strings

109

Bagpipe

46

Orchestral Strings

110

Fiddle

47

Timpani

111

Shanai

48

String Ensemble 1

112

Tinkle Bell

49

String Ensemble 2

113

Agogo

50

SynthStrings 1

114

Steel Drums

51

SynthStrings 2

115

Woodblock

52

Choir Aahs

116

Taiko Drum

53

Voice Oohs

117

Melodic Tom

54

Synth Voice

118

Synth Drum

55

Orchestra Hit

119

Reverse Cymbal

56

Trumpet

120

Guitar Fret Noise

57

Trombone

121

Breath Noise

58

Tuba

122

Seashore

59

Muted Trumpet

123

Bird Tweet

60

French Horn

124

Telephone Ring

61

Brass Section

125

Helicopter

62

SynthBrass 1

126

Applause

63

SynthBrass 2

127

Gunshot