Coder Social home page Coder Social logo

plasmerize's Introduction

plasmerize

Controlling Midi signals with a Tesla coil Plasma Ball - how convenient!

In short, it is a program to:

  • register touches and process via OpenCV (computer vision)
  • correlate and triangulate significant touches
  • generate Midi Signals and send to Midi Through or device

Prerequisites

  • Golang
  • OpenCv
  • RtMidi
  • low-latency kernel (recommended)

Ubuntu install:

sudo apt-get update && sudo apt-get install -y git zynaddsubfx timidity linux-lowlatency qsynth sfarkxtc libglib2.0-dev libportmidi-dev

make sure user is allowed access to usb and audio devices:

sudo usermod -a -G plugdev,audio,dialout <user>

NB If you dont use low latency kernel drivers you'll need to insert some sleep to cam read loop

Golang and OpenCV

Go 1.13.1

wget https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xvf go1.13.1.linux-amd64.tar.gz
echo -n "PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc

OpenCV (Computer Vision)

go get -u -d gocv.io/x/gocv
cd $GOPATH/src/gocv.io/x/gocv
make install

RtMidi (Real-Time Midi)

go get -u gitlab.com/gomidi/midi
go get -u gitlab.com/gomidi/midi/reader
go get -u gitlab.com/gomidi/midi/writer
go get -u gitlab.com/gomidi/rtmididrv
#go get -u gitlab.com/bensinober/rtmididrv

Documentation

run with a usb cam on usb port 0 and midi out on device 0, channel 1, and separate dmx out on device 0, channel 2 go run plasma.go -cam=0 -mid=0 -dmx=0

run some test notes go run plasma.go -test

Start zynaddsubfx with a sample sound for real time midi instrument

zynaddsubfx -a -L /usr/share/zynaddsubfx/banks/Arpeggios/0001-Arpeggio1.xiz

Optionally start virtual midi device

sudo modprobe snd-virmidi

Connect midi ports with aconnect

aconnect 24:0 129:0

How does it work?

The webcam sends still images to process with openCV, which converts, saturizes and lowers to hue image.

The hue image is then filtered so a small range of intense pink/red pixels (=touches) are binarized to white.

Countours are registered and trigonometry used to calculate angels and distance from centre of ball.

The various touches are then transformed to midi signals and sent raw to any device given.

Also a subset of angles (360 / 4) are sent to another channel for use by DMX, along with velocity.

plasmerize's People

Contributors

bensinober avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.