Play a Note object on a channel with a velocity[0-127]. You can either specify the velocity and channel here as arguments or you can set the Note.velocity and Note.channel attributes, which will take presedence over the function arguments.
(self, note, channel=1, velocity=100)
| 133 | return True |
| 134 | |
| 135 | def play_Note(self, note, channel=1, velocity=100): |
| 136 | """Play a Note object on a channel with a velocity[0-127]. |
| 137 | |
| 138 | You can either specify the velocity and channel here as arguments or |
| 139 | you can set the Note.velocity and Note.channel attributes, which |
| 140 | will take presedence over the function arguments. |
| 141 | """ |
| 142 | if hasattr(note, "velocity"): |
| 143 | velocity = note.velocity |
| 144 | if hasattr(note, "channel"): |
| 145 | channel = note.channel |
| 146 | self.play_event(int(note) + 12, int(channel), int(velocity)) |
| 147 | self.notify_listeners( |
| 148 | self.MSG_PLAY_INT, |
| 149 | { |
| 150 | "channel": int(channel), |
| 151 | "note": int(note) + 12, |
| 152 | "velocity": int(velocity), |
| 153 | }, |
| 154 | ) |
| 155 | self.notify_listeners( |
| 156 | self.MSG_PLAY_NOTE, |
| 157 | {"channel": int(channel), "note": note, "velocity": int(velocity)}, |
| 158 | ) |
| 159 | return True |
| 160 | |
| 161 | def stop_Note(self, note, channel=1): |
| 162 | """Stop a note on a channel. |