I wrote a program to study the interplay of melody and rhythm between con-current melodic lines. The results of my program along with discussion, are presented below.

Notes:

- I probably use incorrect/nonstandard terms to describe things. To avoid confusion, I have defined my terminology below.
- The program used to generate the audio was written using the ChucK language.

## Program Summary and Definitions

The program revolves around the playPerms function, which takes the following arguments:

- int BPMa – The first of two tempos (in beats per minute)
- int BPMb – The second of two tempos
- dur playTime – The shortest amount of time a stream is played
- dur restTime – The shortest amount of time before a subsequent stream begins
- int scale[] – An array of notes being used to generate melodies
- int numCycles – The number of times the program cycles
- int duplicate – A boolean variable. If set to 1, we map an existing array of note values and durations onto our streams. If set to 0, melodies and note duration is randomly generated based on the scale and tempos provided.
- int randomLengths – A boolean variable. If set to 1, durations of notes in a stream are randomly assigned based on the tempo assigned to that stream. If set to 0, duration of each note is the same, based on the tempo assigned to that stream.

Consider streams M_a and M_b, with corresponding tempos T_a and T_b. Here are some definitions:

- The length of a stream M_a is equal to the number of time steps (composed of notes or rests) of that stream.
- A single time step is the smallest discrete time value
- TTC = the time it take for T_a to beat at the same time as T_b. Note that TTC_ab = TTC_ba.
- The beats to coincidence of M_a and M_b (BTC_ab) is the number of beats of T_a until it beats at the same time as T_b (BTC_ba is similarly defined).
- We say
*M_a morf BTC_ab*if the length of a stream M_a is a multiple or factor of BTC_ab. Subsets include:- M_a m BTC_ab (when the length of M_a is a multiple of BTC_ab)
- M_a f BTC_ab (when the length of M_a is a factor of BTC_ab)
- M_a = BTC_ab (when the length of M_a equals BTC_ab)

- Similarly
*M_a morf BTC_ba*if the length of M_a is a multiple or factor of BTC_ba - M_a is prime to BTC = neither of the above two possibilities holds
- M_a and M_b match stream when the pitch sequences are identical up to the length of the shortest stream
- M_a and M_b are time inversions when the pitches sequences are in reverse order up to the length of the shortest stream
- A stream is uniform when the same pitch is sounded each time.

The values for each stream are determined as follows:

- Length of stream – This is chosen randomly from an array of [BTC_ab, BTC_ba, BTCmab, BTCfab, BTCmba, BTCfba, TTC, TTCf, TTCm], which are calculated by the program based on BPMa and BPMb. If duplicate = 1, this is simply the number of notes in the melody provided for duplication.
- Length of notes in a stream – If randomLengths = 1, then an integer between 1 and 4 is randomly multiplied by value of a quarter note (based on the tempo assigned to that stream).
- Tempo of a stream – This is randomly assigned to each stream from the tempos input by the user. Furthermore, weights are assigned to each stream’s tempo according to register.
- Pitch class of notes in a stream – This is not random, but built in to the function so that each stream can be discriminated by pitch.
- Notes assigned to a stream – This is generated by randomly choosing notes from the scale provided. If duplicate = 1, the notes match those given to duplicate.
- Instrument assigned to a stream – For the time being, a mandolin instrument is used for all streams.
- The onset and duration of each stream –

## Examples

Here are some examples the program has generated:

0
## Leave a Reply