Exemplo n.º 1
0
    def display_progression(self, nop=None):
        s = []
        pr = self.get_progression(self.progression)
        for ch in progressions.to_chords(pr, self.get_key()):
            c = NoteContainer(ch)
            s.append(c.determine(True)[0])

        self.prog_var.set( '  '.join( s ) )
        self.uniprog_var.set('  '.join( pr ))
Exemplo n.º 2
0
def interval_at_beat(track1, track2, beat, return_int=False):
    pitch1 = pitch_at_given_beat(track1, beat)
    pitch2 = pitch_at_given_beat(track2, beat)

    # Check for pauses
    if pitch1 is None or pitch2 is None:
        return None

    # Return halftone interval if requested
    interval_halftones = Note(pitch1[0]).measure(Note(pitch2[0]))
    if return_int == True:
        return interval_halftones

    # Else return a str
    # Workaround for the fact that the .determine function doesn't return unisons or octaves
    if interval_halftones == 0:
        return 'perfect unison'
    elif interval_halftones % 12 == 0:
        return 'octave'
    else:
        note_pair = NoteContainer([pitch1[0], pitch2[0]])
        return note_pair.determine()[0]