Music Theory and Performance Analysis with Sebastian and Czerny

James Tauber @jtauber

The Idea The Components
Sebastian

The Score The Performance The Recording

Lilypond Czerny MIDI

WAV

Sebastian

Mathematical: Symbolic more than Numerical

Modeling Music repetitive hierarchical sequential + parallel factorable underspecified .

{PITCH: 2. OCTAVE: 5. DURATION: 16}. DURATION: 8} ] . OCTAVE: 4. PITCH: 21.Point of Departure { {OFFSET: 0. PITCH: 37. {OFFSET: 16. DURATION: 16}. DURATION: 8} } or [ {PITCH: 3.

Three Blind Mice mice = (seq1 * 2) + (seq2 + seq2a) + (seq2 + seq2b) + ((seq3 + seq3a) * 2) + (seq3 + seq3b) + seq1 .

Three Types of Sequence HSeq — Horizontal / Sequential VSeq — Vertical / Parallel OSeq — Offset-based .

HSeq each element follows the previous concatenate(next_seq) repeat(count) __add__ __mul__ A = B * 2 + C .

VSeq each element is coincident merge(parallel_seq) __floordiv__ A = B // C .

OSeq factory function that returns a class using the given offset attribute and duration attribute def OSeq(offset_attr. duration_attr) has operators of both HSeq and VSeq .

All Sequences __init__(*elements) __getitem__ & __len__ __eq__ & __ne__ transform(func) __or__ A = B | transpose(5) | reverse() .

Three Types of Sequence HSeq — Horizontal / Sequential VSeq — Vertical / Parallel OSeq — Offset-based .

OCTAVE: 4} % {DURATION: 16} .Points handling underspecification with dictionaries unify(other) __mod__ {PITCH: 3.

Pitch note names t wo numbers or one? MIDI pitch Hewlett’s base-40 system my own system just have transforms for conversion .

5]] . G is -1) semitone above is x-5 augment (semitone above. 2. -1.Tauber’s Pitch System D is 0 and each successor is a fifth higher modulo octave (e. same letter) is x+7 modifiers: ((val+3)-((val+3)%7))/7 major scale: [tonic + i for i in [0. A is 1.g. 3. 1. 4.

interp import parse ! seq1 = parse("e4.lilypond. d c r") seq2 = parse("g4. f4 f8 e4.Lilypond from sebastian.") seq2b = parse("r4 g8") seq3 = parse("c'4 c'8 b a b c'4 g8 g4") seq3a = parse("g8") seq3b = parse("f8") .") seq2a = parse("r4.

'offset_64': 48.Lilypond seq1 = parse("e4. 'offset_64': 0. 'offset_64': 24. 'duration_64': 24}. {'midi_pitch': 50. {'midi_pitch': 48. {'offset_64': 96}] . 'duration_64': 24}. d c r") [{'midi_pitch': 52. 'duration_64': 24}.

write("mice.MIDI library for parsing and generating MIDI files from sebastian.midi import write_midi ! write_midi.mid". [mice]) .

Alberti common classical figuration of a triad a function from a triad to a sequence of notes great example of factorization and underspecification .

triad[2]. triad[1]. triad[2] ]) .Alberti def alberti(triad): return HSeq([ triad[0].

Alberti root_triad = VSeq( Point(degree=1). Point(degree=5)) ! quaver = Point({DURATION_64: 8}) ! alberti_seq = OSequence( alberti(root_triad) * 16 | add(quaver) ) . Point(degree=3).

5) | midi_pitch() ! write_midi. [seq]) . major_scale) ! seq = alberti_seq | degree_in_key_with_octave(C_major.write("alberti.mid".Alberti C_major = Key("C".

What’s Next? a lot more examples better use of MIDI input control over instruments in MIDI output nesting of sequences (for hierarchy) the notion of a “head” point .

Sebastian .

com/ jtauber/ sebastian .github.

Czerny .

What’s the Difference bet ween the “Score” and the “Performance” .

Positive vs Negative Differences study expression the performer is adding what errors were made? what inconsistencies or unevenness? .

Representing the Performance a sequence of events MIDI? .

Representing the Score just another sequence of events but this time desired events and with less information .

C major scale ascending then descending over one octave represent as sequence of note + duration 60 62 64 65 67 69 71 72 71 69 67 65 64 62 60 8 4 4 4 4 4 4 8 4 4 4 4 4 4 8 .

MIDI Performance 4d54 726b 6c74 6961 0800 00ff 3a2c 9040 812d 473b 0b90 433d 2c90 3081 ff2f 6864 0000 00ff 6e6f ff59 5103 903c 001f 9043 814b 473b 0490 4100 1490 00 0000 00cd 0413 2048 0200 07a1 0081 9041 002a 9047 8148 4500 2090 3e00 0006 00ff 5374 616c 0000 2089 3290 4181 9045 0018 9047 8132 4038 4190 0000 0308 6569 6c00 ff54 6d90 3e00 3e90 4d81 9048 0006 9043 810e 3c42 0001 2364 6e77 ff58 0521 3c4f 0390 4100 2090 5583 9045 0022 9040 831c 01e0 6566 6179 0404 0000 832b 403f 0790 4500 2690 3b81 9041 0035 903c 4d54 6175 2050 0218 0000 903e 8137 4344 2690 4800 5990 3981 903e 0000 .

Performance Events offset in “ticks” MIDI pitch velocity 0 velocity indicates note off 1261 1688 1732 1910 1913 2096 2127 2317 2324 2497 2539 2699 2737 2940 2964 3386 .. 60 62 60 62 64 64 65 65 67 67 69 69 71 71 72 72 79 58 0 0 63 0 65 0 68 0 77 0 59 0 85 0 ..

Performance Events convert from note start + note end to just start + duration 1261 1688 1913 2127 2324 2539 2737 2964 3397 3603 3820 4036 4240 4435 4648 60 62 64 65 67 69 71 72 71 69 67 65 64 62 60 79 58 63 65 68 77 59 85 59 59 61 57 56 48 66 471 222 183 190 173 160 203 422 200 221 182 172 142 148 412 .

We Want to Diff 60 62 64 65 67 69 71 72 71 69 67 65 64 62 60 8 4 4 4 4 4 4 8 4 4 4 4 4 4 8 1261 1688 1913 2127 2324 2539 2737 2964 3397 3603 3820 4036 4240 4435 4648 60 62 64 65 67 69 71 72 71 69 67 65 64 62 60 79 58 63 65 68 77 59 85 59 59 61 57 56 48 66 471 222 183 190 173 160 203 422 200 221 182 172 142 148 412 vs .

Want to Diff to diff. you must first align alignment is a dynamic programming problem generally relying on notion of scoring the relative cost of adding. deletion or changing items the “change” score can be very domain specific Needleman-Wunsch algorithm .

5 if a tone or semitone apart. 0 if different or: +1 if same. 0 if more duration? wrong octave? .“Change” Score just consider note value: +1 if same. +0.

(3820. (3603. 4). 64. 58. ((69. 48.Result ((60. 4). (4435. 60. (2737. (2539. 65. 67. 8). ((71. ((64. (2964. ((67. 4). (3397. 72. 471)) 222)) 183)) 190)) 173)) 160)) 203)) 422)) 200)) 221)) 182)) 172)) 142)) 148)) 412)) . 77. 4). 64. 85. (1261. (4240. 4). 71. 61. (4036. 67. 69. 71. 4). ((62. 4). ((69. 4). 63. ((65. 65. 59. 4). (1688. 56. 59. 62. ((67. ((62. 69. 57. (4648. 59. 8). ((60. 79. 4). (1913. 65. ((72. ((64. 62. 4). (2127. 4). 60. ((65. 68. ((71. 4). (2324. 66.

Visualizing Mistakes .

Czerny .

github.com/ jtauber/ czerny .

Music Theory and Performance Analysis with Sebastian and Czerny James Tauber @jtauber .