Understanding Degrees of Literals help document

Hi, I am having trouble understanding the following:
https://doc.sccode.org/Reference/Literals.html#Scale%20Degrees

I’m very embarrassed to be reading this now, but I pluck up the courage to ask:

  1. What scale or mode is it based on between major, minor, Dorian, Phrygian, Lydian, Mixolydian, Locrian etc?

  2. The double-sharpened C in the C major scale is D.
    Then 1ss should be also equal to 2.
    But sclang returns true only to 1ss == 1.2.
    I agree 1ss == 1.2 according to the logic of the help document … but…

Is there a detailed explanation that I can understand in full context?

have a look at this method for SimpleNumber:

	degreeToKey { |scale, stepsPerOctave = 12|
		var scaleDegree = this.round.asInteger;
		var accidental = (this - scaleDegree) * 10.0;
		^scale.performDegreeToKey(scaleDegree, stepsPerOctave, accidental)
	}

here the fractional part of the number is multiplied by ten and is passed to performDegreeToKey as the accidental argument.

so 1.2 will call performDegreeToKey with scale degree 1 and accidental 2

now performDegreeToKey method of Scale is:

	performDegreeToKey { | scaleDegree, stepsPerOctave, accidental = 0 |
		var baseKey;
		stepsPerOctave = stepsPerOctave ? tuning.stepsPerOctave;
		baseKey = (stepsPerOctave * (scaleDegree div: this.size)) + this.wrapAt(scaleDegree);
		^if(accidental == 0) { baseKey } { baseKey + (accidental * (12.0 / stepsPerOctave )) }
	}

so here you see that the way that this is applied depends on the Scale’s stepsPerOctave

this could be improved perhaps…

1 Like

Thank you so much! I hope I can find a solution and do a PR! I need some time to think about it.