Giter VIP home page Giter VIP logo

midipedalbox's Introduction

MIDIPedalBox

Trinket M0 + CircuitPython USB MIDI Pedal Box

Wiring

The wiring is pretty straight-forward. A single wire goes from each button to pins 1,2,3,4 and a common ground connecting everybody.

Parts

The parts used for MIDIPedalBox:

  • 1 - Adafruit Trinket M0

  • 4 - effects pedal switches

    • I chose these generic momentary ones, but there are many to choose from and most all will work. Be sure to check dimensions to be sure!

or if you want push buttons instead of foot switches,

If you want to add serial MIDI out, the CAD includes a hole for a panel mount MIDI jack, like this one

(Note: all Amazon links are affiliate links)

midipedalbox's People

Contributors

todbot avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

midipedalbox's Issues

softreboot with pedalbox_keyboard.py

I logged an issue at adafruit/Adafruit_CircuitPython_Debouncer#21 but wondering if you are seeing the same issue? I modified your code for debug and saw the same soft reboot I reported above after X loops with no button input.

I can remove the LED code with no change in output.

import time
import board
from digitalio import DigitalInOut, Direction, Pull
# import digitalio #adafruit version
# from analogio import AnalogOut, AnalogIn  #why do we need it?

import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_debouncer import Debouncer

print("imports ok")

# Your config!
# Set this to be which pins you're using, and what to do.
# For list of keycodes, see:
# https://circuitpython.readthedocs.io/projects/hid/en/latest/api.html
button_config = [
        # pin,     (Keycodes and modifier keycodes)
        [board.A1, (Keycode.SPACEBAR,) ],  # just a space
]
debouncers = []

#        [board.D2, (Keycode.A, Keycode.SHIFT, Keycode.GUI) ],# zoom mute
#        [board.D3, (Keycode.C, Keycode.CONTROL) ],
#        [board.D4, (Keycode.H, Keycode.GUI) ], # CMD-H hide

# start up the keyboardy-ness
time.sleep(1)  # Sleep for a bit to avoid a race condition on some systems
kbd = Keyboard(usb_hid.devices)

print("keyboard init ok")

# Built in red LED
led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT
button_light = DigitalInOut(board.D7)
button_light.direction = Direction.OUTPUT

print("LED setup ok")

# set up the pins and the debouncer on each pin
for (pin,*rest) in button_config:
        button = DigitalInOut(pin)
        button.direction = Direction.INPUT
        button.pull = Pull.UP
        debouncers.append( Debouncer(button) )

print("ready for main loop")

######################### MAIN LOOP ##############################
def main():
    while True:
        for i in range(len(button_config)):
            button = debouncers[i]
            button.update()

            (pin,keycodes) = button_config[i]
            print("button",i,"ready")
            if button.fell:
                print("push:",pin,"keycodes:",keycodes)
                #kbd.send(Keycode.SHIFT,Keycode.A)
                kbd.press(*keycodes)
                led.value = True
                button_light.value = True

            if button.rose:
                print("release:",pin)
                kbd.release(*keycodes)
                led.value = False
                button_light.value = False

            time.sleep(0.01)
######

# actually call main
main()

Sending MMC (Play/Stop/etc) messages

Nice little project, you certainly can't get cheaper than a Trinket! Is it possible to configure the Trinket to send Midi MMC messages for Play/Stop/Rec/Overdub?

I see some configuration here, but not sure what to change.
https://github.com/todbot/MIDIPedalBox/blob/master/code/pedalbox.py#L25

Also (as a bonus) is it possible/easy to make presses modal - for example a long press on 'Stop' would be a 'Stop + Rewind' (rather than 'Pause') and the next 'Play' be 'Play' (rather than 'Continue').

All of these would be super useful in controlling the Akai MPC's, and you might have a market if you intend selling these things.

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.