(courtesy Harvard Science Center demonstrations)
I thought about ways that such a demonstration could be made musically using simple processes. After writing the music21 code to do so, I discovered that several other composers have done similar things, so I don't think that it's absolutely original, but I wanted to share the possibilities. First the opening of the score and the recording:
Play here directly: Or if that doesn't work: Click here
Here's the music21 code used to make it (unhighlighted code in music21-tools Github repository under composition.phasing):
Play here directly: Or if that doesn't work: Click here
Here's the music21 code used to make it (unhighlighted code in music21-tools Github repository under composition.phasing):
- def pendulumMusic(show = True,
- loopLength = 160.0,
- totalLoops = 1,
- maxNotesPerLoop = 40,
- totalParts = 16,
- scaleStepSize = 3,
- scaleType = scale.OctatonicScale,
- startingPitch = 'C1'
- ):
- from music21 import scale, pitch, stream, note, chord, clef, tempo, duration, metadata
- totalLoops = totalLoops * 1.01
- jMax = loopLength * totalLoops
- p = pitch.Pitch(startingPitch)
- if isinstance(scaleType, scale.Scale):
- octo = scaleType
- else:
- octo = scaleType(p)
- s = stream.Score()
- s.metadata = metadata.Metadata()
- s.metadata.title = 'Pendulum Waves'
- s.metadata.composer = 'inspired by http://www.youtube.com/watch?v=yVkdfJ9PkRQ'
- parts = [stream.Part(), stream.Part(), stream.Part(), stream.Part()]
- parts[0].insert(0, clef.Treble8vaClef())
- parts[1].insert(0, clef.TrebleClef())
- parts[2].insert(0, clef.BassClef())
- parts[3].insert(0, clef.Bass8vbClef())
- for i in range(totalParts):
- j = 1.0
- while j < (jMax+1.0):
- ps = p.ps
- if ps > 84:
- active = 0
- elif ps >= 60:
- active = 1
- elif ps >= 36:
- active = 2
- elif ps < 36:
- active = 3
- jQuant = round(j*8)/8.0
- establishedChords = parts[active].getElementsByOffset(jQuant)
- if len(establishedChords) == 0:
- c = chord.Chord([p])
- c.duration.type = '32nd'
- parts[active].insert(jQuant, c)
- else:
- c = establishedChords[0]
- pitches = c.pitches
- pitches.append(p)
- c.pitches = pitches
- j += loopLength/(maxNotesPerLoop - totalParts + i)
- #j += (8+(8-i))/8.0
- p = octo.next(p, stepSize = scaleStepSize)
- parts[0].insert(0, tempo.MetronomeMark(number = 120, referent = duration.Duration(2.0)))
- for i in range(4):
- parts[i].insert(int((jMax + 4.0)/4)*4, note.Rest(quarterLength=4.0))
- parts[i].makeRests(fillGaps=True, inPlace=True)
- parts[i] = parts[i].makeNotation()
- s.insert(0, parts[i])
- if show == True:
- #s.show('text')
- s.show('midi')
- s.show()
One nice thing that you can do is call pendulumMusic with different attributes, such as:
which gives a denser score that has parts that sound like Nancarrow. Or this version...:
Happy process music composing!
pendulumMusic(show = True, loopLength = 210.0, totalLoops = 1, maxNotesPerLoop = 70, totalParts = 64, scaleStepSize = 1, scaleType = scale.ChromaticScale, startingPitch = 'C1', )Play here directly: Or if that doesn't work: Click here
which gives a denser score that has parts that sound like Nancarrow. Or this version...:
pendulumMusic(show = True, loopLength = 210.0, totalLoops = 1, maxNotesPerLoop = 70, totalParts = 12, scaleStepSize = 5, scaleType = scale.ScalaScale('C3', '13-19.scl'), startingPitch = 'C2', )Play here directly: or if that doesn't work: Click here which should produce a 19-tone version of the same piece.
Happy process music composing!
(Updated 2021 September to replace Flash links from 2012 with HTML 5 and point to the correct Github repository)
No comments:
Post a Comment