Harmonizer 01 — A rule-based harmonizer for SuperCollider (updated)

Previous issue:
The previous path issue has been solved. Thanks again to @semiquaver for the assistance!

About the project:
Harmonizer 01 is a rule-based system that uses backtracking to harmonize a chord progression according to classical harmony rules. Although already functional, it is still under development (on a separate development branch).

The function takes two mandatory arguments:

  • an array of symbols expressing a chord progression
  • an array of durations (same length as the progression)

Optional arguments include:

  • sustain: when set to true, common tones are sustained instead of being repeated across chords
  • direction: defines the motion of the upper voice, and may be "up", "down", or "line"
  • score: exports the generated progression to a music editing program (Finale, Sibelius, MuseScore, etc.) through the Python library music21

The score export was originally designed as a testing tool to assess the quality of generated progressions, but I’m interested in expanding it into a genuine compositional aid, capable of reflecting user-provided durations and sustained notes.

One important area of improvement is efficiency. Backtracking can be computationally heavy, and I’m currently exploring ways to optimize it, including better rule profiling for each chord during parsing.

I’d love to hear feedback from the community: issues you may encounter, ideas for improvements, thoughts on integration with other projects, or simply whether you find it useful.

Thank you all very much!

1 Like

Hi @Siriil and welcome to the forum!

cool project! quick hack: maybe try setting the ~srcDir here:

// Load all project files
(
~srcDir = PathName(thisProcess.nowExecutingPath).pathOnly;
"./src/loadall.scd".loadRelative;
)

you can also work with strings directly:

thisProcess.nowExecutingPath.dirname (this has no trailing /)

1 Like

@semiquaver, awesome! I tried setting the paths in loadall.scd and applied the .pathOnly method, as you suggested. That seemed to do the trick. It now opens MuseSocre at first run, both in my Debian and Windows machines, when score is set to true. I’ve updated the code in the repository.

Thanks you so much!

1 Like

Small bug fix
harmonizeProg was not exporting scores for progressions containing diminished chords (e.g. Cd), since music21 does not recognize 'd' as the diminished symbol. The cipher is now converted to 'Co' before being written to the .txt file, so it can be correctly parsed by the Python script.