/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

  1. from MidiOutStream import MidiOutStream
  2. class MidiOutPassThrough(MidiOutStream):
  3. """
  4. This class i mainly used for testing the event dispatcher. The
  5. methods just returns the passed parameters as a tupple.
  6. """
  7. #####################
  8. ## Midi channel events
  9. def note_on(self, channel, note, velocity, time=None):
  10. return channel, note, velocity, time
  11. def note_off(self, channel, note, velocity, time=None):
  12. return channel, note, velocity, time
  13. def aftertouch(self, channel, note, velocity, time=None):
  14. return channel, note, velocity, time
  15. def continuous_controller(self, channel, controller, value, time=None):
  16. return channel, controller, value, time
  17. def patch_change(self, channel, patch, time=None):
  18. return channel, patch, time
  19. def channel_pressure(self, channel, pressure, time=None):
  20. return channel, pressure, time
  21. #####################
  22. ## defined continuous controller events
  23. # def cc_
  24. #####################
  25. ## Common events
  26. def system_exclusive(self, data, time=None):
  27. return data, time
  28. def song_position_pointer(self, hiPos, loPos, time=None):
  29. return hiPos, loPos, time
  30. def song_select(self, songNumber, time=None):
  31. return songNumber, time
  32. def tuning_request(self, time=None):
  33. return time
  34. #########################
  35. # header does not really belong here. But anyhoo!!!
  36. def header(self, format, nTracks, division):
  37. return format, nTracks, division
  38. def eof(self):
  39. return 'eof'
  40. #####################
  41. ## meta events
  42. def start_of_track(self, n_track=0):
  43. return n_track
  44. def end_of_track(self, n_track=0, time=None):
  45. return n_track, time
  46. def sequence_number(self, hiVal, loVal, time=None):
  47. return hiVal, loVal, time
  48. def text(self, text, time=None):
  49. return text, time
  50. def copyright(self, text, time=None):
  51. return text, time
  52. def sequence_name(self, text, time=None):
  53. return text, time
  54. def instrument_name(self, text, time=None):
  55. return text, time
  56. def lyric(self, text, time=None):
  57. return text, time
  58. def marker(self, text, time=None):
  59. return text, time
  60. def cuepoint(self, text, time=None):
  61. return text, time
  62. def midi_port(self, value, time=None):
  63. return value, time
  64. def tempo(self, value, time=None):
  65. return value, time
  66. def smtp_offset(self, hour, minute, second, frame, framePart, time=None):
  67. return hour, minute, second, frame, framePart, time
  68. def time_signature(self, nn, dd, cc, bb, time=None):
  69. return nn, dd, cc, bb, time
  70. def key_signature(self, sf, mi, time=None):
  71. return sf, mi, time
  72. def sequencer_specific(self, data, time=None):
  73. return data, time
  74. #####################
  75. ## realtime events
  76. def timing_clock(self, time=None):
  77. return time
  78. def song_start(self, time=None):
  79. return time
  80. def song_stop(self, time=None):
  81. return time
  82. def song_continue(self, time=None):
  83. return time
  84. def active_sensing(self, time=None):
  85. return time
  86. def system_reset(self, time=None):
  87. return time
  88. if __name__ == '__main__':
  89. midiOut = MidiOutStream()
  90. midiOut.note_on(0, 63, 127, 0)
  91. midiOut.note_off(0, 63, 127, 384)