GMU:My Computer, Max, and I/Kaël Skyhawk Hauptmann: Difference between revisions

From Medien Wiki
No edit summary
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= First Assignment =
== Drum Set ==
I made a simple little drum beat for my first Max patch.
Project
 
[[File:breadboard_final.jpg|400px]]


[[First Max Patch]]
The concept of this project is to create a digital drum set. The idea will be conceived using four major components: an Arduino, Max/MSP, Piezo sensors and drum samples. The scope of this project is scalable depending on the amount of analog inputs in the Arduino, Piezo sensors, and drum samples, but for my project the goal is to create a standard drum set, which is five pieces. By writing the proper code for Arduino and Max/MSP to interpret the data from the sensors, it should be possible to use the values to output the chosen drum samples in Max/MSP when the sensors are struck.


= Main Project =
[[File:drum_kit_5_pieces.mov|400px]]
== Project Idea ==
For my main project I am creating drum set. The drum setup would be to have a kick drum, a snare, a clap, a tom, and a hi-hat. The idea is to install Piezo sensors into different plastic cylinders. When each cylinder is struck it would produce the specific sound that I assigned to that Piezo sensor.


[[File:piezo_kael.jpg|400px]]
== Preliminary Tests  ==
[[File:cylinder_kael.jpg|400px]]
<gallery>
File:piezo_kael.jpg
File:cylinder_kael.jpg
</gallery>


