-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending MIDI signals #8
Comments
Yes, that should be quite simple. The page you link shows the hardware part for serial MIDI. The software part is about as follows (not tested). from machine import UART, Pin
from umidiparser import MidiFile
uart = UART( 1, baudrate=31250, tx=Pin(4), rx=Pin(5))
for event in MidiFile("myfile.mid").play():
if event.is_channel():
message = bytearray(1)
message[0] = event.status + event.channel
message.extend( event.data )
uart.write( message ) Here is how this should work:
MIDI over USB seems to be possible with a recent version of MicroPython, but I haven't researched that. If you want your software to do other stuff while playing the MIDI file, use the This code snippet can be optimized for MicroPython by allocating the needed 2-byte and 3-byte bytearreays before the loop. (edit) Please post whatever results. I am very interested if this works, and how you made it work if not. If there is a problem, please post here also, I'll try to help. |
Awesome thanks, this is super helpful! I'm planning to try this out this week and will share the results. |
Hi, cool project! I'm wondering if you could point me in the right direction if I wanted to use this library to play MIDI files and send the MIDI information over USB or to a MIDI output pinout from RPI Pico. For example, this project shows how to send midi signals with the Rpi Pico to a midi pin out. I think it might be straightforward to combine this library with some other midi library to send midi out, but I'm not sure how to do it. Thanks for any tips!
The text was updated successfully, but these errors were encountered: