Automatically generating "tonal" canons with music21 and scamp

If you look closely to the screenshot, you will see that the error originates from canon-gen.py line 148 in the function “transform”. There you see direction=chosen_step. From the screenshot it appears that chosen_step has been assigned a string ‘descending’. However, according to the music21 documentation, music21.scale.intervalNetwork — music21 Documentation direction should now be an enum instead of a string, so you will need to change the code in the canon-generator a bit not to use strings, but to use an enum instead (see the music21 documentation I linked to).

In other words, instead of strings like ‘ascending’ and ‘descending’, newer versions music21 now expect something like scale.Direction.ASCENDING or scale.Direction.DESCENDING.

path_to_musescore is the path to where the musescore executable can be found.

So I shouldn’t put anything? The executable is the part of the musescore files with the logo that lauches the program I believe? Why is there a path to it when the generator generates?

So I shouldn’t put anything? The executable is the part of the musescore files with the logo that lauches the program I believe? Why is there a path to it when the generator generates?

To be honest I forgot the details, but I guess it had to do with displaying a score. I’d start by trying not to set anything.

I see. By the way, I asked help for it on the music21 group so maybe I’ll finally be able to do it?

Your generator will allow me to do impossible things like making many voices canons with the locrian and the enigmatic scale! I actually found great progressions using music theory. Also, any way you plan to make a crab canon generator? Here’s a progression I made that kinda goes from Gb major tonality to F locrian for someone who asked how they could do that in their pieces:


It still didn’t work. Reposting now since I’m not sure if you saw my previous messages? By the way, enigmatic progression:

Even enigmatic music!

I suspect you passed ‘Direction.DESCENDING’ as a string instead of as an enum.

But none of these recent questions are “canon generator” questions. They show a lack of understanding how to write python code. From your questions, I’m afraid you may not be ready yet to play with the canon generator in its current form. Please spend enough time learning the basics of python so you really understand what you are doing instead of typing in semi-random things and hoping it might magically work.

I’m actually busy trying to finalize something completely different (which doesn’t go as smoothly as I had hoped ;)) and won’t be able to help you any further with this, at least for quite a while.

hyper canon Sheet music for Piano (Mixed Ensemble) | Musescore.com
I made a canon in C major
Canon in C enigmatic Sheet music for Piano (Solo) | Musescore.com
And one with the enigmatic scale!
The problem with both of them is that the pattern is repeated way longer than necessary.
I had to cut the one in C major as it was so big it took like 4 hours to generate so it repeats one time just to be able to publish it on the site. Is there a way to generate just the necessary part? So I can make a really big canon with many voices. Also a problem, in each canon, the melody just goes up and up but I may want a descending canon or one staying in a certain range, is it possible to choose?


The 13/07 around a month ago, I created this scale without perfect fifths with the tonnetz diagram by using a diminished 7th and a diminished lowered by a half second. Deducing from the tonnetz diagram, this is the only way to have a heptatonic scale like this beside a whole tone scale with an added microtonal note but this one’s way better because it has major thirds instead of major sixths. I mention this because I discovered half microtonal notes are possible in music21! Parallel intervals are a bad thing in polyphony so making a canon without any by default would be really interesting no?