Created
January 25, 2015 21:03
-
-
Save bspaulding/74a235f135c87f563f8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function transpose(originalNote, steps) { | |
| var note = new originalNote.constructor(); | |
| note.pitch = originalNote.pitch + steps; | |
| note.velocity = originalNote.velocity; | |
| return note; | |
| } | |
| function octaveUp() { | |
| return true; | |
| } | |
| function octaveDown() { | |
| return true; | |
| } | |
| function HandleMIDI(event) { | |
| event.send(); | |
| event.trace(); | |
| if (event instanceof Note) { | |
| if (octaveUp()) { | |
| var oup = transpose(event, 12); | |
| oup.send(); | |
| oup.trace(); | |
| } | |
| if (octaveDown()) { | |
| var odown = transpose(event, -12); | |
| odown.send(); | |
| odown.trace(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment