Пример #1
0
	def generate_note(self, state):
		n = state["chord"][0]
		n = [n, perfect_fifth(n)]
		n =  NoteContainer(n)
		for i in n:
			i.octave_down()
		return n
Пример #2
0
 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]]
Пример #3
0
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)]
Пример #4
0
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)]
Пример #5
0
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)]
Пример #6
0
def suspended_fourth_triad(note):
    """Build a suspended fourth triad on note.

    Example:
    >>> suspended_fourth_triad('C')
    ['C', 'F', 'G']
    """
    return [note, intervals.perfect_fourth(note), intervals.perfect_fifth(note)]
Пример #7
0
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)]
Пример #8
0
def eleventh(note):
    """Build an eleventh chord on note.

    Example:
    >>> eleventh('C')
    ['C', 'G', 'Bb', 'F']
    """
    return [note, intervals.perfect_fifth(note), intervals.minor_seventh(note),
            intervals.perfect_fourth(note)]
Пример #9
0
 def test_perfect_fifth(self):
     majors = {
         'C': 'G',
         'Cb': 'Gb',
         'Cbb': 'Gbb',
         'C#': 'G#',
         'C##': 'G##',
         'B': 'F#',
         'A': 'E',
         'F#': 'C#',
         'F': 'C',
         'Fb': 'Cb',
     }
     for x in majors.keys():
         self.assertEqual(
             majors[x], intervals.perfect_fifth(x),
             'The perfect fifth of %s is not %s, expecting %s' %
             (x, intervals.perfect_fifth(x), majors[x]))
Пример #10
0
def create_interval_perfect(start_note):
    start = start_note
    options = [
        intervals.perfect_fifth(start),
        intervals.perfect_fourth(start),
        intervals.major_unison(start)
    ]
    end = options[(randint(0, 2))]
    interval = intervals.determine(start, end)
    return interval
Пример #11
0
    def ascending(self):
        tonic = self.tonic
        notes = []
        for i in range(self.octaves * 2):
            notes += [
                reduce_accidentals(note)
                for note in list(Lydian(tonic).ascending()[:4])
            ]  # 4 creates overlap on the fifth
            tonic = intervals.perfect_fifth(tonic)

        if self.octaves == 1:
            return notes
        else:
            return notes[:1 - self.octaves]
Пример #12
0
    def descending(self):
        tonic = self.tonic
        notes = []
        for i in range(self.octaves * 3):
            notes += [
                reduce_accidentals(note)
                for note in list(Lydian(tonic).descending()[:3])
            ]  # 3 = 7 - 4
            tonic = intervals.perfect_fifth(tonic)

        if self.octaves == 1:
            return notes[:-1]
        else:
            return notes[:-1 - self.octaves]
Пример #13
0
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
Пример #14
0
def cycle_of_fifths(start='C', repeats=0):
    preferred_accidentals = {'C#': 'Db', 'G#': 'Ab', 'D#': 'Eb', 'A#': 'Bb'}
    out = []
    repeat_counter = 0
    next_note = start
    while repeat_counter <= repeats:
        out.append(next_note)
        next_note = notes.reduce_accidentals(
            intervals.perfect_fifth(next_note))
        if str(next_note) == start:
            repeat_counter += 1
    return [
        preferred_accidentals[note]
        if note in preferred_accidentals.keys() else note for note in out
    ]
Пример #15
0
	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
Пример #16
0
    '6/9': sixth_ninth,
    '69': sixth_ninth,
    '9': dominant_ninth,
    '7b9': dominant_flat_ninth,
    '7#9': dominant_sharp_ninth,
    'M9': major_ninth,
    'm9': minor_ninth,
    '7#11': lydian_dominant_seventh,
    'm11': minor_eleventh,
    'M13': major_thirteenth,
    'm13': minor_thirteenth,
    '13': dominant_thirteenth,
    '7b5': dominant_flat_five,
    'hendrix': hendrix_chord,
    '7b12': hendrix_chord,
    '5': lambda x: [x, intervals.perfect_fifth(x)]
    }

class TemporalChord(object):
    def __init__(self, name, octave=3, dynamics=None, duration_denominator=4):
        self.name = name
        self.octave = octave
        self.dynamics = dynamics
        self.duration_denominator = duration_denominator
        self.root_note, self.family = chord_note_and_family(name)

    def get_temporal_root(self):
        from mingus.containers.note import TemporalNote
        return TemporalNote(self.root_note, octave=self.octave)

def temporal_note_chord_factory(duration_denominator=None):
Пример #17
0
    'm7': minor_seventh,
    'M7': major_seventh,
    '7': dominant_seventh,
    'dom7': dominant_seventh,
    'm7b5': minor_seventh_flat_five,
    'dim7': diminished_seventh,
    'm/M7': minor_major_seventh,
    'mM7': minor_major_seventh,
    'm6': minor_sixth,
    'M6': major_sixth,
    '6': major_sixth,
    '6/7': dominant_sixth,
    '67': dominant_sixth,
    '6/9': sixth_ninth,
    '69': sixth_ninth,
    '9': dominant_ninth,
    '7b9': dominant_flat_ninth,
    '7#9': dominant_sharp_ninth,
    'M9': major_ninth,
    'm9': minor_ninth,
    '7#11': lydian_dominant_seventh,
    'm11': minor_eleventh,
    'M13': major_thirteenth,
    'm13': minor_thirteenth,
    '13': dominant_thirteenth,
    '7b5': dominant_flat_five,
    'hendrix': hendrix_chord,
    '7b12': hendrix_chord,
    '5': lambda x: [x, intervals.perfect_fifth(x)]
}