15 March 2021

NIME Box

 

    The design of this project was based around the idea of creating interesting tones and contrasting them with noises made by some bells moved by the servo. The circuit is activated by a switch and the servo moves back and forth, swinging two bells and hitting them against a ceramic plate. There is a physical switch tied to a light sensor that activates a tone. The user can then use a potentiometer to change the pitch of that tone.

    When mapping the inputs, I took the full range of values of the potentiometer and mapped them onto the range of 440 to 1760. This created a nice range of sounds that the speaker could create, without going too high pitched or too low pitched. I think the interactive elements in this instrument are very noticeable to the user and encourage experimentation. The physical bar that activates the light sensor is only interactable in one way, so the user is only given one option for using it, making it simple to understand. The feedback is instantaneous and clear. You can see that the instrument is active by the movement of the servo and bells. And the tone coming from the speakers and the pitch changing are very responsive.

    Do you think there is too much discord between the sound of the bells and the speaker’s tone?





//Chris Tillis

//Project NIME

//libraries

#include <Servo.h>

#include <Adafruit_CircuitPlayground.h>

#include <Adafruit_Circuit_Playground.h>

#include <math.h>


  //Global Variables (Servo is here)

Servo myServo;

int thresh = 5;

int pos = 0;

int inc = 1;

int pitch;


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);

}

void loop() {


    //Loop only runs while the switch is active

  if(CircuitPlayground.slideSwitch()){


      //The servo moves to its first position

    myServo.write(0);

      //The potentiator is read to get the pitch value. Note is only played under a certain light level

    pitch = map(analogRead(A6), 1, 1023, 440, 1760);

      if(CircuitPlayground.lightSensor()<thresh)

        CircuitPlayground.playTone(pitch, 400);

      else

        delay(800);


      //The servo moves to its second position  

    myServo.write(180);

      //Second potentiator check just to make the notes play in both servo states

    pitch = map(analogRead(A6), 1, 1023, 440, 1760);

      if(CircuitPlayground.lightSensor()<thresh)

        CircuitPlayground.playTone(pitch, 400);

      else

        delay(800);

  }  

}


No comments:

Post a Comment

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