INNER CODE UNIT · Python
__is_scale_tone
jisungk/deepjazz · grammar.py:16
def __is_scale_tone(chord, note):
# Method: generate all scales that have the chord notes th check if note is
# in names
# Derive major or minor scales (minor if 'other') based on the quality
# of the chord.
scaleType = scale.DorianScale() # i.e. minor pentatonic
if chord.quality == 'major':
scaleType = scale.MajorScale()
# Can change later to deriveAll() for flexibility. If so then use list
# comprehension of form [x for a in b for x in a].
scales = scaleType.derive(chord) # use deriveAll() later for flexibility
allPitches = list(set([pitch for pitch in scales.getPitches()]))
allNoteNames = [i.name for i in allPitches] # octaves don't matter
# Get note name. Return true if in the list of note names.
noteName = note.name
return (noteName in allNoteNames)