= Preliminary Tests  =
=== Arduino Knock Test ===
== Arduino Knock Test ==
For the beginning test of my project I followed the knock tutorial found on Arduino [https://www.arduino.cc/en/Tutorial/Knock].
For the beginning test of my project I followed the knock tutorial found on Arduino [https://www.arduino.cc/en/Tutorial/Knock].
The hardware setup for the example was simple enough. Unlike the example, I used a breadboard and taped my Piezo sensor to the bottom of a lid from a plastic container. With this test, when I tap on the lid of the container, Arduino would output knock! and the LED light would toggle on/off.
The hardware setup for the example was simple enough. Unlike the example, I used a breadboard and taped my Piezo sensor to the bottom of a lid from a plastic container. I will use plastic containers to house the Piezo sensors. With this test, when I tap on the lid of the container, Arduino would output knock! and the LED light would toggle on/off.


[[File:knock_sensor.jpg|400px]]
<gallery>
[[File:knock_setup.jpg|400px]]
File:knock_sensor.jpg
[[File:knock_output.png|400px]]
File:knock_setup.jpg
[[File:knock_light.jpg|400px]]
File:knock_output.png
File:knock_light.jpg
</gallery>


= Creating First Drum Piece  =
== Creating First Drum Piece  ==
== Setting Up Arduino Hardware ==
=== Setting Up Arduino Hardware ===
This is how I set up my sensor to the Arduino Uno.
This is how I set up my sensor to the Arduino Uno.


[[File:kael_arduino_setup1_1.jpg|400px]]
<gallery>
[[File:kael_arduino_setup1_2.jpg|400px]]
File:kael_arduino_setup1_1.jpg
File:kael_arduino_setup1_2.jpg
</gallery>


== Setting Up Arduino Software to Output Sensor Data ==
=== Setting Up Arduino Software to Output Sensor Data ===
Although the knock test worked, I realized that I need to output the numerical data that the Piezo sensor detects. Here is the coding  and output:
Although the knock test worked, I realized that I need to output the numerical data that the Piezo sensor detects. Here is the coding  and output:


[[File:kael_arduino_piezo.jpg|400px]]
<gallery>
[[File:kael_arduino_output.jpg|400px]]
File:kael_arduino_piezo.jpg
File:kael_arduino_output.jpg  
</gallery>


== Creating Max Patch ==
=== Creating Max Patch ===
For the Max patch, I needed to translate the data read from the sensor into one value. By using the message box, I was able to see the values that were output when I tapped the sensor. I created a range 0 to 300 and have it bang if the value is higher than 300, because the value when tapped is usually higher than 300. The bang triggers the on/off switch for the kick bass drum. I added a 300 millisecond delay to the bang to act as an off button so once the drum is turned on and produces a sound, it will then turn off.
For the Max patch, I needed to translate the data read from the sensor into one value. By using the message box, I was able to see the values that were output when I tapped the sensor. I created a range 0 to 300 and have it bang if the value is higher than 300, because the value when tapped is usually higher than 300. The bang triggers the on/off switch for the kick bass drum. I added a 300 millisecond delay to the bang to act as an off button so once the drum is turned on and produces a sound, it will then turn off.


[[First Drum Kit Patch]]
[[/First Drum Kit Patch]]


[[File:max_1.jpg|400px]]
<gallery>
[[File:max_2.jpg|400px]]
File:max_1.jpg
File:max_2.jpg
</gallery>


= Adding Second Drum Piece  =
== Adding Second Drum Piece  ==
== Setting Up Arduino Hardware ==
=== Setting Up Arduino Hardware ===
Although, my drum piece was working, I found out when attaching the second sensor that my hardware setup was wrong. I had the circuit connect only through the analog input and ground, so I needed to connect to the 5V to create a true circuit. I did that and then I added the second sensor data to Arduino code and cleaned up the code. The only issue that I'm still dealing with is the values given from the sonsors. For some reason, when I add a second sensor to Arduino, one of the sensors always outputs variable data above 0 when it has not been triggered.
Although, my drum piece was working, I found out when attaching the second sensor that my hardware setup was wrong. I had the circuit connect only through the analog input and ground, so I needed to connect to the 5V to create a true circuit. I did that and then I added the second sensor data to Arduino code and cleaned up the code. The only issue that I'm still dealing with is the values given from the sonsors. For some reason, when I add a second sensor to Arduino, one of the sensors always outputs variable data above 0 when it has not been triggered.


[[File:kael_arduino_2_sensor_1.jpeg|400px]]
<gallery>
[[File:kael_arduino_2_sensor_2.jpeg|400px]]
File:kael_arduino_2_sensor_1.jpeg
[[File:arduino_2_kit.png|400px]]
File:kael_arduino_2_sensor_2.jpeg
[[File:arduino_output_2.png|400px]]
File:arduino_2_kit.png
File:arduino_output_2.png
</gallery>


== Adding Second Drum Piece to Max/MSP ==
=== Adding Second Drum Piece to Max/MSP ===
The most difficult part of this was trying to separate the data from each of the sensors. Initially, I tried an unpack, but that was unsuccessful. Luckily, with the help from class, I rewrote the Arduino code, as shown above, and was able to separate the sensors. Once, that was done, it was not difficult to add the next drum piece.
The most difficult part of this was trying to separate the data from each of the sensors. Initially, I tried an unpack, but that was unsuccessful. Luckily, with the help from class, I rewrote the Arduino code, as shown above, and was able to separate the sensors. Once, that was done, it was not difficult to add the next drum piece.


[[File:max_2_drum.png|400px]]
<gallery>
File:max_2_drum.png
</gallery>
 


Here is the coding for Arduino and Max/MSP:
Here is the coding for Arduino and Max/MSP:


[[Arduino 2 Drum Piece]]
[[/Arduino 2 Drum Piece]]


[[Max 2 Drum Piece]]
[[/Max 2 Drum Piece]]


= Adding Third Drum Piece  =
== Adding Third Drum Piece  ==
== Setting Up Arduino Hardware ==
=== Setting Up Arduino Hardware ===
For this step, I just used the same Arduino code as before, but added the extra data for reading the third sensor. I added another analogPin, another val, and another Serial.print. I also added a threshold of 900 to the Arduino code so that the sensor wouldn't bang when I wasn't trying to make it bang.
For this step, I just used the same Arduino code as before, but added the extra data for reading the third sensor. I added another analogPin, another val, and another Serial.print. I also added a threshold of 900 to the Arduino code so that the sensor wouldn't bang when I wasn't trying to make it bang.


[[File:arduino_3_drum_1.png|400px]]
<gallery>
[[File:arduino_3_drum_2.png|400px]]
File:arduino_3_drum_1.png
File:arduino_3_drum_2.png
</gallery>


== Adding Third Drum Piece to Max/MSP ==
=== Adding Third Drum Piece to Max/MSP ===
For this step, I added another element to unpack and then copied everything from below from one of the other drum pieces and connected it to unpack. I changed the drum audio that it would play for the new sensor. I also raised the split to 900, but this may be redundant since I added a threshold to the Arduino code as well.
For this step, I added another element to unpack and then copied everything from below from one of the other drum pieces and connected it to unpack. I changed the drum audio that it would play for the new sensor. I also raised the split to 900, but this may be redundant since I added a threshold to the Arduino code as well.


[[File:max_3_drum.png|400px]]
<gallery>
File:max_3_drum.png
</gallery>




Here is the coding for Arduino and Max/MSP:
Here is the coding for Arduino and Max/MSP:


[[Arduino 3 Drum Piece]]
[[/Arduino 3 Drum Piece]]


[[Max 3 Drum Piece]]
[[/Max 3 Drum Piece]]


= Adding Fourth Drum Piece  =
== Adding Fourth Drum Piece  ==
== Setting Up Arduino Hardware ==
=== Setting Up Arduino Hardware ===
Adding the fourth was the procedure as before. I added in another analogPin, another val, and another Serial.print.
Adding the fourth was the procedure as before. I added in another analogPin, another val, and another Serial.print.


[[File:arduino_4_drum_1.png|400px]]
<gallery>
[[File:arduino_4_drum_2.png|400px]]
File:arduino_4_drum_1.png
[[File:arduino_4_drum_3.png|400px]]
File:arduino_4_drum_2.png
File:arduino_4_drum_3.png
</gallery>


== Adding Fourth Drum Piece to Max/MSP ==
=== Adding Fourth Drum Piece to Max/MSP ===
This time adding the fourth instrument was not the same procedure as before. I realized that the audio files provided by Max/MSP did not have enough drum sounds to complete the 5 pieces that I desired. Because of this I added sound files that I had of different drum pieces. I was able to link them with open and sfplay~. I added live gain to each piece so you can adjust them separately to the appropriate volume.
This time adding the fourth instrument was not the same procedure as before. I realized that the audio files provided by Max/MSP did not have enough drum sounds to complete the 5 pieces that I desired. Because of this I added sound files that I had of different drum pieces. I was able to link them with open and sfplay~. I added live gain to each piece so you can adjust them separately to the appropriate volume.


[[File:max_4_drum.png|400px]]
<gallery>
File:max_4_drum.png
</gallery>




Here is the coding for Arduino and Max/MSP:
Here is the coding for Arduino and Max/MSP:


[[Arduino 4 Drum Piece]]
[[/Arduino 4 Drum Piece]]


[[Max 4 Drum Piece]]
[[/Max 4 Drum Piece]]


= Adding Fifth Drum Piece  =
== Adding Fifth Drum Piece  ==
== Setting Up Arduino Hardware ==
=== Setting Up Arduino Hardware ===
The setup was the same as before. I added in another analogPin, another val, and another Serial.print to accomadate the fifth and final peice.
The setup was the same as before. I added in another analogPin, another val, and another Serial.print to accomadate the fifth and final peice.


[[File:arduino_5_drum_1.png|400px]]
<gallery>
[[File:arduino_5_drum_2.png|400px]]
File:arduino_5_drum_1.png
[[File:arduino_5_drum_3.png|400px]]
File:arduino_5_drum_2.png
[[File:arduino_5_drum_3.png|400px]]
File:arduino_5_drum_3.png
File:arduino_5_drum_3.png
</gallery>
 


== Adding Fifth Drum Piece to Max/MSP ==
=== Adding Fifth Drum Piece to Max/MSP ===
Since I had already setup using my own sound files for the drums when I added the fourth piece, this step was simple enough. Added another element to unpack and then copied the everything below from a another drum piece and connected it to unpack, changed the audio file, and connect it to the output.
Since I had already setup using my own sound files for the drums when I added the fourth piece, this step was simple enough. Added another element to unpack and then copied the everything below from a another drum piece and connected it to unpack, changed the audio file, and connect it to the output.


[[File:max_5_drum.png|400px]]
<gallery>
File:max_5_drum.png
</gallery>




Here is the coding for Arduino and Max/MSP:
Here is the coding for Arduino and Max/MSP:


[[Arduino 5 Drum Piece]]
[[/Arduino 5 Drum Piece]]
 
[[/Max 5 Drum Piece]]
 
== Final Result  ==
 
<gallery>
File: arduino_final.jpg
File:breadboard_final.jpg
File:drum_kit_5_pieces.mov
File:drum_kit_beat.mov
</gallery>


[[Max 5 Drum Piece]]
As you can see, I was able to hook up 5 Piezo sensors to the Arduino by using a breadboard, alligator clips, jumper cables, and 1M resistors.


= Final Result  =


[[File: arduino_final.jpg|400px]]
See [[/Arduino 5 Drum Piece]] and [[/Max 5 Drum Piece]] for final coding.
[[File:breadboard_final.jpg|400px]]  


[[File:drum_kit_5_pieces.mov|400px]]
==Conclusions==
One problem I encountered was that when I hooked up more than one sensor, there would be some noise, some of the sensors would constantly output a low signal when other sensors were struck, but the number is usually very low and I negated it because of the threshold that I put in the Arduino and Max/MSP code. When each sensor is struck it outputs the assigned drum noise, thus successfully creating a digital drum set using Arduino and Max/MSP.


[[File:drum_kit_beat.mov|400px]]
==Future Improvements==
Although I was able to create a digital drum set, it isn't very practical. The way the project is setup, one cannot simply play it like it were a real drum set. Future improvements would be to create better constructed drum heads, which would pick up the vibrations more clearly and would be able to handle being struck by a drum stick.


As you can see, I was able to hook up 5 Piezo sensors to the Arduino by using a breadboard, alligator clips, jumper cables, and 1M resistors. One problem I encountered was that when I hooked up more than one sensor, there would be some noise, some of the sensors would constantly output a low signal when other sensors were struck, but the number is usually very low and negated because of the threshold that I put in the Arduino and Max/MSP code. When each sensor is struck it outputs the assigned drum noise.
== First Assignment ==
I made a simple little drum beat for my first Max patch.


See [[Arduino 5 Drum Piece]] and [[Max 5 Drum Piece]] for final coding.
[[/First Max Patch]]

Latest revision as of 15:05, 3 December 2019

Drum Set

Project

Breadboard final.jpg

The concept of this project is to create a digital drum set. The idea will be conceived using four major components: an Arduino, Max/MSP, Piezo sensors and drum samples. The scope of this project is scalable depending on the amount of analog inputs in the Arduino, Piezo sensors, and drum samples, but for my project the goal is to create a standard drum set, which is five pieces. By writing the proper code for Arduino and Max/MSP to interpret the data from the sensors, it should be possible to use the values to output the chosen drum samples in Max/MSP when the sensors are struck.

Preliminary Tests

Arduino Knock Test

For the beginning test of my project I followed the knock tutorial found on Arduino [1]. The hardware setup for the example was simple enough. Unlike the example, I used a breadboard and taped my Piezo sensor to the bottom of a lid from a plastic container. I will use plastic containers to house the Piezo sensors. With this test, when I tap on the lid of the container, Arduino would output knock! and the LED light would toggle on/off.

Creating First Drum Piece

Setting Up Arduino Hardware

This is how I set up my sensor to the Arduino Uno.

Setting Up Arduino Software to Output Sensor Data

Although the knock test worked, I realized that I need to output the numerical data that the Piezo sensor detects. Here is the coding and output:

Creating Max Patch

For the Max patch, I needed to translate the data read from the sensor into one value. By using the message box, I was able to see the values that were output when I tapped the sensor. I created a range 0 to 300 and have it bang if the value is higher than 300, because the value when tapped is usually higher than 300. The bang triggers the on/off switch for the kick bass drum. I added a 300 millisecond delay to the bang to act as an off button so once the drum is turned on and produces a sound, it will then turn off.

/First Drum Kit Patch

Adding Second Drum Piece

Setting Up Arduino Hardware

Although, my drum piece was working, I found out when attaching the second sensor that my hardware setup was wrong. I had the circuit connect only through the analog input and ground, so I needed to connect to the 5V to create a true circuit. I did that and then I added the second sensor data to Arduino code and cleaned up the code. The only issue that I'm still dealing with is the values given from the sonsors. For some reason, when I add a second sensor to Arduino, one of the sensors always outputs variable data above 0 when it has not been triggered.

Adding Second Drum Piece to Max/MSP

The most difficult part of this was trying to separate the data from each of the sensors. Initially, I tried an unpack, but that was unsuccessful. Luckily, with the help from class, I rewrote the Arduino code, as shown above, and was able to separate the sensors. Once, that was done, it was not difficult to add the next drum piece.


Here is the coding for Arduino and Max/MSP:

/Arduino 2 Drum Piece

/Max 2 Drum Piece

Adding Third Drum Piece

Setting Up Arduino Hardware

For this step, I just used the same Arduino code as before, but added the extra data for reading the third sensor. I added another analogPin, another val, and another Serial.print. I also added a threshold of 900 to the Arduino code so that the sensor wouldn't bang when I wasn't trying to make it bang.

Adding Third Drum Piece to Max/MSP

For this step, I added another element to unpack and then copied everything from below from one of the other drum pieces and connected it to unpack. I changed the drum audio that it would play for the new sensor. I also raised the split to 900, but this may be redundant since I added a threshold to the Arduino code as well.


Here is the coding for Arduino and Max/MSP:

/Arduino 3 Drum Piece

/Max 3 Drum Piece

Adding Fourth Drum Piece

Setting Up Arduino Hardware

Adding the fourth was the procedure as before. I added in another analogPin, another val, and another Serial.print.

Adding Fourth Drum Piece to Max/MSP

This time adding the fourth instrument was not the same procedure as before. I realized that the audio files provided by Max/MSP did not have enough drum sounds to complete the 5 pieces that I desired. Because of this I added sound files that I had of different drum pieces. I was able to link them with open and sfplay~. I added live gain to each piece so you can adjust them separately to the appropriate volume.


Here is the coding for Arduino and Max/MSP:

/Arduino 4 Drum Piece

/Max 4 Drum Piece

Adding Fifth Drum Piece

Setting Up Arduino Hardware

The setup was the same as before. I added in another analogPin, another val, and another Serial.print to accomadate the fifth and final peice.


Adding Fifth Drum Piece to Max/MSP

Since I had already setup using my own sound files for the drums when I added the fourth piece, this step was simple enough. Added another element to unpack and then copied the everything below from a another drum piece and connected it to unpack, changed the audio file, and connect it to the output.


Here is the coding for Arduino and Max/MSP:

/Arduino 5 Drum Piece

/Max 5 Drum Piece

Final Result


As you can see, I was able to hook up 5 Piezo sensors to the Arduino by using a breadboard, alligator clips, jumper cables, and 1M resistors.


See /Arduino 5 Drum Piece and /Max 5 Drum Piece for final coding.

Conclusions

One problem I encountered was that when I hooked up more than one sensor, there would be some noise, some of the sensors would constantly output a low signal when other sensors were struck, but the number is usually very low and I negated it because of the threshold that I put in the Arduino and Max/MSP code. When each sensor is struck it outputs the assigned drum noise, thus successfully creating a digital drum set using Arduino and Max/MSP.

Future Improvements

Although I was able to create a digital drum set, it isn't very practical. The way the project is setup, one cannot simply play it like it were a real drum set. Future improvements would be to create better constructed drum heads, which would pick up the vibrations more clearly and would be able to handle being struck by a drum stick.

First Assignment

I made a simple little drum beat for my first Max patch.

/First Max Patch