Week 10 | Make a musical instrument: “A Whimsical Musical Mixer Box” Assignment

A Whimsical Musical Mixer Box:

In creating this project, our aim was to craft something that deviates from the regular and embraces the weird. I believe that Ghalia and I achieved perfection in capturing this unique and unconventional essence. Our project is inspired by a music box but is aiming to be more funky, weird, and whimsical. The goal is to create a musical box that stands out by having the twirly thingy on the outside instead of the inside. We had multiple ideas initially, but we ultimately settled on this one because we felt a strong desire to bring it to life. While the project was enjoyable, it also presented its challenges, making the process a bit of a struggle.

Structure

We made every effort to enhance our project by incorporating various elements. We integrated a digital light, a servo motor, and an analog sonic sensor. The aluminum on the side serves as a button to control the light and servo, while the sensor plays piano keys based on the distance of the hand. Despite our numerous ideas, implementing them became a challenge, and we faced struggles with the Arduino that led us to adapt our concepts as we encountered difficulties that proved difficult to overcome. An A foil based heart to controll the tone melody.

Initially, I was working with code to play two-tone melody songs controlled by a button. However, as we progressed, I encountered multiple challenges and had to make several changes. I eventually found a code similar to what we were aiming to achieve. Unfortunately, the Arduino posed some inconsistencies – it worked at certain points but failed at others, prompting us to modify and adapt the code.

void loop() {
  unsigned long currentMillisMelody = millis();

  // Play the melody
  if (currentMillisMelody - previousMillisMelody >= noteDuration) {
    previousMillisMelody = currentMillisMelody;

    // Check if there are still notes to play
    if (currentNote < notes) {
      // calculates the duration of each note
      divider = melody[currentNote * 2 + 1];
      if (divider > 0) {
        // regular note, just proceed
        noteDuration = (wholenote) / divider;
      } else if (divider < 0) {
        // dotted notes are represented with negative durations!!
        noteDuration = (wholenote) / abs(divider);
        noteDuration *= 1.5; // increases the duration in half for dotted notes
      }

      // Play the note
      tone(buzzer, melody[currentNote * 2], noteDuration * 0.9);

      // Increment to the next note
      currentNote++;
    } else {
      // All notes played, reset to the beginning
      currentNote = 0;
    }
  }

// Move the servo
// Move the servo from 0 to 360 degrees
  if (currentMillisMelody % 30 == 0) {  // Adjust the value based on your servo speed
    if (pos < 180) {
      pos++;
    } else if (pos < 360) {
      pos++;
    } else {
      pos = 0;
    }
    myservo.write(pos);
  }
}

Reflection

For improvements, I’d like to achieve what we had in mind but couldn’t accomplish in our project. I would also like to reintroduce the button somewhere in our project since we encountered difficulties in that aspect. Additionally, I’m open to suggestions on how to enhance and refine our project further. However, despite the numerous challenges and occasional breakdowns we faced during the process, we take pride in the final outcome. The journey was marked by struggles, but looking back, I can confidently say that the effort was entirely worth it. The end result exceeded our expectations even if our original plan hasnt been achieved, and I genuinely loved how our project turned out, even though it had its share of difficulties. Throughout it all, we managed to have a fun time working together. Now, I need to troubleshoot my Arduino, as it unexpectedly caused issues with my laptop and even caused some lag on my MacBook. It’s a reminder of the unpredictability that comes with the creative endeavors!

Leave a Reply