My idea is to create a device that interacts with environmental parameters to produce simple tone progressions from the read data /or modify a generative piece of music. Hence, it can be a device that hobbyists, experimental music producers/composers, and people who practice mindfulness meditations could use to various degrees.
The following is the project's soundscape:
1) The chords are determined by "sonifying" the light intensity.
2) The velocity of the notes is determined by Humidity.
3) The ultrasonic distance detunes the notes and controls how distinct they are from each other.
4) The sample period and sample size are user-controlled using knobs.
5) temperature controls the octave of the reading; the lower the temperature, the lower the octave, hence, the darker the sound.
And Manual Buttons allow the user to play with the tones if wanted.
I used Autodesk Fusion360.
I started by estimating the dimensions of my device with the aid of the minimum value prototype we made earlier in the diploma.
The plan was to 3D print the part, so I made the design without any T-Slots or joints. However, after slicing it on Cura, the body part took more than 110 grams, which exceeds the limits of the material we're allowed to use.
So, I started again. But this time with the sketches instead of the 3D approach to things.
After designing the basic building blocks of a simple box, I still wanted to pay homage to vintage cassette players. So, I decided to make a side resemble a cassette case.
And then, I made the 3D printed legs/supports using the extrude tool.
Then, I imported the components I would mount from GrabCad (the ultrasonic sensor, the pushbuttons, the LDR, and the Arduino board). I also imported the small breadboard to make sure it would fit within the enclosure.
After that, I changed the appearance of the enclosure and exported the sketches as DXF files.
First, I sketched the rectagnular front face, then copied it onto another plane and projected the sides onto both of them.
And on one of them, I drew the rectangle that would become the acrylic case.
Then I sketched the top, duplicated it to become the bottom/base, and projected the 3D legs on top of it.
Then, upon my instructor's feedback, I moved the legs further apart to allow the body weight to distribute more evenly between them.
On one of the sides, I mounted the Ultrasonic Sensor and the LDR.
The software I used for fabrication are:
LaserCad to turn my DXF files into PLT files so that the laser cutter can operate them
Ultimaker Cura to slice the STL meshes, modify them for optimum time, and save the g-code for the 3D printer.
CorelDRAW to tweak the design and delete unnecessary lines
My fabrication process consisted of:
Laser cutting the parts
3D printing the parts
Assembling parts together.
post-processing of the parts
And I used these tools and machines:
• Prusa i3 MK3S 3D printer.
• White PLA as my material of choice
• Sand Paper to remove excesses
• Malky Laser Cutter ML 64 to laser cut the design/ the model.
Black spray paint for post-processing
Small breadboard.
Arduino UNO
9 Volts power adaptor.
1 Light Dependent Resistor
2 10k Potentiometers
4 momentary Pushbuttons
DHT11 Temperature and Humidity Sensor
HCSR04 Ultrasonic Sensor Module
10W Stereo Speaker
Jumper wires
User Inputs (2 Potentiometer, 4 Pushbuttons)
Sensors (Ultrasonic Sensor, DHT11 Temperature and Humidity Sensor, Light Dependent Resistor)
10W Speaker
For the pushbuttons, I used a resistor ladder circuit in order to limit the number of analog pins the pushbuttons would normally occupy to be just 1.
As I mentioned before describing the soundscape
1) The chords are determined by "sonifying" the light intensity
2) The velocity of each note is determined by the humidity
3) The ultrasonic distance detunes the notes and controls how much distinct they are from each other
4) The Sample period and sample size are user-controlled using knobs.
5) temperature controls the octave of the reading, the lower the temperature, the lower the octave, hence the darker the sound.
Manual Buttons are also added, allowing the user to play with the tone output if desired.
After checking the datasheets for my component, I found that the operating voltage for them all is within the 5V range, which is why I chose to use the 9v adapter. Which I used to power the Arduino, and powered the rest of the components directly from the Arduino's 5 Volts pinout.
First, I defined the function whirr(), which would produce a whirring sound once the device is on. I put it in setup() because I want it to execute once.
Then, I copied the ultrasonic sensor's function from TinkerCad and used the DHT library to get values from the digital sensors (the ultrasonic sensor and the Humidity and Temperature Sensor).
I started by declaring some arrays that would store the data values obtained from the sensors, or the input components, in a more general sense.
Then, I set param5 and param6, the sample size and sample period, to be initially 10 and 1000. So that 10 seconds after the device is powered, 10 notes sampled at a rate of 1000 milliseconds will play.
That way, the user gets a feel about whether they want to modify it or not.
I decided to use a simple buffer-like process from the millis() function instead of the delay function.
The buffer starts if the time passed is more than or equal to the sample period. After each sample period, it prints the sentence "taking sample number x" and stores the sensors variables into arrays.
Once the list fulls, as dictated by the sample size the user specifies through the knob, it prints the array that was sonified directly: light intensity in this mode.
Then comes the sonification itself
to calculate the note duration, take one second divided by the note type. (e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc)
The temperature change changes the octaves of the tones, making the coldest temperatures the (darkest) sounds.
to distinguish the notes, set a minimum time between them. (here the note's duration minus a detuning parameter dictated by the ultrasonic sensor)
As for the pure data patch, I made it to generate ambient music which is composed of a set of specific chords, and the sensors control different filters.
I started by testing the buttons, since they're on the top side, I mounted them early on, as well as the speaker.
Then, I used the the code on Circuito.io to test whether they are functional or not, then I started integrating the LDR and the Ultrasonic Sensor into the main program, after which I mounted them to their side.
then for the main program, I started testing the code without sensors, using the knobs as the main signal that will be sonified to make it easier for me to troubleshoot and debug the code before the wires get messy with the sensors.
After completing the testing without the full enclosure and verifying that the sounds is as a intended and the code has no bugs, I assembled all the parts together.
Mr. Ahmed Shelbaya the Lab Manager suggested that I declare functions to tidy up the code and make it more presentable. He also suggested that I save different versions separately (Version Control) so that the code won't be lost and changes would be easily tracked by me and other people who would read it in the future.
My peers Eman and Hadeer suggested that I use knobs on the potentiometers for better control and also as an aesthetic choice.
At some initial stage of ideation, I had the idea to control and modulate pre-existing musical samples, so I got an mp3 module but I couldn't operate it so my peer Ahmed Mahfouz helped me with understanding its functions, and it turned out later to be not useful for the application I was going for.
To use an LDR instead of an LDR module, Mr. Ahmed Khaled suggested that I revise voltage divider circuits since this is what the LDR circuit relies on.
Researching: I looked a lot into Sampling methods until I chose the one I used because I found it to be easy to understand and not too complex. And I wanted to use a buffer without resorting to using pointers so I researched codes that did things similar to the things I wanted and understood the idea behind them, and tweaked them to my own goal, as Mr. Ahmed Khaled has advised us on the extra session on the computational skills.
Procedural Debugging: One of the buttons in the resistor ladder, although connected to a 1k ohm resistor only outputed 0, so I used the Avometer and checked the voltage, the current, and the linearity of the jumpers until I figured that one of the jumpers was broken and not the button.
Trial and Error: Using an mp3 Module at first I couldn't power it correctly, I tried different libraries and codes, and it only powered when I placed the jumper on the 3.3v by mistake instead of the 5v pin.
If I had more time i would have achieved the nice to have features, and experimented more with the sound output.
I think working on a more complex soundscape could result in more interesting sounds rather than the simple ones I ended up with, especially since I did the second mode on pure data, which other creators used to develop something more complex like the organelle
Also, I was thinking about levels of abstraction for the user interface. In a way that it could have pure analog sounds that don't necessarily use the Arduino (like Stylophones for example) and then connecting the Arduino would fortify the sound and add more features, and so on with connecting it to the computer or an analog synthesizer.