from music21 import tempo, note, stream
import math
min = 60
max = 600
period = 50
s = stream.Stream()
for i in range(100):
scalar = (math.sin(i * (math.pi*2) / period) + 1) * .5
n = ((max-min) * scalar) + min
s.append(tempo.MetronomeMark(number=n))
s.append(note.Note('g3'))
s.show('midi')

This feature lets you create pieces with the types of precise changes of tempo that Conlon Nancarrow painstakingly created in his piano-roll compositions. We'll soon have demos to show how you can use these features to create independent tempo marks in different parts to weave independent strands of music in your works. On the analytical side, importing precise tempo marks can open up new avenues for research on performance and interpretation, comparing the tempos chosen with those marked in the score.
To use the latest (not thoroughly tested) releases of music21 via SVN, we recommend developing using Eclipse. See Using Music21's SVN version with Eclipse. Otherwise, wait a few weeks for the latest release with lots of other improvements.
No comments:
Post a Comment