We have a number of powerful Stream transformation methods available now, including transpose() and augmentOrDiminish(). My favorite task with such utilities is creating mensural canons. The example below does just that, using a Bach soprano line as the melodic source.
Further explanation can be found here:
from music21 import *
src = corpus.parseWork('bach/bwv323.xml')
ex = src.getElementById('Soprano').flat.notes
s = stream.Score()
for scalar, t in [(1, 'p1'), (2, 'p-5'), (.5, 'p-11'), (1.5, -24)]:
part = ex.augmentOrDiminish(scalar, inPlace=False)
part.transpose(t, inPlace=True)
s.insert(0, part)
s.show()
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjshVHzIrnCu3GzE4sxOzzsNUPw4sz_qThg9Ij0NGMgapw0pKVQxVrtzKCbjhuQ3wVrlFBCeDKxpfGQTxLLAH1FxFH9FxCurRkSWC1BhtJ6Qah8XUckQPVhYWfNJ8pu5dYiG8qiiSv6iR4/s400/examples-02.png)