Ejemplo n.º 1
0
def move_pitch(note: Pitch, pitch: Pitch) -> Note:
    while abs(note.midi - pitch.midi) > 6:
        dist = note.midi - pitch.midi
        if dist < 0:
            note = note.transpose(12)
        else:
            note = note.transpose(-12)

    return note
Ejemplo n.º 2
0
def freq_to_midi(freq):
    base_pitch = Pitch()
    current_interval = Interval(
        integer_interval_from(freq, base_pitch.frequency))
    return base_pitch.transpose(current_interval).midi
Ejemplo n.º 3
0
 def testLowNotes(self):
     dPitch = Pitch('D2')
     lowC = dPitch.transpose('M-23')
     self.assertEqual(lowC.name, 'C')
     self.assertEqual(lowC.octave, -1)