Andrew Jankowski
Created November 11, 2020 © GPL3+

The Mechanic Orchestra

This is an object that creates different sounds based on what metal piece you touch.

Beginner24 hours12
The Mechanic Orchestra

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
Alligator Clips
Alligator Clips
×9
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Tape, Electrical
Tape, Electrical
Tape, Velcro® Stick On Tape/Strip
Tape, Velcro® Stick On Tape/Strip
Tape, Duct
Tape, Duct
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires

Story

Read more

Schematics

Mechanic Orchestra Schematics

Its an alternative audial experience. User will touch one of the many metal objects on the top of the box. Each one will make a certain metal sound, usually a different tone or pitch, via sound files being played through the cpx. The pedometer changes the volume of the sounds as a whole.

Code

Mechanic Orchestra Code

JavaScript
This code allows for the dial to change the volume from high to low/no existent when it comes to sound the cpx makes. The other bits of code allow for touch function to play a audio cue/note. Each metal object that is attached to a pin/node, can make a different music node to create a makeshift instrument. There are only 7 pins that have touch functionality. Looked at music tutorial from adafruit for reference and some makecode examples.
music.setVolume(255)
if (pins.A0.digitalRead()) {
    if (true) {
        music.setVolume(255 - 10)
    } else {
        music.setVolume(255)
    }
}
forever(function () {
    if (input.pinA1.isPressed()) {
        music.playTone(147, music.beat(BeatFraction.Half))
        pause(100)
        light.clear()
    } else {
        light.clear()
    }
})
forever(function () {
    if (input.pinA2.isPressed()) {
        music.playTone(880, music.beat(BeatFraction.Half))
        pause(100)
        light.clear()
    } else {
        light.clear()
    }
})
forever(function () {
    if (input.pinA3.isPressed()) {
        music.playTone(311, music.beat(BeatFraction.Half))
        pause(100)
        light.clear()
    } else {
        light.clear()
    }
})
forever(function () {
    if (input.pinA4.isPressed()) {
        music.playTone(175, music.beat(BeatFraction.Half))
        pause(100)
        light.clear()
    } else {
        light.clear()
    }
})
forever(function () {
    if (input.pinA5.isPressed()) {
        music.playTone(494, music.beat(BeatFraction.Half))
        pause(100)
        light.clear()
    } else {
        light.clear()
    }
})
forever(function () {
    if (input.pinA6.isPressed()) {
        music.playTone(220, music.beat(BeatFraction.Half))
        pause(100)
        light.clear()
    } else {
        light.clear()
    }
})
forever(function () {
    if (input.pinA7.isPressed()) {
        music.playTone(523, music.beat(BeatFraction.Half))
        pause(100)
        light.clear()
    } else {
        light.clear()
    }
})

Credits

Andrew Jankowski
4 projects • 0 followers

Comments