PageRenderTime 36ms CodeModel.GetById 20ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/src/echonest/support/midi/experimental/MidiOutPassThrough.py

http://echo-nest-remix.googlecode.com/
Python | 182 lines | 74 code | 89 blank | 19 comment | 1 complexity | 52d0ffca404290d27b32208ec4d6723d MD5 | raw file
  1from MidiOutStream import MidiOutStream
  2
  3class MidiOutPassThrough(MidiOutStream):
  4
  5
  6    """
  7
  8    This class i mainly used for testing the event dispatcher. The 
  9    methods just returns the passed parameters as a tupple.
 10
 11    """
 12
 13
 14    #####################
 15    ## Midi channel events
 16
 17
 18    def note_on(self, channel, note, velocity, time=None):
 19        return channel, note, velocity, time
 20
 21
 22    def note_off(self, channel, note, velocity, time=None):
 23        return channel, note, velocity, time
 24
 25
 26    def aftertouch(self, channel, note, velocity, time=None):
 27        return channel, note, velocity, time
 28
 29        
 30    def continuous_controller(self, channel, controller, value, time=None):
 31        return channel, controller, value, time
 32
 33
 34    def patch_change(self, channel, patch, time=None):
 35        return channel, patch, time
 36
 37
 38    def channel_pressure(self, channel, pressure, time=None):
 39        return channel, pressure, time
 40
 41
 42    #####################
 43    ## defined continuous controller events
 44    
 45#    def cc_
 46
 47    #####################
 48    ## Common events
 49
 50    def system_exclusive(self, data, time=None):
 51        return data, time
 52
 53
 54    def song_position_pointer(self, hiPos, loPos, time=None):
 55        return hiPos, loPos, time
 56
 57
 58    def song_select(self, songNumber, time=None):
 59        return songNumber, time
 60
 61
 62    def tuning_request(self, time=None):
 63        return time
 64
 65
 66
 67    #########################
 68    # header does not really belong here. But anyhoo!!!
 69    
 70    def header(self, format, nTracks, division):
 71        return format, nTracks, division
 72
 73
 74    def eof(self):
 75        return 'eof'
 76
 77
 78    #####################
 79    ## meta events
 80
 81    def start_of_track(self, n_track=0):
 82        return n_track
 83
 84
 85    def end_of_track(self, n_track=0, time=None):
 86        return n_track, time
 87
 88
 89    def sequence_number(self, hiVal, loVal, time=None):
 90        return hiVal, loVal, time
 91
 92
 93    def text(self, text, time=None):
 94        return text, time
 95
 96
 97    def copyright(self, text, time=None):
 98        return text, time
 99
100
101    def sequence_name(self, text, time=None):
102        return text, time
103
104
105    def instrument_name(self, text, time=None):
106        return text, time
107
108
109    def lyric(self, text, time=None):
110        return text, time
111
112
113    def marker(self, text, time=None):
114        return text, time
115
116
117    def cuepoint(self, text, time=None):
118        return text, time
119
120
121    def midi_port(self, value, time=None):
122        return value, time
123
124
125    def tempo(self, value, time=None):
126        return value, time
127
128    def smtp_offset(self, hour, minute, second, frame, framePart, time=None):
129        return hour, minute, second, frame, framePart, time
130
131
132    def time_signature(self, nn, dd, cc, bb, time=None):
133        return nn, dd, cc, bb, time
134
135
136    def key_signature(self, sf, mi, time=None):
137        return sf, mi, time
138
139
140    def sequencer_specific(self, data, time=None):
141        return data, time
142
143
144
145
146    #####################
147    ## realtime events
148
149    def timing_clock(self, time=None):
150        return time
151
152
153    def song_start(self, time=None):
154        return time
155
156
157    def song_stop(self, time=None):
158        return time
159
160
161    def song_continue(self, time=None):
162        return time
163
164
165    def active_sensing(self, time=None):
166        return time
167
168
169    def system_reset(self, time=None):
170        return time
171
172
173
174
175
176if __name__ == '__main__':
177
178    midiOut = MidiOutStream()
179    midiOut.note_on(0, 63, 127, 0)
180    midiOut.note_off(0, 63, 127, 384)
181
182