GithubHelp home page GithubHelp logo

taylortmusic / midi2gpio Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 4.0 94 KB

Use the Pi Zero as a MIDI USB gadget, and pass along note and velocity information to PWM GPIO pins.

Python 100.00%
midi gpio midi2gpio pi raspberry rasberrypi raspberrypizero usbgadget usb gadget

midi2gpio's Introduction

MIDI2GPIO

Using the Pi Zero as a MIDI USB gadget, MIDI2GPIO is a python script that will pass along note and velocity information to the assigned GPIO pins with PWM. Much of the script, and my understanding of even basic python comes from the awesome work by Tobias Wissmueller here: http://www.rampmeupscotty.com/blog/2016/01/24/receiving-midi-on-rpi/

To use this script, I assume you have ssh access over WIFI or a USB ethernet adapter, which will be broken after this process. I highly recommend using a Pi Zero W and using the built in WiFi to issue commands over SSH so we can have access to the USB data port.

How to Setup

  1. Follow gbaman's excellent guide on how to setup the Pi Zero as a USB MIDI gadget. Use process number 2, swapping in 'g_midi' instead of 'g_ether' for the last command: https://gist.github.com/gbaman/50b6cca61dd1c3f88f41

  2. Plug in the device into a computer with a DAW. I've tested this on a Mac with Ableton Live and have no issues seeing the device. Assign MIDI to be sent on Channel 1 to your Pi.

  3. Copy over the script, or run 'nano MIDI2GPIO.py' and paste the script into the text editor, saving with 'CTRL + X', then 'Y and Enter'.

  4. Run the script with 'python MIDI2GPIO.py' and test by sending a middle C to your Pi. If all works well, you should see the note, velocity, and brightness level appear on your screen, as well as output on GPIO pin 21.

Some Notes:

I'm using the GPIO number scheme found here: https://pinout.xyz/resources/raspberry-pi-pinout.png Current values are as follows. Middle C (60) = GPIO 21, D above middle C (62) = GPIO 20, E above middle C (64) = GPIO 16.

You can find out notes and their assigned midi note numbers here: http://cote.cc/w/wp-content/uploads/drupal/blog/logic-midi-note-numbers.png

I've included my pre-built Ableton racks for controlling the default 3 LEDs with incoming audio. Place 'MIDI2GPIO Audio Capture' on the audio channel you would like to use to drive LED's 1-3. Place MIDI2GPIO Control on a new MIDI track with the MIDI output assigned to your Raspberry Pi. You must have MAX for Live Installed due to some modules that capture the peak of an audio signal and send a MIDI note once triggered. This emulates those light up T-Shirts and Hats you find at festivals, fairs, raves, etc.

If you have any questions or ideas to expand this project feel free to reach out to me!

midi2gpio's People

Contributors

taylortmusic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

midi2gpio's Issues

Not an issue, just a question about WS2812B

Hi there! first of all, I would like to thank you for this great project.

I was wondering if you could offer me a little guidance, I'm hoping to use MIDI from Ableton to light up some digital RGB leds. Unfortunately, I'm at a loss as to where I should start modifying your code to do so.

Could you perhaps point me to some example code I could merge with yours, to control WS2812B leds?

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.