Computer Music - Spring 2014/HW3

From MCIS Wiki
Jump to: navigation, search

Random Music

We will be inspired by Riley's In C - the music / instructions are here: http://javanese.imslp.info/files/imglnks/usimg/4/47/IMSLP00899-TerryRiley-InC.pdf

Create a similar composition, abiding by the following ideas:

  • You should have at least 8 different musical ideas. Please keep these fairly tonal (stay within a particular scale).
  • You should be able to mix an arbitrary number of voices - please submit a version with at least 7 voices in it.
  • There should be an identifiable rhythmic pulse. That is, make each component a whole number of beats so that when mixed together everything shares a common beat
  • You may add an underlying rhythmic accompaniment that stays constant
  • Each player moves through the various ideas in sequence but varies the idea in some way. Do not make alterations that clash with the underlying rhythm or tonality. Some suggestions:
    • Repetition
    • Change instruments or add instrumental effects
    • Add some silence
    • Double or halve the tempo
    • Transpose to a related key (up or down octaves or fifths for example)
  • These variations should not change the overall duration of the idea radically - for example, repeating between 1 and 50 times would be bad but repeating between 5 and 10 times would be OK. The idea is that all voices progress at roughly the same rate
  • You can have multiple sections - have all voices do 4 ideas and then when all are done do the next 4 ideas.


This is due Monday night, Feb 24

Here is a partial rendition of In C:

module InC where

import Euterpea
import Utils
import Data.List

-- This accents a note
accnt m = phrase [Dyn (Accent 2)] m

-- 7 phrases from In C
phrase1 = timesM 3 $ grace (-4) (1/8) (e 4 qn)
phrase2 = grace (-4) (1/4) (e 4 en) :+: f 4 en :+: e 4 qn
phrase3 = rest en :+: e 4 en :+: f 4 en :+: e 4 en
phrase4 = rest en :+: e 4 en :+: f 4 en :+: g 4 en
phrase5 = e 4 en :+: f 4 en :+: g 4 en :+: rest en
phrase6 = c 5 wn :+: c 5 wn
phrase7 = rest dhn :+: rest en :+: c 4 sn :+: c 4 sn :+: rest en :+: rest wn

-- This is a repeated 1/8 note to define the pulse
ens = instrument SynthBass1 $ c 3 en 

-- These are some percussion sounds.  The d parameter is a duration

cymb d = instrument Percussion $ as 3 d
drum1 d = instrument Percussion $ fs 5 d
drum2 d = instrument Percussion $ gs 2 d
drum3 d = instrument Percussion $ e 2 d

-- A simple drum beat
drums1 = (accnt $ drum2 qn) :+: drum2 qn :+: drum2 qn :+: drum2 qn
drums2 = rest en :+: drum3 qn :+: drum3 qn :+: drum3 qn :+: drum3 sn :+: drum3 sn

-- All of the drums
drums = drums1 :=: drums2

-- Random elements
-- Wait time between phrases in half notes
waits g = randomRs (0 , 2) g
-- Number of times to repeat each phrase
reps g = randomRs (4, 7) g
-- Instrument selection
instrs g = randomChoice g [Marimba, AcousticGrandPiano, Kalimba, Trumpet, SlapBass1]
-- All phrases
phrases = [phrase1, phrase2, phrase3, phrase4, phrase5, phrase6, phrase7]

playInC n = line $
            zipWith4 (\wait rep inst phrase ->
                        timesM wait (rest hn) :+:
                        instrument inst 
                          (timesM rep phrase))
                     (waits g1) (reps g2) (instrs g3) phrases
  where g1 = mkStdGen n
        g2 = age g1
        g3 = age g2

background = repeatM ens :=: repeatM drums

allVoices = background /=: (chord (map playInC [1..10]))