This is a wearable “glove” with a pressure sensitive sensor to control a sound emitting circuit. The sensor was made with conductive and resistive fabric as well as foam to extend the range of control.
The Bandmachine uses vibrating motors (but can be fitted with other components such as solenoids) that can be put in on or attached to household objects such as boxes, bottles and cans, to transform them into musical instruments. Along with the Arduino device, a Processing visualizer accompanies and follows along with the rhythm of the Bandmachine.
Rhythm controllers: Potentiometers
The only components required are:
int potA = A0;
int potB = A1;
//int potC = A2;
//int potD = A3;
int potAVal = 0;
int potBVal = 0;
//int potCVal = 0;
//int potDVal = 0;int ledA = 13;
int ledB = 12;
//int ledC = 11;
//int ledD = 10;boolean AOn;
boolean BOn;long startTimeA;
long startTimeB;
//long startTimeC;
//long startTimeD;void setup() {
Serial.begin(9600);
// initialize digital pin 13 as an output.
pinMode(ledA, OUTPUT);
pinMode(ledB, OUTPUT);
//pinMode(ledC, OUTPUT);
//pinMode(ledD, OUTPUT);
startTimeA = millis();
startTimeB = millis();
//startTimeC = millis();
//startTimeD = millis();
}// the loop function runs over and over again forever
void loop() {int potAVal = analogRead(potA);
int potBVal = analogRead(potB);
//int potCVal = analogRead(potC);
//int potDVal = analogRead(potD);
Serial.print(potAVal);
Serial.print(“;”);
Serial.print(potBVal);
//Serial.print(“;”);
//Serial.print(potCVal);
//Serial.print(“;”);
//Serial.print(potDVal);
Serial.println(“”);
if (millis() – startTimeA > potAVal) {
AOn = !AOn;
digitalWrite(ledA, AOn);
startTimeA = millis();
}if (millis() – startTimeB > potBVal) {
BOn = !BOn;
digitalWrite(ledB, BOn);
startTimeB = millis();
}
/*
if (millis() – startTimeC > potCVal) {
BOn = !BOn;
digitalWrite(ledC, BOn);
startTimeC = millis();
}if (millis() – startTimeD > potDVal) {
BOn = !BOn;
digitalWrite(ledD, BOn);
startTimeD = millis();
}
*/
delay(45);}
import processing.serial.*;
float vizMinSize = 50;
float vizSize = vizMinSize;int vizMinDet = (int)2;
int vizDet = (int)vizMinDet;int vizMaxFill = 230;
int vizFill = vizMaxFill;float bgMinFill = 0;
float bgFill = bgMinFill;Serial port;
int serialVal;int val0, val1, val2, val3;
int timeVS, timeVD, timeVF, timeBGF;
void setup() {
size(1920, 1080, P3D);
frameRate(25);
println(Serial.list());
port = new Serial(this, “COM4”, 9600);
}public void draw() {
readValues();shapeMode(CENTER);
background(bgFill);
strokeWeight(10);
strokeJoin(ROUND);
strokeCap(ROUND);
stroke(0, 50);
translate(width/2, height/2, 0);
fill(vizFill);
sphereDetail(vizDet);
sphere(vizSize);//decrements
//sphere size
if (vizSize > vizMinSize) {
vizSize = vizSize – 10;
}
//sphere detail
if (vizDet > vizMinDet) {
vizDet–;
delay(65);
}
//sphere color
if (vizFill < vizMaxFill) {
vizFill = vizFill + 5;
}
//background color
if (bgFill > bgMinFill) {
bgFill = bgFill – 5;
}if (val0 >=5) {
if (millis() – timeVS >= val0) { // Increased size
vizSize += 75;
timeVS = millis();
}
}if (val1 >=5) {
if (millis() – timeVD >= val1) { // Increased detail
vizDet += 4;
timeVD = millis();
}
}if (val2 >=5 && vizFill>=0 && vizFill<=255) {
if (millis() – timeVF >= val0) { // Increased sphere color
vizFill -= 25;
timeVF = millis();
}
}if (val3 >=5 && bgFill>=0 && bgFill<=255) {
if (millis() – timeBGF >= val1) { // Increased background color
bgFill += 25;
timeBGF = millis();
}
}
}public void readValues() {
if (port.available() > 0) { // If data is available,
String val = port.readStringUntil(‘\n’); // read it and store it in valif (val != null) {
// Split info (received as ie: 125;255)
println(val);
val = trim(val);
String[] values = val.split(“;”);
println(values.length);
if (values.length == 2) {
println(values[0], “/”, values[1]);//, “/”, values[2], “/”, values[3]);
val0 = Integer.parseInt(values[0]); //sphere size
val1 = Integer.parseInt(values[1]); //sphere detail
//val2 = Integer.parseInt(values[2]); //sphere color
//val3 = Integer.parseInt(values[3]); //background color
}
}
}
}