Example #1
0
 def test_convert(self):
     for given_note, expected_pitch in (self.seq):
         n, octave = list(given_note)
         note = Note()
         pitch = note.convert(n, octave)
         self.assertEqual(expected_pitch, pitch)
Example #2
0
""" Test the range of the drives and some other stuff """

TestDrives = MIDIFile(3)

pitchmap = {0: {"lower": 24, "upper": 66}, 1: {"lower": 24, "upper": 67}, 2: {"lower": 24, "upper": 60}}

time = 0
duration = 10
volume = 100  #  Makes no difference to floppy drive

print "Try playing C!"
drive = 0
sequence = ["C1", "C2", "C3", "C4"]
for note in sequence:
    play = Note()
    n, octave = list(note)
    TestDrives.addTrackName(drive, time, "Position %d" % drive)
    channel = drive

    TestDrives.addNote(drive, channel, play.convert(n, octave), time, duration, volume)
    time += duration

print "Trying the lower pitch boundary..."
for drive, pitch in pitchmap.iteritems():
    TestDrives.addTrackName(drive, time, "Position %d" % drive)
    channel = drive

    TestDrives.addNote(drive, channel, pitch["lower"], time, duration, volume)
    time += duration