def CreateFromToneAndMode(self, tone, modeName): #If needed parse string to tone if type(tone) == str: toneObj = t.Tone() toneObj.CreateFromNumberInTonemap(t.toneMap.index(tone)) tone = toneObj self.baseTone = tone self.tones.append(tone) self.modeName = modeName self.mode = m.Modes[modeName] count = 0 for permutation in self.mode: count = count + permutation newTone = self.baseTone.GetToneAbove(count) if not u.Contains(self.tones, newTone.name): self.tones.append(newTone) #CREATE CHORDS from Harmonity import Chord for tone in self.tones: chord = Chord.Chord() chord.CreateTriadFromToneAndScale(tone, self) self.chords.append(chord)
def GetScalesFittingChords(self, chords): scales = GetAllScales() possibleScales = ScaleList() for scale in scales: append = True for chord in chords: for tone in chord.tones: if not u.Contains(scale.tones, tone.GetName()): append = False if append == True: possibleScales.scales.append(scale) return possibleScales