Understanding scale degres in Scamp

I am trying to understand what the pitch_to_degree function should produce for a given scale. For example:

from scamp import *
from scamp_extensions.pitch import Scale


CScale = [60,62,64,65,67,69,71,72]
scale = Scale.major(60,True)
for note in range(8):
    print("Degree {} Pitch {} ".format(note,scale.degree_to_pitch(note)))
for note in CScale:
    print("pitch {} Degree {} ".format(note,scale.pitch_to_degree(note)))

Produces the following

Degree 0 Pitch 60.0 
Degree 1 Pitch 62.0
Degree 2 Pitch 63.0
Degree 3 Pitch 65.0
Degree 4 Pitch 67.0
Degree 5 Pitch 69.0
Degree 6 Pitch 70.0
Degree 7 Pitch 72.0

pitch 60 Degree 0
pitch 62 Degree 1
pitch 64 Degree 2.5
pitch 65 Degree 3
pitch 67 Degree 4
pitch 69 Degree 5
pitch 71 Degree 6.5
pitch 72 Degree 7

I would have thought that 64 (the note E) was the third degree of the scale as indicated here, but Scamp is indicating that the third degree is 65 which is an (F).
Can someone explain how to interpret the output?

Took me a second to figure out what was going on there!

The issue is the second argument that you’re passing a value of True to (Scale.major(60,True)). Scale.major takes three arguments: the start pitch, a modal shift, and whether or not it’s treated as an infinite, cyclic repeating scale. The modal shift should be an integer, and if you want a traditional major scale, it should be zero. However, you’re passing it a True, which Python is interpreting as the same as the integer 1, which is causing the scale to shift to Dorian. See the documentation:

http://scamp.marcevanstein.com/scamp_extensions.pitch/scamp_extensions.pitch.scale.Scale.html?#scamp_extensions.pitch.scale.Scale.major

Why were you passing True in as the second argument in the first place? Is it somewhere in the documentation?

Thank you for the clarification.

I had used

*class* `scamp_extensions.pitch.scale.` `Scale` (*scale_type: [scamp_extensions.pitch.scale.ScaleType](http://scamp.marcevanstein.com/scamp_extensions.pitch/scamp_extensions.pitch.scale.ScaleType.html#scamp_extensions.pitch.scale.ScaleType)* , *start_pitch: numbers.Real* , *cycle: bool = True* )

so the True was to enable the cycle

But I see the signature I should have used was:

*classmethod* `major` (*start_pitch: numbers.Real* , *modal_shift: int = 0* , *cycle: bool = True* ) → [scamp_extensions.pitch.scale.Scale](http://scamp.marcevanstein.com/scamp_extensions.pitch/scamp_extensions.pitch.scale.Scale.html?highlight=scale%20major#scamp_extensions.pitch.scale.Scale)

So correcting this:

from scamp import *
from scamp_extensions.pitch import Scale


CScale = [60,62,64,65,67,69,71,72]
scale = Scale.major(60,0,True)
for note in range(8):
    print("Degree {} Pitch {} ".format(note,scale.degree_to_pitch(note)))
for note in CScale:
    print("pitch {} Degree {} ".format(note,scale.pitch_to_degree(note)))

gives

Degree 0 Pitch 60.0 
Degree 1 Pitch 62.0 
Degree 2 Pitch 64.0 
Degree 3 Pitch 65.0 
Degree 4 Pitch 67.0 
Degree 5 Pitch 69.0
Degree 6 Pitch 71.0
Degree 7 Pitch 72.0

pitch 60 Degree 0
pitch 62 Degree 1
pitch 64 Degree 2
pitch 65 Degree 3
pitch 67 Degree 4
pitch 69 Degree 5
pitch 71 Degree 6
pitch 72 Degree 7