Using notein and poly to control an arduino
For starters, my flow is as follows:
Ableton Live (any DAW will do) sends MIDI data to Puredata
Puredata uses a [notein] and [poly] to receive MIDI notes
An arduino with Firmata is setup, and a Pduino setup is implemented in the patch
The arduino receives this data to trigger RGB lights
I'm using RGB LEDs, which can achieve Yellow, Cyan, Magenta and White via color mixing. So I can control the pins on the Arudino via PD just fine. If RGB are pins 1,2, and 3, I can create Magenta by turning on pins 1 and 3.
In theory: very cool. My hope it to make an arudino board and accompanying pd patch that I can give to a friend for his live shows. He can program the lights using a MIDI channel on his daw, without having to touch the Arduino or PD.
Problem:
I'm not sure if I'm using [poly] correctly.
For right now, I have 2 LEDs. I will eventually be using 4. Each of these LEDs has 3 inputs. When I setup everthing with one LED, it worked fine. But adding another LED has confused the process somewhat. If I want both LEDs to turn white at the same time, there will be 6 MIDI notes at the same time. So, [poly] should be given a value of 6, correct?
Now when I set [poly 6], and then try to make only one LED go all white (3 MIDI notes), instead of one LED being white and the other being off the values get split somehow. So one LED gets one "on" message, and turns green, while the other gets two "on" messages and turns magenta.
This might be a little hard to read. But I'm trying to get some ideas about how this setup might be able to work the way I'd like. I would prefer to not have 4 separate MIDI tracks for each light. I was considering doing some kind of parsing of MIDI information at [notein] usig [route] and then assigning one light to one chord. ie; C1 is light one, C2 is light two and so on. Each one of these would have it's own [poly] with a value of 3.
I'm not sure if that is going to work, however. I'm going to try to implement it and see if it works the way I'm imagining it.
For those who might not be working with Arudinos, Firmata, Pduino, etc, all I'm doing to enable these "pins" is bang a toggle box. Traditional PD logic should apply.
Open brainstorming is appreciated. Thanks for your help.
http://www.pdpatchrepo.info/hurleur/midi_to_lights_pduino.pd