Exploring “Modes” of Pitch-Class Sets Using `chord_invert`

Of course, finding all subsets is easy… when you know where to look.

Was focusing on pitch-class sets. Doing a search for “ruby finding subsets in a set” I got there:

And, yes, the .combination method does work.

run_file "/Users/alex/Documents/GitHub/Ruby-PCSet/pcset.rb"
noodl = PCSet.new([0,1,4,5,6,7,10])
noodlsubs = []

for i in 0..(noodl.length) do
    noodlsubs = noodlsubs + noodl.pitches.combination(i).to_a
  end
  
  puts noodlsubs

Of course, I now need to cull the results. And/or categorize them. If multiple combinations are tightly related (like modes of symmetrical scales, say), I pretty much need to know that. There again, Set Theory should come to the rescue. Getting primes for each combination will be helpful, I guess. Then, grouping subsets sharing the same prime… and somehow comparing them.
Once I have a list of unique combinations, I can process each of them as a PCSet and, for instance, output the notes.

Better yet, maybe there’s a way to output a MIDI file with all of them? Unlike the rest of my journey, this is one which is more about SPi itself than about Ruby.
I know I can output MIDI and there might be a command-line option to capture those MIDI messages. Or is there a SPi construct which actually saves this kind of output? That’s one which could have broader appeal.

After that, I’ll probably work with said MIDI file in a DAW. My dream, though, would be to have a way to embed MIDI files in learning material with some way to visualize the content… without staff notation. My thinking has focused on “pianoroll” notation, which would be eminently appropriate in this specific case. (I’d argue that it’d work for an overwhelming proportion of what is labelled “music theory”.)

…then if I can get all of that, I could create some Open Educational Resources based on the musical applications of Set Theory.