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 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 dominant_ninth(note): """Build a dominant ninth chord on note. Example: >>> dominant_ninth('C') ['C', 'E', 'G', 'Bb', 'D'] """ return dominant_seventh(note) + [intervals.major_second(note)]
def major_ninth(note): """Build a major ninth chord on note. Example: >>> major_ninth('C') ['C', 'E', 'G', 'B', 'D'] """ return major_seventh(note) + [intervals.major_second(note)]
def sixth_ninth(note): """Build the sixth/ninth chord on note. Example: >>> sixth_ninth('C') ['C', 'E', 'G', 'A', 'D'] """ return major_sixth(note) + [intervals.major_second(note)]
def suspended_second_triad(note): """Build a suspended second triad on note. Example: >>> suspended_second_triad('C') ['C', 'D', 'G'] """ return [note, intervals.major_second(note), intervals.perfect_fifth(note)]
def ascending(self): notes = [self.tonic] for n in range(1, 7): if n in self.semitones: notes.append(intervals.minor_second(notes[-1])) else: notes.append(intervals.major_second(notes[-1])) return notes * self.octaves + [notes[0]]
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 dominant_sharp_ninth(note): """Build a dominant sharp ninth chord on note. Example: >>> dominant_ninth('C') ['C', 'E', 'G', 'Bb', 'D#'] """ res = dominant_ninth(note) res[4] = notes.augment(intervals.major_second(note)) return res
def test_major_seconds(self): majors = { "C" : "D", "C#" : "D#", "Cb" : "Db", "D" : "E", "Db" : "Eb", "Eb" : "F", "E" : "F#", "E#" : "F##", "A" : "B", "Ab" : "Bb", "A#" : "B#", "Bb" : "C", "B" : "C#", "B#" : "C##", } for x in majors.keys(): self.assertEqual(majors[x], intervals.major_second(x),\ "The major second of %s is not %s, expecting %s" % (x, intervals.major_second(x), majors[x]))
def test_major_seconds(self): majors = { 'C': 'D', 'C#': 'D#', 'Cb': 'Db', 'D': 'E', 'Db': 'Eb', 'Eb': 'F', 'E': 'F#', 'E#': 'F##', 'A': 'B', 'Ab': 'Bb', 'A#': 'B#', 'Bb': 'C', 'B': 'C#', 'B#': 'C##', } for x in list(majors.keys()): self.assertEqual(majors[x], intervals.major_second(x), 'The major second of %s is not %s, expecting %s' % (x, intervals.major_second(x), majors[x]))
def create_interval_dissonant(start_note): start = start_note options = [ intervals.minor_second(start), intervals.major_second(start), intervals.minor_fifth(start), intervals.minor_seventh(start), intervals.major_seventh(start) ] end = options[(randint(0, len(options) - 1))] interval = intervals.determine(start, end) return interval
def test_major_seconds(self): majors = { "C": "D", "C#": "D#", "Cb": "Db", "D": "E", "Db": "Eb", "Eb": "F", "E": "F#", "E#": "F##", "A": "B", "Ab": "Bb", "A#": "B#", "Bb": "C", "B": "C#", "B#": "C##", } for x in majors: self.assertEqual( majors[x], intervals.major_second(x), "The major second of %s is not %s, expecting %s" % (x, intervals.major_second(x), majors[x]), )
def ascending(self): notes = [self.tonic] for note in range(5): notes.append(intervals.major_second(notes[-1])) return notes * self.octaves + [notes[0]]