def ascending(self): notes = [self.tonic] notes.append(intervals.major_second(notes[0])) notes.append(intervals.major_third(notes[0])) notes.append(intervals.perfect_fifth(notes[0])) notes.append(intervals.major_sixth(notes[0])) return notes * self.octaves + [notes[0]]
def test_major_sixth(self): majors = { "C": "A", "Cb" : "Ab", "Cbb" : "Abb", "C#" : "A#", "C##" :"A##", "B" : "G#", "A" : "F#", "F#" : "D#", "F" : "D", "Fb" : "Db" } for x in majors.keys(): self.assertEqual(majors[x], intervals.major_sixth(x),\ "The major sixth of %s is not %s, expecting %s" % (x, intervals.major_sixth(x), majors[x]))
def ascending(self): notes = [self.tonic] for i in range(3): notes.extend([intervals.major_second(notes[-1]), intervals.minor_third(notes[-1])]) notes.append(intervals.major_seventh(notes[0])) notes[-2] = intervals.major_sixth(notes[0]) return notes * self.octaves + [notes[0]]
def test_major_sixth(self): majors = { 'C': 'A', 'Cb': 'Ab', 'Cbb': 'Abb', 'C#': 'A#', 'C##': 'A##', 'B': 'G#', 'A': 'F#', 'F#': 'D#', 'F': 'D', 'Fb': 'Db', } for x in list(majors.keys()): self.assertEqual(majors[x], intervals.major_sixth(x), 'The major sixth of %s is not %s, expecting %s' % (x, intervals.major_sixth(x), majors[x]))
def dominant_thirteenth(note): """Build a dominant thirteenth chord on note. Example: >>> dominant_thirteenth('C') ['C', 'E', 'G', 'Bb', 'D', 'A'] """ return dominant_ninth(note) + [intervals.major_sixth(note)]
def major_thirteenth(note): """Build a major thirteenth chord on note. Example: >>> major_thirteenth('C') ['C', 'E', 'G', 'B', 'D', 'A'] """ return major_ninth(note) + [intervals.major_sixth(note)]
def major_sixth(note): """Build a major sixth chord on note. Example: >>> major_sixth('C') ['C', 'E', 'G', 'A'] """ return major_triad(note) + [intervals.major_sixth(note)]
def ascending(self): notes = [self.tonic] for i in range(3): notes.extend( [intervals.major_second(notes[-1]), intervals.minor_third(notes[-1])]) notes.append(intervals.major_seventh(notes[0])) notes[-2] = intervals.major_sixth(notes[0]) return notes * self.octaves + [notes[0]]
def test_major_sixth(self): majors = { "C": "A", "Cb": "Ab", "Cbb": "Abb", "C#": "A#", "C##": "A##", "B": "G#", "A": "F#", "F#": "D#", "F": "D", "Fb": "Db", } for x in majors: self.assertEqual( majors[x], intervals.major_sixth(x), "The major sixth of %s is not %s, expecting %s" % (x, intervals.major_sixth(x), majors[x]), )
def create_interval_consonant(start_note): start = start_note options = [ intervals.perfect_fifth(start), intervals.perfect_fourth(start), intervals.major_unison(start), intervals.major_third(start), intervals.minor_third(start), intervals.major_sixth(start), intervals.minor_sixth(start) ] end = options[(randint(0, len(options) - 1))] interval = intervals.determine(start, end) return interval
def generate_note(self, state): chance = 0.95 n = [Note(state["chord"][0])] if state["tick"] < state["ticks"] / 4 or \ state["tick"] >= state["ticks"] / 2 and\ state["tick"] < state["ticks"] / 4 * 3: n += [Note(perfect_fifth(n[0].name))] else: n += [Note(major_sixth(n[0].name))] n[0].octave_down() n[1].octave_down() if random() < chance: return NoteContainer(n) else: return None