def rhythm_4_40_left(self, chord: Chord) -> [Chord]:
        first_note = Chord([chord.first_note.octave_shift(-1)])
        left_hand_seq = []
        silence = Chords.silence

        left_hand_seq.append(first_note.stretch_dur(4 / self.subdivided))
        left_hand_seq.append(silence.stretch_dur(4 / self.subdivided))
        left_hand_seq.append(silence.stretch_dur(4 / self.subdivided))
        left_hand_seq.append(silence.stretch_dur(4 / self.subdivided))
        left_hand_seq.append(silence.stretch_dur(4 / self.subdivided))
        left_hand_seq.append(first_note.stretch_dur(4 / self.subdivided))
        left_hand_seq.append(silence.stretch_dur(4 / self.subdivided))
        left_hand_seq.append(silence.stretch_dur(4 / self.subdivided))

        return left_hand_seq
 def rhythm_constant_chord_left(self, chord: Chord) -> [NoteSeq]:
     first_note = chord.first_note.stretch_dur(32 / self.subdivided)
     rhythm = [
         Chord([first_note.octave_shift(-1)] +
               [first_note.octave_shift(-2)])
     ]
     return rhythm
Beispiel #3
0
def blend_chords(pc1, pc2):

    spec1 = get_chord_spec(pc1)
    spec2 = get_chord_spec(pc2)

    generic_space = set.intersection(spec1, spec2)

    path1 = get_generalization_path(spec1, generic_space)
    path2 = get_generalization_path(spec2, generic_space)

    solutions = []

    for i, _ in enumerate(path1):
        for j, _ in enumerate(path2):

            colimit = set.union(generalized(spec1, path1, i),
                                generalized(spec2, path2, j))

            deduced = Chord.classify_uniquely(
                pitch_class(axiom) for axiom in colimit
                if type(axiom) is AbsNote)

            blendoid = {
                *deduced, *(pitch_class(axiom + deduced.root)
                            for axiom in colimit if type(axiom) is RelNote)
            }

            if check_for_consistency(blendoid):
                # TODO: account for deviations from priority ordering
                cost = max(i, j)**2 + min(i, j)
                solutions.append((blendoid, cost))

    return min(solutions, key=itemgetter(1))[0]
    def rhythm_16th_note_subdivided_right(self, chord: Chord) -> [NoteSeq]:
        # works best with subdivided = 20
        chord = chord.stretch_dur(2 / self.subdivided)
        l1 = [NoteSeq([chord[0]])] + [NoteSeq([chord[1]])]
        l2 = [NoteSeq([chord[2]])] + [NoteSeq([chord[1]])]

        rhythm = []
        for i in range(0, 4):
            rhythm += l1 + l2

        return rhythm
    def rhythm_heart_and_soul_left(self, chord: Chord) -> [NoteSeq]:
        first_note = Chord([chord.first_note.octave_shift(-1)])
        left_hand_seq = []

        left_hand_seq.append(first_note.stretch_dur(4 / self.subdivided))
        left_hand_seq.append(first_note.stretch_dur(12 / self.subdivided))
        left_hand_seq.append(first_note.stretch_dur(4 / self.subdivided))
        left_hand_seq.append(first_note.stretch_dur(12 / self.subdivided))
        return left_hand_seq
Beispiel #6
0
 def triads(self):
     return [Chord.from_notes(root, [root, self[i+2], self[i+4]]) for i, root in enumerate(self.notes)]
Beispiel #7
0
from notes import Note
from chords import Chord
from scales import Scale

from intervals import __all__
from intervals import *
_g = globals()
for key in Note.keys:
    key_name = key.replace('#', 's')
    _g[key_name] = Note(key)
    __all__.append(key_name)
    for colour in Chord.colours:
        chord_name = key_name + colour.title()
        _g[chord_name] = Chord.from_colour(Note(key), colour)
        __all__.append(chord_name)
    for colour in Scale.colours:
        scale_name = '{}_{}'.format(key_name, colour)
        _g[scale_name] = Scale(key, colour)
        __all__.append(scale_name)
 def rhythm_8th_note_subdivided_right(self, chord: Chord) -> [NoteSeq]:
     rhythm = []
     for i in range(0, 4):
         rhythm += [chord.top().stretch_dur(4 / self.subdivided)
                    ] + [chord.bottom().stretch_dur(4 / self.subdivided)]
     return rhythm
Beispiel #9
0
def get_chord_spec(notes):
    chord = Chord.classify_uniquely(notes)
    return {
        *map(AbsNote, chord),
        *map(RelNote, relative_intervals(chord, chord.root))
    }