Lab #4 – Due Monday 10/24
Goal: Get 10 bit data from your sensors. Create audio patches in Max that make some interesting sounds. Make those patches pretty.
Goals Expanded: This lab is a bit funny beacuse we are going to implement things that we have not specificlly talked about in class but that we have alluded to. We are going to “resurrect” the 3 bits that we lost when we bit shifted down to 7 bits in the previous lab. This will need to be implemented in BOTH Arduino and Max. Take a look at the code suggested and see if you understand it. We are here to help with any questions.
The other goal is to make sure that you understand all of the pieces that go into our tool chain. At this point, we have essentially taught you everything you need to learn to make music controllers, from a purely technological perspective. This is the lab where we should root out any lingering confusion or misunderstanding.
We will also be adding some tools for making your patches more manageable and visually pleasing.
Finally, we will explore making some interesting sounds – either using some of the audio effects that we discussed in class on Wednesday 10/12 or beginning to explore some audio synthesis.
1) Connect an accelerometer to your arduino.
2) Implement MSB and LSB in Arduino and Max to get a 10 bit number for your accelerometer data. Example code for this implementation can be found in the zip file that you downloaded for Lab 2.
3) Create a sub patch for the serial and bit addition in the same manner that you created a sub patch in Lab3
4) Read up on two tools for making your patches a bit cleaner and implement those in item 6.
a) Use segmented patch cords by choosing Options->Segment patch cords
b) Color code your patch using the object called panel.
5) Notice that your accelerometer data usually vacillates between about 320 and 350. Read up on the scale object and think about how you can use the variation that you are getting from your sensor to effect a useful range of numbers. Next, read up on the line object to learn about how you can smooth the data to avoid clipping.
6) Use your 10 bit values to create something that sounds good to you. You have 2 options for making interesting sounds:
a) Audio Effects: Revisit some of the objects that we described in class on 10/12. You will need to use a soundfile player in Max. The best way to do this is to look at something like biquad~ and copy the objects that play the sound file. Modulate that file using objects such as rev3~, delay~, biquad~, overdrive~, pitchshift~.
b) Synthesis: We have not discussed this in detail yet but here are some guidelines:
For a starting point, check out: File Browser -> Cycling 74 -> Tutorials -> MSP Tutorials. Search for Synthesis Tutorial 5: Frequency Modulation and Synthesis Tutorial 4: Vibrato and FM if you are using FM synthesis and Polyphony Tutorial 2: Granular Synthesis if you are using granular synthesis.
6) Make a patch that works in Presentation Mode. For a starting point, check out: File Browser -> Cycling 74 -> Tutorials -> Max Tutorials. Search for Tutorial 20: Presentation Mode
Lab #3 – Due Monday 10/17
Goal: Solder an accelerometer. Attach it to your board. Create an arduino patch to read the accelerometer data. Create 3 Max/MSP patches that use that data. Explore a couple of tools for keeping your patches clean and orderly. Explore some basic sound generation and filtering in Max.
- Watch this tutorial even if you think you know how to solder. https://vimeo.com/51538354
- Solder the leads for the accelerometer.
- Connect the accelerometer to your board.
- Connect the x, y and z pins of the accelerometer to to Analog 0, 1, and 2.
b. Connect the V+ pin to the 3.3v on the arduino
c. Connect the ground pin of the accelerometer to a ground pin on the arduino.
- Make an arduino patch that will take in the accelerometer data and send the 3 data points to Max/MSP. Encapsulate the objects that you use to bring the data into max via the serial into a subpatcher entitled “ArduinoData”.
- To do this, create an object called “patcherArduino Data” or “p ArduinoData”.
b. Paste any code necessary for taking in arduino data. Inlets and outlets to this patch can be created using the objects inlet and outlet.
- Create a patch that uses that data in Max/MSP in the following ways:
- Sound generation should be done using some of the oscillators within max. Try using phasor~, tri~, or saw~.
b. Use your accelerometer data to control filters. Filtering is one of the quickest and most effective means of altering your sound.
c. filtergraph~ along with biquad~ is a great all purpose filtering tool that allows you to implement various types of filters – lowpass, high pass, bandpass, etc. To get started, create an object and type in filtergraph~. Open up the help file and copy that code into your patch.
- Create a patch that will play at least 3 different sound files from your computer when a value on one of the axes of the accelerometer passes a threshold.
- If you don’t have any sound files on your computer, download something fun from freesound.org.
b. Use the send and receive objects to send and receive some value in this patch. While this will not necessarily be needed to keep this simple patch clean, these are good tools to know about.
c. Implement a threshold for one of your axes using the past or > objects and use that to trigger the sound files.
- Create a patch that uses the oscillator patch and/or sample patch but also includes one of the effects examples in Extras>Examples Overview MSP>Effects. Use the accelerometer data to implement one of these effects.
Lab #2 – Due Monday 10/10
Goal: Connect Arduio and Max and begin making sounds using sensor data.
Resources: Starter code for this lab can be found here: http://ccrma.stanford.edu/~sleitman/250aExamples100416.zip
Remember: Right click to look at help files for each object
1) Open OneButtonSerialOut.ino and OneButton.maxpat from the examples downloaded above. Connect one button to pin 2 on your aduino board and practice getting that button press from Arduino to Max.
2) Connect 2 continuous sensors to your arduino. Connect 1 potentiometer and 1 other continuous sensor to the analog input pins of your arduino. Use TwoContinuousSensors7BitSerialWith255Separator.ino and 2_SevenBitContinuous.maxpat as templates to get started.
3) Create a Max/MSP patch that uses the 2 sensors to do something interesting with the makenote, noteout and pgmout objects. Use the scale object to scale the range of at least one of your sensors.
4) Make a second patch using the same objects but create a different musical interaction. Ie. change what those sensors are controlling in order to create a substantially different type of soundscape.
5) Add a button to your arduino breadboard and connect it to one of the digital pins on your arduino. Modify the arduino code that you created for item 1 to also take in that button and send it along with the values from the 2 continuous sensors over serial to Max MSP. Make your serial rate 115200 for this patch.
6) Create a Max/MSP patch that uses play~ and ezdac~ objects to explore using your sensors and 1 button to control sample playback. Make sure that you make use of the continuous data from the 2 continuous sensors. Use the line~ object to prevent clipping. If you are feeling adventurous, you can use the ~record object to record something live but make sure you have headphones plugged in or your patch will feed back on itself.
Optional: If you would like to look at the use of MSB (Most significant bit) and LSB (Least Significant Bit), check out the example included in the downloads.
Lab #1 – Due Monday 10/3
1) Get a kit from Sasha or Nolan. Put your name, email address and phone number on the box. Decorate all 6 sides of the box. This can be simply your name or a picture or a colored X or something more elaborate. The point is to make sure we don’t confuse the boxes.
2) Follow the instructions here:
(If you are using a CCRMA Linux machine, the software is already installed)
3) Attach the breadboard and the arduino to the black platform that is in your box. There are screws for the platform in the plastic bag that holds the platform.
4) In Arduino, open up Blink.
File > Examples > Basics > Blink
- a) Modify the code so that the included LED blinks for a very short time but stays off for a longer time.
- b) Modify the code to the point that the blink is so fast that it looks like it is continually on. How fast did that actually need to be? What were the values that you had to choose for the delays between High and Low?
5) Do the following examples:
Make sure you understand EVERY line of code in these tutorials. If you have any questions, we are here to help.
- a) https://www.arduino.cc/en/Tutorial/DigitalReadSerial
b) https://www.arduino.cc/en/Tutorial/Fade (You will need a 220 ohm resistor that is not in your kit. There will be a small container of 220 resistors sitting on the wooden table behind Sasha’s desk in the Max Lab Please return the resistor when you are done.)
g) https://www.arduino.cc/en/Tutorial/AnalogInput (There will be a small container of photoresistors sitting on the wooden table behind Sasha’s desk in the Max Lab. Please return the photoresistor when you are done)