Skip to content

Instantly share code, notes, and snippets.

@lunandd
Created October 11, 2021 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lunandd/a5a1f2c77dbfb87729fef0a23717bb50 to your computer and use it in GitHub Desktop.
Save lunandd/a5a1f2c77dbfb87729fef0a23717bb50 to your computer and use it in GitHub Desktop.
const E2 = 82.41;
const A2 = 110.00;
const D3 = 146.83;
const G3 = 196.00;
const B3 = 246.94;
const E4 = 329.63;
input.onButtonPressed(Button.A, () => {
midi.playTone(E2, music.beat(BeatFraction.Whole))
})
input.onButtonPressed(Button.B, () => {
midi.playTone(A2, music.beat(BeatFraction.Whole))
})
input.onButtonPressed(Button.AB, () => {
midi.playTone(D3, music.beat(BeatFraction.Whole))
})
input.onPinPressed(TouchPin.P0, () => {
midi.playTone(G3, music.beat(BeatFraction.Whole))
})
input.onPinPressed(TouchPin.P1, () => {
midi.playTone(B3, music.beat(BeatFraction.Whole))
})
input.onPinPressed(TouchPin.P2, () => {
midi.playTone(E4, music.beat(BeatFraction.Whole))
})
midi.useRawSerial()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment