All possible Tuning & Scale combinations

This thread is open for code review, improvements, ideas, or general discussion regarding the nature of the topic.

With classes Tuning & Scale working in tandem with each other, it seems natural that one would search for a way to achieve all possible combinations.

With rudimentary knowledge of how scales and temperaments work in theory, and while browsing the class sources, I noticed the only active restriction for Tuning & Scale combinations is a compatibility check ensuring .pitchesPerOctave for scale matches the .size of it’s tuning argument.

This amounts to a total of one-thousand and ninety-nine possible combinations, using only the core library.

Requests for feedback are mostly aimed towards improving & extending the code, discussion of best practices…or, anything regarding the process or experience of tuning SC.

((
    this.d_

    (
        Dictionary.fill

        (
            Tuning.names.size,

            {
                |index| 

                Tuning.names[index] ->

                Scale.names.select
                {
                    |scale|

                    Tuning.perform
                    (
                        Tuning.names[index]
                    )

                    .size === pitchesPerOctave

                    (
                        Scale.perform(scale)
                    )
                }

                .as(IdentitySet)

                .add(\chromatic)

                .as(SortedList)
            }
        )
    )

    .d

    .pairsDo

    {
        |t s|

        Post << Char.vtab <<< t

        << $\n << $\n <<<* s

        << $\n << $\n
    }

    .flatSize 
    
    .postln 
))

I’m kinda curious what the point of this is - how are you planning to use it?

An older project of mine used a similar function… allowing one to play any score in any scale, or infinitely cycle through all of them.

The purpose is to construct a foundation, where & depending on one’s preferred method, one is able to access everything available to them….directory methods only print to the post window.

1 Like

An updated & more concise version:

Tuning.names.collect
{ 
	|tuning| tuning -> 
	
	Scale.names.select
	{ 
		|scale| tuning.asTuning.size === 
		
		Scale.at(scale).pitchesPerOctave
	} 
	.as(IdentitySet).add('chromatic').as(SortedList)
} 
.asEvent

.asSortedArray.reverse.flatten.pairsDo 
{ 
	|t s| Post << $\n <<< t << $\n << $\n <<* s << $\n << $\n 
}

.asEvent.flatSize

Reverse posted in order to browse scrolling up.

OK, that makes sense - I don’t really work like this, so was intrigued to see what the point of having such an exhaustive list was!

Ah this is great, I’ve tried a couple of times to figure how to extract this sort of thing and failed.