1
2
3 from RawInstreamFile import RawInstreamFile
4 from MidiFileParser import MidiFileParser
5
6
8
9 """
10
11 Parses a midi file, and triggers the midi events on the outStream
12 object.
13
14 Get example data from a minimal midi file, generated with cubase.
15 >>> test_file = 'C:/Documents and Settings/maxm/Desktop/temp/midi/src/midi/tests/midifiles/minimal-cubase-type0.mid'
16
17 Do parsing, and generate events with MidiToText,
18 so we can see what a minimal midi file contains
19 >>> from MidiToText import MidiToText
20 >>> midi_in = MidiInFile(MidiToText(), test_file)
21 >>> midi_in.read()
22 format: 0, nTracks: 1, division: 480
23 ----------------------------------
24 <BLANKLINE>
25 Start - track #0
26 sequence_name: Type 0
27 tempo: 500000
28 time_signature: 4 2 24 8
29 note_on - ch:00, note:48, vel:64 time:0
30 note_off - ch:00, note:48, vel:40 time:480
31 End of track
32 <BLANKLINE>
33 End of file
34
35
36 """
37
42
43
49
50
52 "Sets the data from a plain string"
53 self.raw_in.setData(data)
54