GithubHelp home page GithubHelp logo

smerrony / midibanger Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 1.36 MB

A Raspberry Pico MIDI player that plays physical (toy) instruments via servos.

License: BSD 3-Clause "New" or "Revised" License

CMake 13.85% C 86.15%
midi midi-player music pico pico-sdk raspberry-pi-pico rp2040 rp2040-zero

midibanger's Introduction

MidiBanger

A Raspberry Pico* MIDI device that plays physical (toy) instruments via servos.

MidiBanger supports both percussive (mallet-type) and pressed (key-type) instruments.

  • Pan-and-tilt mode using just two servos to play reachable notes
  • Servo-per-note mode
  • Solenoid-per-note mode (soon)

The current version supports up to 16 directly-connected servos, later versions may support I2C servo controllers allowing hundreds of servos to be used.

*Tested on Raspberry Pi Pico, Raspberry Pi Pico W, and Waveshare RP2040-Zero.

Pan-and-tilt version playing Janod toy glockenspiel

Hardware Requirements

  • Raspberry Pico or compatible such as RP2040-Zero
  • Servo per note eg. SG90 9g Micro Servo, or a pair if using pan-and-tilt
  • Optional - Micro speaker - handy for debugging and setup
  • Optional - 5V PSU for servos, if you think you need it
  • Some 3D-printed parts to hold servos etc.

Some sample 3D parts are included in the 3D directory, there are FreeCAD designs and .3mf files for slicing.

Configuration

See the comments in src/config.h for details.

To avoid masses of commented-out congfiguration I have put the configuration that is specific to a particular physical instrument in a separate file which is then #included in the main config.h. Example configurations are chicco_toy_glock_config.h and janod_toy_glock_config.h.

For the servo-per-note mode, the critical configuration item is the NOTEPIN_INITIALISER. Leave its first line alone, then replace the contents with a maximum of sixteen [MIDI note number] = GPIO_PIN pairs.

For the two-servo pan-and-tilt mode it's the NOTE_PAN_INITIALISER that you will need to adjust to set the angles for each note. This will be a trial-and-error process, I suggest you start by installing the servos so that their centres of movement roughly point to the middle of the instrument and then do a first run WITHOUT the hammer attached.

If you are connecting up several MidiBangers I suggest you use a different string or number for each one at the end of the USB_PRODUCT string. It will make your life a lot simpler!

Building

Don't forget to set PICO_BOARD to match your target microcontroller in CMakeLists.txt, then...

mkdir build
cd build
cmake ..
make

Hints

Pan-and-Tilt Players

  • Try a metal-geared servo for the panning action, these seem to have less play than the plastic-geared equivalent.
  • For greater accuracy playing large intervals (leaps) you can try setting the angles for the lowest and highest notes just a little towards the centre, this will compensate for some overshoot.

midibanger's People

Contributors

smerrony avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.