Code Monkey home page Code Monkey logo

thepan's Introduction

The Pan

From pan to a MIDI controller

I was cooking pancakes for dinner on a peaceful evening. It was going well, half of the pancakes were done. Then I tried to flip the next pancake... And suddenly I found the handle of the pan in my hand. Without the pan! Revenge had to be served...

The Pan from below The Pan from above

Hardware

The Pan has 5 potentiometers and 5 rotary encoders (with push buttons) below them, also it has 1 button (alt). The microcontroller is a Wemos D1 R2 board. The rotary encoders and the button are connected to a CD74HC4067 16 channel multiplexer. The multiplexer is read with a digital pin on the microcontroller. The potentiometers are connected to another multiplexer of the same type. It is read by the analog pin on the microcontroller. It still has 11 channels remaining for future upgrades (e.g. some piezo sensors as drum pads). The select pins of the multiplexers are connected to the same digital pins on the microcontroller. The powering and communication of the device is through the micro-USB port of the board.

How does it work?

The code on the microcontroller reads the state of the components on The Pan and sends a message through the Serial Port when a change is detected. A Node.js script reads these messages, gets the necessary data from the microcontroller to determine what is being done on the pan. (e.g. holding down a button, or pressing it shortly). Then it translates these messages to MIDI messages. These messages are then sent through a virtual MIDI port (the port is created using Tobias Erichsens loopMIDI application) The MIDI messages then find their way to my beloved DAW, FL Studio, where a script controls the changing of parameter values. Sadly there is no standardized way of handling infinite rotary encoders, so I had to come up with my own way. A more robust version of the Node.js script has been rewritten in Rust, it is no longer used, but is left here in memorial.

The microcontroller connects to the driver by exchanging two very sophisticated messages:

  • Who are you?
  • I am The Pan.

Then it starts sending the changes of components over the serial port. These message make it possible for the driver to identify The Pan on one of the serial ports. The driver translates the messages from the Pan into MIDI messages. These messages are sent through a virtual MIDI port. It is not possible (or way too hard) to create a virtual MIDI port on Windows (as far as I know), so I use Tobias Erichsen's loopMIDI application as a workaround. This program is automatically started by the driver, or detected if it's already running. The MIDI messsages are then further processed by a Python script to control FL Studio.

thepan's People

Contributors

gb999 avatar

Watchers

 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.