Created
July 23, 2021 14:54
-
-
Save benevpi/7652c0f11c9f898e20217a957148bc59 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
| import time | |
| import board | |
| import busio | |
| import usb_midi | |
| import adafruit_midi | |
| from adafruit_midi.note_on import NoteOn | |
| from adafruit_midi.note_off import NoteOff | |
| import random | |
| USB_MIDI_channel = 1 # pick your USB MIDI out channel here, 1-16 | |
| usb_midi = adafruit_midi.MIDI( | |
| midi_out=usb_midi.ports[1], out_channel=USB_MIDI_channel - 1 | |
| ) | |
| counter = 0 | |
| current_note=10 | |
| while True: | |
| # read all the knob values | |
| counter = counter+1 | |
| if (counter == 100) : | |
| usb_midi.send(NoteOff(current_note, 10)) | |
| current_note = random.randint(0,100) | |
| usb_midi.send(NoteOn(current_note, 10)) | |
| counter = 0 | |
| time.sleep(0.01) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment