Difference between revisions of "Stompbox Real Sensors 2013"

From CCRMA Wiki
Jump to: navigation, search
 
(6 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
* A set of small, battery powered speakers with 1/8" (2.54mm) jack.
 
* A set of small, battery powered speakers with 1/8" (2.54mm) jack.
  
 +
 +
Note: In this lab, the images will show the Beagle Board xM instead of the Raspberry Pi, but actually all of the wiring is essentially the same.
  
  
Line 26: Line 28:
  
  
== Power Up and Prepare Arduino ==
+
<!-- == Power Up and Prepare Arduino ==
* Use the same procedure as [https://ccrma.stanford.edu/wiki/Software_Lab_NMC described before] to power up Satellite CCRMA and login as the user ''ccrma'' with the password ''temppwd''.
+
* Use the same procedure as [https://ccrma.stanford.edu/wiki/Stompbox_Lab_0_2013 described before] to power up Satellite CCRMA and login as the user ''ccrma'' with the password ''temppwd''.
  
 
* Don't forget to stop the default patch from running by executing the command
 
* Don't forget to stop the default patch from running by executing the command
Line 63: Line 65:
 
* Close the Arduino program by closing all of the Arduino windows. (This is important because it frees up the USB serial port so that Pd can talk to the Arduino board later.)
 
* Close the Arduino program by closing all of the Arduino windows. (This is important because it frees up the USB serial port so that Pd can talk to the Arduino board later.)
  
 
+
-->
 
+
== Routing Power On The Breadboard ==
+
* When changing the circuit on the breadboard, it is a good idea to unplug the USB cable from the Arduino, so unplug it for now.
+
 
+
* Remind yourself about how the sockets on the breadboard are wired together:
+
 
+
[[Image:Breadboard.png]]
+
 
+
* Now connect jumper wires as shown in the image below so that the upper and lower long columns can serve as a power supply for your future circuits.
+
 
+
* Connect a short jumper from the GND pin of the Arduino to the blue column.
+
 
+
* Connect a short jumper from the 5V pin of the Arduino to the red column.
+
 
+
* Finally, use two longer jumpers to connect together the blue columns and the red columns as shown below:
+
 
+
[[Image:0.png|500px]]
+
 
+
* Check your wires now to make sure that you did it correctly!
+
 
+
* Now plug the USB cable back into the Arduino.  You should see the blue light come back on on the Arduino.  ('''If you don't, you have a short circuit!'''  In other words, somehow you connected the wires together incorrectly, effectively connecting the 5V and the GND pins of the Arduino together.  Unplug the USB cable again immediately and fix the circuit!  '''Short circuits are big no-nos because they can (and often do!) destroy the Arduino.''')
+
 
+
 
+
 
+
 
+
 
+
== Appendix: Install Stompbox Firmware onto your Arduino Nano ==
+
* Use the USB cable to plug the Arduino Nano into the Beagle Board.
+
* From the terminal, run the command <tt>arduino &</tt> to start up the Arduino software.
+
* From the menu Tools|Board choose <tt>Arduino Duemilanove or Nano w/ 328</tt>
+
* From the menu Tools|Serial port choose <tt>/dev/ttyUSB0</tt>
+
* Open the sketch <tt>/home/ccrma/pd/stompbox/startup-stompbox/FirmataAllInputs_ExceptOnePWMOut/FirmataAllInputs_ExceptOnePWMOut.pde</tt>
+
* Press the '''Verify''' button.
+
* Check the Arduino messages window to make sure that the code successfully compiled. (Usually, it will say something like <tt>Done compiling</tt> and <tt>Binary sketch size ...</tt>)
+
* Press the '''Upload''' button (looks like an arrow pointing to the right) to install the firmware on the Arduino.
+
* Check the Arduino messages window to make sure that you have successfully uploaded the firmware.
+
 
+
 
+
  
  
Line 184: Line 148:
 
* Connect an input audio source, such as a small MP3 player or instrument the audio output of the jack on the Beagle Board.
 
* Connect an input audio source, such as a small MP3 player or instrument the audio output of the jack on the Beagle Board.
 
* Start pd by running <tt>pd &</tt>
 
* Start pd by running <tt>pd &</tt>
* Open the patch <tt>~/pd/stompbox/startup-stompbox/startup-stompbox.pd</tt> using the File|Open menu option.
+
* Open the patch <tt>~/on-startup/stompbox-tremolo.pd</tt> using the File|Open menu option.
 
* Start audio signal computation by checking the ''compute audio'' button in the main pd window.
 
* Start audio signal computation by checking the ''compute audio'' button in the main pd window.
* The oscillator's output should be displayed by the horizontal slider and LED in real time. (If not, please go back and make sure you carried out all of the previous instructions.)
 
  
[[Image:SBsimple-stompbox.png]]
+
[[Image:SBsimple-stompbox2.png]]
  
  
 
* Verify that turning the potentiometer connected to input pin A3 on the Arduino adjusts the value A3 shown in the main patch window. This should also change the output volume of the effect.
 
* Verify that turning the potentiometer connected to input pin A3 on the Arduino adjusts the value A3 shown in the main patch window. This should also change the output volume of the effect.
 
* Verify that turning the potentiometer connected to input pin A0 on the Arduino adjusts the oscillator frequency.
 
* Verify that turning the potentiometer connected to input pin A0 on the Arduino adjusts the oscillator frequency.
 +
* Verify that clicking the "Turn LED on or off" toggle will control the LED.
  
* Look inside the subpatch <tt>pd user-interface</tt>, which access the Arduino, and figure out how you could access data coming from the other analog inputs. Would you need to add an outlet to the subpatch?
+
* Look inside the subpatch <tt>pd get-input-from-arduino</tt>, which access the Arduino, and figure out how you could access data coming from the other analog inputs. Would you need to add an outlet to the subpatch?
 
* Verify that when you press the button, the ''mode'' checkbox changes its state. Modify the effect to so that the mode checkbox implements a bypass switch. We will ask some volunteers in class the following morning to explain how to do this.
 
* Verify that when you press the button, the ''mode'' checkbox changes its state. Modify the effect to so that the mode checkbox implements a bypass switch. We will ask some volunteers in class the following morning to explain how to do this.
  
Line 202: Line 166:
 
== Build A Wah Effect ==
 
== Build A Wah Effect ==
  
* Open the file ''wahwah.pd'' and play around with the filter parameters for a while.
+
* Open the file ''~/pd/stompbox/demo-patches/11_stomp_wah_model.pd'' and play around with the filter parameters for a while.
* Note that there is no way to adjust the parameters without a graphical user interface. Take the ''pd user-interface'' object from the previous patch, and modify it to control the Wah effect parameters in a sensible way. Get ready to rock out!
+
* Note that there is no way to adjust the parameters without a user interface. Take the ''pd get-input-from-arduino'' object from the previous patch, and modify it to control the Wah effect parameters in a sensible way. Get ready to rock out!
 
* Optional: Find a potentiometer that can be adjusted with your foot (e.g. talk to Edgar) and wire it into the circuit to make the wah effect control complete!
 
* Optional: Find a potentiometer that can be adjusted with your foot (e.g. talk to Edgar) and wire it into the circuit to make the wah effect control complete!
 
* Alternative optional activity: Look inside how the filters are adjusted and make your own filter design.
 
* Alternative optional activity: Look inside how the filters are adjusted and make your own filter design.

Latest revision as of 12:23, 5 August 2014

Lab 2: Controlling an Effect with Real Sensors
Designed by Edgar Berdahl

Due on Wednesday at 9AM


For this lab you need your Satellite CCRMA kit, a laptop computer with Ethernet adaptor to program it, and some headphones with a mini 1/8" (2.54mm) stereo jack.

You are also invited to bring the following optional items, but they are by no means required:

  • Some of your favorite breadboardable sensors and LEDs.
  • A set of small, battery powered speakers with 1/8" (2.54mm) jack.


Note: In this lab, the images will show the Beagle Board xM instead of the Raspberry Pi, but actually all of the wiring is essentially the same.


Make A Sandwich

  • Make a sandwich using the acrylic so that the Raspberry Pi sits on the bottom level and the breadboard sits on the top level (see below).
  • When placing the breadboard, make sure that the higher numbered rows are facing the USB and ethernet ports of the Raspberry Pi.
  • It may fit better if you use three nylon screws instead of four when making the sandwich.
  • Insert your Arduino Nano into the breadboard all the way at the end toward the higher numbered rows and seated roughly in the middle (see below).

EmptySatellite2.jpg

(Board shown underneath is the Beagle Board xM instead of the Raspberry Pi, but the idea is the same)




Power Connections

  • In order to run circuits on the breadboard, you need to get power to it. The Arduino gets 5V from the USB connection, so in this section you will make the 5V accessible to the breadboard.
  • Make sure that your Arduino is mounted at the very end of the breadboard with the higher-numbered rows, as shown in the following picture. In that case, the GND and 5V pins will end up in the 19th row. (Otherwise if your Arduino isn't mounted this way, you simply won't be able to rely on the row numbers, but you can still figure out how to wire things up!)
  • Recall first that that holes in the solderless bread board are wired together as shown:

Breadboard.png

  • Using short jumpers, connect the GND row to the blue "GND" bus on the breadboard, and connect the 5V row to the red "power" bus on the breadboard.
  • Connect the "GND" and "power" busses from both sides of the breadboard together as shown.

Circuit0-big.jpg


Viewed from further away, your breadboard should now look like the following:

Circuit0.jpg



First Circuit: Potentiometer

Now you will build the following voltage divider circuit, to connect one potentiometer to analog input A0.

Pot-A0.jpg

For some help on placing the wires, please see the following picture. In order to ensure the correct orientation, ensure that the text on the potentiometer is facing away from the Arduino (see also oblique picture in next section). Circuit2.jpg



Add A Second Potentiometer

Now connect a second potentiometer to analog input A3 using the same voltage divider circuit.

SBcircuit3-direct.jpg


Again, ensure that the text on the potentiometer is facing *away* from the Arduino (see the red boxes in the following figure):

SBcircuit3.jpg



Add A Button

Most stomp boxes have a button, so we include that as well according to the following circuit:

SBbutton-circuit.jpg

The corresponding picture of the bread board is shown below:

SBcircuit5.jpg



Add An LED

Finally, we add a light-emitting diode (LED) for fun and to help with debugging. Recall that current can only flow in one direction through a diode. One good trick to remember for LEDs is that the longer leg (the anode) points toward the power supply. The 220 Ohm resistor limits the amount of current that can flow through the LED.

LEDPWMSchematic.jpg

SBcircuit6.jpg



Test The Tremolo Effect

Now you will test a very simple tremolo effect.

  • Connect headphones or some small loudspeakers to the audio out jack on the Beagle Board. (It is the one closer to the middle of the board.)
  • Connect an input audio source, such as a small MP3 player or instrument the audio output of the jack on the Beagle Board.
  • Start pd by running pd &
  • Open the patch ~/on-startup/stompbox-tremolo.pd using the File|Open menu option.
  • Start audio signal computation by checking the compute audio button in the main pd window.

SBsimple-stompbox2.png


  • Verify that turning the potentiometer connected to input pin A3 on the Arduino adjusts the value A3 shown in the main patch window. This should also change the output volume of the effect.
  • Verify that turning the potentiometer connected to input pin A0 on the Arduino adjusts the oscillator frequency.
  • Verify that clicking the "Turn LED on or off" toggle will control the LED.
  • Look inside the subpatch pd get-input-from-arduino, which access the Arduino, and figure out how you could access data coming from the other analog inputs. Would you need to add an outlet to the subpatch?
  • Verify that when you press the button, the mode checkbox changes its state. Modify the effect to so that the mode checkbox implements a bypass switch. We will ask some volunteers in class the following morning to explain how to do this.



Build A Wah Effect

  • Open the file ~/pd/stompbox/demo-patches/11_stomp_wah_model.pd and play around with the filter parameters for a while.
  • Note that there is no way to adjust the parameters without a user interface. Take the pd get-input-from-arduino object from the previous patch, and modify it to control the Wah effect parameters in a sensible way. Get ready to rock out!
  • Optional: Find a potentiometer that can be adjusted with your foot (e.g. talk to Edgar) and wire it into the circuit to make the wah effect control complete!
  • Alternative optional activity: Look inside how the filters are adjusted and make your own filter design.



Optional: Build A New Effect

  • Build a new effect whose parameters are adjustable by the potentiometers and button. We will ask for volunteers to demonstrate this the following morning in class. You can build on what you did in lab 1 if you like.
  • Think about the result
    • do the controls allow the entire space of parameters to be explored?
    • is it easy to choose any desired set of parameters?
    • does the effect sound good?
    • does it have dynamics?
    • would you want to use it live?
      • If not, what is missing still?



Important Note

Some small amount of the text and images here was taken from prior laboratory exercises for the course Music 250A. We regret that we do not know who contributed these elements, but these people are likely to include Wendy Ju, Bill Verplank, Michael Gurevich, and possibly more.


Stompbox 2013