15 March 2021

NIME Music Box



 




My Music box uses a white cardboard box with the Circuit Playground Express located on the top as well as a single potentiometer. The potentiometer is used to control the pitch of the two buttons on the CPE labelled D4 and D4. Audio is played through the speaker on the CPE. Inside the box is a 5v battery connected to a JBtek Breadboard Power Supply Module (3.3V/5V) which is nested in the breadboard. There is also torn pieces of thin paper surrounding and above a Servo motor with arm attachment for the purpose of generating more sound as the Servo's arm turns the snippets of paper. Unfortunately this sound isn't easily heard in the video. 
The rest of the components are wires, alligator clips, and a mix of duct and scotch tape. The idea for the conceptual model was creating a music box similar to Otamatone (オタマトーン) which is an electronic synthesizer with limited sound. This music box, while not as simple as the Otamatone, has a wider range of sounds available and has the inclusion of additional sound provided by the servo arms and paper. The input and output mapping are simple. The user presses one of the two labeled buttons on the CPE and twists the labeled pitch adjustment (the potentiometer). The output is sounds of varying pitches depending on the button pressed and the degree the dial on the potentiometer is turned to. While not captured in the video recording, the words "Sound Buttons" and "[Pitch] Twist, as well as arrows pointing to their respective control methods, serve as readable signifiers to the user. The feedback comes in the form of sound and changing pitch from the speaker.
Question for peer review feedback: Do you think it would have been possible to generate more noise from the paper and servo? I felt that this was the area that could use the most improvement.


// NIME 
// DIG 3602

#include <Servo.h>
#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>
Servo myServo;
int pos = 0;
int inc = 1;
int timer = 0;
int potenNum = 0;
int potenMap = 0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  delay(1000);
  CircuitPlayground.begin();
  myServo.attach(10);
  pinMode(13, OUTPUT);
  pinMode(4, INPUT_PULLDOWN); // sets left button
  pinMode(5, INPUT_PULLDOWN); // sets right button
}
void loop() {
  //put your main code here, to run repeatedly:
  if (millis() > timer + 15) {
    if (pos == 0) inc = 1;
    if (pos == 180) inc = -1;
    myServo.write(pos);
    pos += inc;
    timer = millis();
  }
  potenNum = analogRead(A1);
  Serial.print(potenNum);
  // The position of the potentiometer is mapped to a value to alter the tone
  potenMap = map(potenNum, 0, 1023, 0, 200);
  // Left button pressed play beat 1
  if (digitalRead(4)) {
    left(potenMap);
  }
  // Right Button pressed play beat 2
  if (digitalRead(5)) {
    right(potenMap);
  }
}
// Play tone when left button is pressed
// Custom sound tone based off the position of the potentiometer
void left(int potenMap) {
CircuitPlayground.playTone(700-potenMap,200);
}
// Play tone when right button is pressed
// Custom sound tone based off the position of the potentiometer
void right(int potenMap) {
  CircuitPlayground.playTone(400-potenMap,200);
}

 


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.