# Thread: Music Programming - Serial Matrix Display (Help needed)

1. ## Music Programming - Serial Matrix Display (Help needed)

Hi

I have the following assignment to do for a music programming class but I'm a brutal programmer so need some help with C. I don't expect someone to do the whole thing for me, but any help with the following problem would be greatly appreciated. If anyone can help with some parts of this, I would really appreciate it.

Matrices are a major problem so help with the matrix elements would be particularly great.

Thanks

The program is to: Write a program that, given a certain series of 12 unique pitch-classes
(notes), prints out the 12x12 serial matrix. Heres an algorithm:

and the info is given below:

Serial Matrix Display

Serial Music is one of the names given to the technique of composition developed by
Arnold Schoenberg in the early decades of the 20th Century. It consists on using a tone
row of 12 different pitch-classes (C, C#, ..., B) in four different versions (original,
inverted, retrograde and retrograde of inversion) as the basis for a piece. The tone row
can have pitch-classes in any order, but without any repetition (as a plain introduction,
see Twelve-tone Technique in the Wikipedia or, for more details, Serialism in the online
Grove Dictionay of Music).

In order to assist the process of composition or analysis of 12-tone music, a 12x12 serial
matrix can be built. The first row of the matrix will receive the original 12 notes, from the
left to the right. The inversion of the series will fill the first column of the matrix, from
the top to the bottom. To complete the matrix, the other rows will receive transposed
versions of the original series, each one starting with the note in the first column. When
the matrix is completed, all the transposition forms of the original series can be read in
the rows from left to right, the retrograde forms in the same rows from right to left, the
inversions in the columns from top to bottom and the retrograde of inversion forms in the
opposite sense.

Write a program that, given a certain series of 12 unique pitch-classes
(notes), prints out the 12x12 serial matrix. Heres an algorithm:

(a) substitute the notes for integers in an ordered form from 0 to 11, i.e. representing
pitch-class C by the number 0, the pitch-class D-flat (or C-sharp) by the number 1 and
so on, up to the pitch-class B, which will be represented by the number 11.

(b) all the manipulations with the serial forms can be treated by arithmetical formulas. In
this case, the formulas for the creation of the first column inverse form could be
Pm,1 = [(Pm-1,1+ (P1,m-1 - P1, m)] mod12

(c) and the subsequent transposition of the original series
Pm,n = [(P1,n + (Pm,1 - P1,1)] mod12

For this assignment, you will write a program that takes in a user-defined tone-row as
input and then build a serial matrix and display it at the terminal (see notes below).

Example:

1 Original series: B B-flat D E-flat G G-flat A-flat E F C D-flat (Webern , op. 24)
2 Numerical representation: 11 10 2 3 7 6 8 4 5 0 1 9
3 First column inverse form:

P2,1 = [(P1,1+ (P1,1 - P1, 2)] mod12 = [(11 + ( 11 - 10)] mod12 = 12 mod12 = 0
P3 1 = [(P2,1+ (P1,2 - P1, 3)] mod12 = [(0 + ( 10 -2)] mod12 = 8 mod12 = 8
P4 1 = [(P3,1+ (P1,3 - P1, 4)] mod12 = [(8 + ( 2 - 3)] mod12 = 7 mod12 = 7
...
P12 ,1 = [(P11,1+ (P1,11 - P1, 12)] mod12 = [(9 + ( 1 - 9)] mod12 = 1 mod12 = 1

4 First row transposed original form:

P2,2 = [(P1,2+ (P2,1 - P1, 1)] mod12 = [(10 + ( 0 - 11)] mod12 = [-1] mod12 = 11
P2,3 = [(P1,3+ (P2,1 - P1, 1)] mod12 = [(2 + ( 0 - 11)] mod12 = [-9] mod12 = 3
....
P2,12 = [(P1,12+ (P2,1 - P1, 1)] mod12 = [(9 + ( 0 - 11)] mod12 = [-3] mod12 = 9

5 The 12x12 serial matrix:

11 10 2 3 7 6 8 4 5 0 1 9
0 11 3 4 8 7 9 5 6 1 2 10
8 7 11 0 4 3 5 1 2 9 10 6
7 6 10 11 3 2 4 0 1 8 9 5
3 2 6 7 11 10 0 8 9 4 5 1
4 3 7 8 0 11 1 9 10 5 6 2
2 1 5 6 10 9 11 7 8 3 4 0
6 5 9 10 2 1 3 11 0 7 8 4
5 4 8 9 1 0 2 10 11 6 7 3
10 9 1 2 6 5 7 3 4 11 0 8
9 8 0 1 5 4 6 2 3 10 11 7
1 0 4 5 9 8 10 6 7 2 3 11

Notes:

1. mod12 = is the generalized modulus-12 operation (defined for both positive and
negative numbers), and not simply the % remainder operator. Eg.: 5mod12 = 5;
12mod12=0; -5mod12=7; 15mod12=3; -10mod12=2, etc. It is up to you to implement
this operation as best as possible.
2. The program should ideally take pitch-class names (C,c,C#,c#, Db,db,D,d etc...),
which will then be translated into numeric form. For the matrix display, you should also
print pitch-class names. Remember that C and c should be equally good inputs for pitchclass
C and that certain notes have the same pitch class (eg. Db and C#) and should also
be allowed.
3. The program should do all the checks for wrong inputs etc.
4. As a suggestion, write the program in incremental steps, implementing one
functionality at a time. If you do not manage to implement everything, at least you have
something that works partially.
5. The mode of input should be interactive (ie. the user should be queried for input).
6. As an extra, if you are on Windows would be to playback the series or one of its
variants (say a column or a row of the matrix) using MIDI (see the website for a sample
code). 2. Popular pages Recent additions 