The Sound Revolver
Code will be made available soon!
The Sound Revolver (SR) is a table top where differently coloured “nodes” sit. A camera sitting under the table sends off the videostream to a computer which then detects the colours and creates links. There are only two colours involved, yellow and blue, which pair with each other. The yellow nodes have an orbiting circle which plays tones when the circle touches a yellow-blue node link.
This project was partly influenced by the Reactable, a neat surface where you can build a synthesizer by placing different blocks. I got the node idea from playing with Nodebeat, an fun app that uses different nodes to make music.
The program uses the openCV wrappers in openFrameworks (ofxOpenCV). I would have preferred not to use the wrappers but for some reason, openCV itself did not want to play nice.
At the heart of the software is colour detection and it simply creates a mask based on a given hue. Empirical results indicated that a hue range of 25 to 35 was enough to detect “yellow” and a range of 84 to 94 was enough to find “blue” in most lighting conditions.
There is only one class of interest (apart from the testApp class) in SR, the “redNode” class. Originally, I used red coloured nodes to pair with the blue ones before I found out that the yellow ones performed much better. The search for yellow nodes is done in the testApp class. For each yellow node found, a redNode class is instantiated. Each class contains the x,y coordinates of the yellow node, variables for the orbiting circle and searches for nearby blue nodes. Both yellow and blue nodes go through the masking process at testApp but blue contours are made only in the redNode class whereas yellow contours are made in the testApp class.
[OSC + Pd]
MIDI notes are sent to a Puredata patch via OSC and are then converted from MIDI note to frequency which is then passed off to an oscillator/wavetable. The oscillator output also goes through an ADSR envelope and reverb generator.
There isn’t a whole lot for hardware in this project. The tabletop is a 3.5″x2.5″ 1/8″ thick sheet of plexiglass with a sheet of paper on the top to diffuse ambient light. There are also drapes wrapped around the legs to block more stray light that might interfere with the colour detection.
The nodes are fake tea candles found at practically any craft store. I swapped the LEDs with blue and yellow ones and covered candles with PolyMorph to diffuse the LED.
The camera is a Logitech C920 webcam. It’s a pricy little camera featuring autofocus and 1080p resolution. I previously used a cheap Logitech C170 camera which was terrible. The video feed had horrible colour; it was tough to discern between the two colours. The image noise also affected the colour detection. The program would detect nodes which weren’t really there.
No project is ever complete without some debugging. Most “debugging” was actually trying to find suitable hue values for the nodes so that colour detection would work well. I used this handy program to find hue values for the two colours. Changing light conditions didn’t present too much of a problem since the nodes were a (almost) constant source of light. When the batteries in the nodes were low however, the dimmer LED would cause problems for colour detection.
I originally started out using red LEDs but found that the light “spread” throughout the table so much that the program would start to detect red nodes where there weren’t any. The red colour was also much more finicky in changing light than yellow was.
I was actually surprised at how well the project worked overall despite a few hiccups here and there. There are a few caveats however. Adding or removing a node will force the program to re-instantiate redNode classes which can be a nuisance at times. I could also have written the code a bit better as well. Using vectors probably would have been a good tactic in situations like these and I will probably end up doing so in future revisions.
More Ending Notes
The sound revolver will be making an appearance at the Vancouver Mini Maker Faire in June 1 and 2!.
- Miss.T’s grade 3/4 class for taking on the challenge of naming this project.
- Mike N. for helping me build the table.