def ascending(self): notes = [self.tonic] notes.append(intervals.minor_third(notes[0])) notes.append(intervals.perfect_fourth(notes[0])) notes.append(intervals.perfect_fifth(notes[0])) notes.append(intervals.minor_seventh(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 hendrix_chord(note): """Build the famous Hendrix chord (7b12). Example: >>> hendrix_chord('C') ['C', 'E', 'G', 'Bb', 'Eb'] """ return dominant_seventh(note) + [intervals.minor_third(note)]
def diminished_triad(note): """Build a diminished triad on note. Example: >>> diminished_triad('C') ['C', 'Eb', 'Gb'] """ return [note, intervals.minor_third(note), intervals.minor_fifth(note)]
def minor_triad(note): """Build a minor triad on note. Example: >>> minor_triad('C') ['C', 'Eb', 'G'] """ return [note, intervals.minor_third(note), intervals.perfect_fifth(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_minor_thirds(self): minors = { 'C': 'Eb', 'Cb': 'Ebb', 'C#': 'E', 'C##': 'E#', 'E': 'G', 'Eb': 'Gb', 'E#': 'G#', 'F': 'Ab', 'Fb': 'Abb', 'F#': 'A', 'B': 'D', 'Bb': 'Db', 'B#': 'D#', } for x in list(minors.keys()): self.assertEqual(minors[x], intervals.minor_third(x), 'The minor third of %s is not %s, expecting %s' % (x, intervals.minor_third(x), minors[x]))
def test_minor_thirds(self): minors = { "C": "Eb", "Cb" : "Ebb", "C#" : "E", "C##" : "E#", "E" : "G", "Eb" : "Gb", "E#" : "G#", "F" : "Ab", "Fb" : "Abb", "F#" : "A", "B" : "D", "Bb" : "Db", "B#" : "D#", } for x in minors.keys(): self.assertEqual(minors[x], intervals.minor_third(x),\ "The minor third of %s is not %s, expecting %s" % (x, intervals.minor_third(x), minors[x]))
def test_minor_thirds(self): minors = { "C": "Eb", "Cb": "Ebb", "C#": "E", "C##": "E#", "E": "G", "Eb": "Gb", "E#": "G#", "F": "Ab", "Fb": "Abb", "F#": "A", "B": "D", "Bb": "Db", "B#": "D#", } for x in minors: self.assertEqual( minors[x], intervals.minor_third(x), "The minor third of %s is not %s, expecting %s" % (x, intervals.minor_third(x), minors[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
''' Created on Jan 6, 2017 @author: stephenkoh ''' import mingus.core.notes as notes import mingus.core.intervals as intervals note = "C" third_b = intervals.minor_third(note) third_b_int = notes.note_to_int(third_b) print("minor third: ", third_b, third_b_int) third = intervals.major_third(note) third_int = notes.note_to_int(third) print("major third: ", third, third_int) fourth_b = intervals.minor_fourth(note) fourth_b_int = notes.note_to_int(fourth_b) print("minor fourth: ", fourth_b, fourth_b_int) fourth = intervals.major_fourth(note) fourth_int = notes.note_to_int(fourth) print("major fourth: ", fourth, fourth_int)