Music Machine brief
The Noise
Behind the Curtain
How will use make the noise
From Ambiguity
to Simplicity

I definitely want to start with a sense of ambiguity in the sound, and I’m certain I aim to create something that feels ambiguous. However, with my limited understanding of using the Adafruit HUZZAH32 – ESP32 Feather Board and Arduino, I’m not confident that the project will turn out as successfully as I had hoped.

sensors & parameters
A Rough Kickoff

Well, it turned out to be more difficult than I expected. After several attempts to connect the board, it’s just not working the way I thought it would. I think this is the first time I’ve realized how bad my craft and art skills are. The cardboard is really thick, making it hard to plug the male-to-female connectors through it. I had to use a knife to cut it, but it’s not turning out as I envisioned

Visuals to Match The Music
Simple as Possible…
If You Ignore All the Chaos

Like the tile, I aim to simplify everything with the interface based on what we learned in the last class.

Results
CODE
Arduino
#define BUTTON1 12
#define BUTTON2 13

void setup() {
  // put your setup code here, to run once:
  pinMode(BUTTON1, INPUT);
  pinMode(BUTTON2, INPUT);
  Serial.begin(9600);
}
void loop() {
  // put your main code here, to run repeatedly:
  // Send a value depending on the button being pressed
  if (digitalRead(BUTTON1) > 0) {
    Serial.println("1,");
    delay(200);
  } else if (digitalRead(BUTTON2) > 0) {
    Serial.println("2,");
    delay(200);
  }
}
CODE
Processing
import processing.serial.*;
import processing.sound.*;

SoundFile[] myDrums = new SoundFile[4];
float circleRadius = 60;
float rectWidth = 80;
float rectHeight = 60;
float triangleSize = 60;

int kickShape = 0;
int snareShape = 0;

Serial myPort;

void setup(){
  size(660, 200);

  // Load sound files
  myDrums[0] = new SoundFile(this, "BT7AADA.WAV");  // kick drum
  myDrums[1] = new SoundFile(this, "ST7T3SA.WAV");  // snare drum

  printArray(Serial.list());
  myConnection = new Serial(this, Serial.list()[2], 9600);
  myConnection.bufferUntil('\n');
}

void draw(){
  background(0);

  // Draw shapes based on the current shape state
  drawShape(100, 100, kickShape);   
  drawShape(250, 100, snareShape);  
}

void drawShape(float x, float y, int shapeType){
  if (shapeType == 0) {
    fill(255, 0, 0);
    ellipse(x, y, circleRadius*2, circleRadius*2);
  } 
  else if (shapeType == 1) {
    fill(0, 255, 0);
    rect(x - rectWidth / 2, y - rectHeight / 2, rectWidth, rectHeight);
  } 
  else if (shapeType == 2) {
    fill(0, 0, 255);
    triangle(x - triangleSize / 2, y + triangleSize / 2, x, y - triangleSize / 2, x + triangleSize / 2, y + triangleSize / 2);
  } 
  else if (shapeType == 3) {
    fill(255, 0, 255);
    beginShape();
    vertex(x, y - triangleSize / 2);
    vertex(x - triangleSize / 2, y + triangleSize / 2);
    vertex(x + triangleSize / 2, y + triangleSize / 2);
    endShape(CLOSE);
  }
}

// Read incoming serial data and trigger sounds
void serialEvent(Serial myPort) {
  String inData = myPort.readStringUntil('\n');  
  if (inData != null) {
    inData = trim(inData);  
    if (inData.equals("1,")) {
      myDrums[0].play();  // Play kick drum
      kickShape = (int) random(4);  // Randomize shape for kick drum
    } 
    else if (inData.equals("2,")) {
      myDrums[1].play();  // Play snare drum
      snareShape = (int) random(4);  // Randomize shape for snare drum
    }
  }
}