250a Haptics Lab 2011

From CCRMA Wiki

(Difference between revisions)
Jump to: navigation, search
(Touch-a-wall)
 
(30 intermediate revisions not shown)
Line 1: Line 1:
= Haptics Lab Using the FireFader for Music 250a =
= Haptics Lab Using the FireFader for Music 250a =
by Edgar Berdahl and edited by Wendy Ju
by Edgar Berdahl and edited by Wendy Ju
 +
 +
See [https://ccrma.stanford.edu/courses/250a/schedule.html this quarter's schedule] for due dates.
The goal of this lab is to introduce actuation and active force feedback.  Each haptic effect can easily be coupled to a sound because the feedback loop is controlled directly in pd. Different haptic effects suggest different sounds; different sounds suggest different effects.  What are the most interesting mappings?  Which are appropriate, controllable, even "expressive"?  Try each sound control with and without haptic feedback enabled.  Are there some that simply cannot be played without haptics?
The goal of this lab is to introduce actuation and active force feedback.  Each haptic effect can easily be coupled to a sound because the feedback loop is controlled directly in pd. Different haptic effects suggest different sounds; different sounds suggest different effects.  What are the most interesting mappings?  Which are appropriate, controllable, even "expressive"?  Try each sound control with and without haptic feedback enabled.  Are there some that simply cannot be played without haptics?
-
<div align="center">
+
<!-- <div align="center">
[[Image:overview_fs.jpg]]
[[Image:overview_fs.jpg]]
Hardware design of Force stick by Bill Verplank
Hardware design of Force stick by Bill Verplank
-
</div>
+
</div> -->
Line 24: Line 26:
== Connect the FireFader to Your Beagle Board ==
== Connect the FireFader to Your Beagle Board ==
-
Be careful with the FireFader. It is possible to break it, for instance if it goes unstable! If it goes unstable, you should immediately cut the power by turning off the power switch on the FireFader. The power cable for the FireFader has a yellow end on it, on which is written 12V. '''Be very careful NEVER to plug this into the Beagle Board because you would break it.''' (The Beagle Board needs to receive only 5V.)
+
Be careful with the FireFader. It is possible to break it, for instance if it goes unstable! If it goes unstable, you should immediately cut the power by turning off the power switch on the FireFader. The power cable for the FireFader has a yellow end on it, on which is written 12V (or 15V). '''Be very careful NEVER to plug this into the Beagle Board because you would break it.''' (The Beagle Board needs to receive only 5V.)
* Disconnect the Arduino Nano that you normally use from your Beagle Board.
* Disconnect the Arduino Nano that you normally use from your Beagle Board.
Line 33: Line 35:
* First startup your kit
* First startup your kit
** Connect your Satellite CCRMA kit to your laptop and boot it.
** Connect your Satellite CCRMA kit to your laptop and boot it.
-
** Use a terminal window to login to Satellite CCRMA as usual using the command <tt>ssh -X ccrma@192.168.1.105</tt> with the password ''temppwd''
+
** Use a terminal window to login to Satellite CCRMA as usual using the command <tt>ssh -XY ccrma@192.168.105.106</tt> with the password ''temppwd''
-
** Check that your kit has access to the internet through you laptop. You can do this by trying to ping yahoo. Run the command <tt>ping yahoo.com</tt>. If it is successful, it will tell you how long it takes to send a packet from your Satellite CCRMA kit to yahoo and back. If there is a problem, see the instructions in [http://ccrma.stanford.edu/wiki/250a_Firmware_Lab lab 3] for setting up the kit.
+
** Check that your kit has access to the internet through you laptop. You can do this by trying to ping yahoo. Run the command <tt>ping yahoo.com</tt>. If it is successful, it will tell you how long it takes to send a packet from your Satellite CCRMA kit to yahoo and back.
-
* Now copy the online lab files to your kit. At the command line in the terminal window, type <tt>wget http://ccrma.stanford.edu/courses/250a/labs/HSP2011.zip ~/250a</tt> to download the haptic signal processing toolbox file to your Beagleboard
+
* Now copy the online lab files to your kit. At the command line in the terminal window, type <tt>wget http://ccrma.stanford.edu/courses/250a/labs/HSP2011.zip</tt> to download the haptic signal processing toolbox file to your Beagleboard
-
* Unzip the file: change into the 250a folder, and type <tt>unzip HSP2011.zip</tt>.
+
* Unzip the file: change into your ~ directory, and type <tt>unzip HSP2011.zip</tt>.
-
* Run the command <tt>arduino&</tt> to start the Arduino software. (If it asks you if you want to install a newer version of the Arduino software, tell it ''no''.) Use the Arduino software to open <tt>~/250a/HSP/haptics_firmware/haptics_firmware.pde</tt>. Upload this code to the Arduino.
+
* Run the command <tt>arduino&</tt> to start the Arduino software. (If it asks you if you want to install a newer version of the Arduino software, tell it ''no''.) Use the Arduino software to open <tt>~/HSP/haptics_firmware/haptics_firmware.pde</tt>. Upload this code to the Arduino.
** Look at the main loop '''loop()''' in the source code for this firmware for a minute. You can see that it reads data from the serial connection from pd and uses this to set the PWM pins using '''analogWrite()'''. Then it writes data to the serial connection to pd about the position of the Fire Fader. Additional data from the analog input pins 1-3 is also sent over the serial, but these pins aren't currently used.
** Look at the main loop '''loop()''' in the source code for this firmware for a minute. You can see that it reads data from the serial connection from pd and uses this to set the PWM pins using '''analogWrite()'''. Then it writes data to the serial connection to pd about the position of the Fire Fader. Additional data from the analog input pins 1-3 is also sent over the serial, but these pins aren't currently used.
Line 46: Line 48:
* When using the FireFader, you will NOT use Jack. Instead, you will use Alsa to talk to the audio drivers. To start pd using Alsa, use the following command
* When using the FireFader, you will NOT use Jack. Instead, you will use Alsa to talk to the audio drivers. To start pd using Alsa, use the following command
-
'' pd -rt -alsa -audiodev 1 -r 22050 -audiobuf 30 Pluck-two-resonators~.pd & ''
+
'' pd -rt -alsa -audiodev 1 -r 22050 -audiobuf 30 & ''
* Plug in your speakers. Make sure they are powered on.
* Plug in your speakers. Make sure they are powered on.
-
* Open pd and load the patch <tt>~/250a/HSP/models/Touch-a-wall.pd</tt>
+
* in Pd, add the following directories to your path by going to File->Path->New:
-
* in PD, add the following directories to your path by going to File->Path->New:
+
  <tt>~/HSP/models<br>
-
  <tt> ~/250a/HSP/models<br>
+
  ~/HSP/palette</tt>
-
  ~/250a/HSP/palette</tt>
+
* Open pd and load the patch <tt>~/HSP/models/Touch-a-wall.pd</tt>
-
* Read the text of the patch so that you can understand how the layout of the patch relates to the equivalent mechanical system of the Force Stick being connected by a conditional link contact~ to ground.
+
* Read the text of the patch so that you can understand how the layout of the patch relates to the equivalent mechanical system of the FireFader being connected by a conditional link contact~ to ground.
<div align="center">
<div align="center">
[[Image:wall.jpg]]
[[Image:wall.jpg]]
</div>
</div>
* Turn on audio by clicking on ''compute audio''. This is necessary because HSP uses audio signals to calculate the haptic force feedback. This makes it far easier to build patches because then you do not have to worry about using the <tt>trigger</tt> object.
* Turn on audio by clicking on ''compute audio''. This is necessary because HSP uses audio signals to calculate the haptic force feedback. This makes it far easier to build patches because then you do not have to worry about using the <tt>trigger</tt> object.
-
* Verify that by moving the Force Stick back and forth, you can make the hslider shown in the patch change.
+
* Verify that by moving the FireFader back and forth, you can make the hslider shown in the patch change.
-
** Hint: Remember that rotary encoders don't necessary know where 0 is--they just choose zero as being the position when the program first starts.
+
* Plug in the 12V (or 15V) yellow power connector to the FireFader.
-
** To zero the rotary encoder for the force stick being held in the middle, first rotate the force stick to the center, and then press the reset ''RST'' button on the Arduino.
+
* Switch the FireFader on while holding onto the fader.
-
** Now hold the force stick in one hand, while you turn the power on for the motor amplifier board by switching the toggle switch to the ''ON'' position.
+
** You should be able to feel a spongy "wall" when you move the FireFader to the right of the center position. (If not, then check your setup.)
-
** You should be able to feel a spongy "wall" when you move the force stick to the right of the center position. (If not, then check your setup.)
+
** Because of the spring action of the contact~ link c, the force increases when you move to the right. However, if you move far enough to the right, then the motors can no longer increase the force level any further due to mechanical limitations.
** Because of the spring action of the contact~ link c, the force increases when you move to the right. However, if you move far enough to the right, then the motors can no longer increase the force level any further due to mechanical limitations.
** Try decreasing the stiffness of the contact~ link to 150 N/m. How does this feel?
** Try decreasing the stiffness of the contact~ link to 150 N/m. How does this feel?
* Consider a hypothetical situation involving two springs with stiffness ''k'' N/m. If you connect the two springs in series, is the net stiffness ''2k'' or ''0.5k''? What if you connect the two springs in parallel?
* Consider a hypothetical situation involving two springs with stiffness ''k'' N/m. If you connect the two springs in series, is the net stiffness ''2k'' or ''0.5k''? What if you connect the two springs in parallel?
-
* When you are done with the patch, turn the motor amplifier board off again. (The motors get quite hot if left on for long periods of time.)
+
* When you are done with the patch, turn the motor amplifier board off again. (The motor can get hot if left on while exerting a force.)
Note: Systems with feedback can become unstable if the right conditions arise. This is why it is a good idea to turn off the motor amplifier board when you are not using the system. (Otherwise, consider what can happen with a public address system if you leave it alone and it starts to squeal/howl.)
Note: Systems with feedback can become unstable if the right conditions arise. This is why it is a good idea to turn off the motor amplifier board when you are not using the system. (Otherwise, consider what can happen with a public address system if you leave it alone and it starts to squeal/howl.)
== Wiggle-a-mass ==
== Wiggle-a-mass ==
-
* Close any other open patches, and then open <tt>~/250a/labs/HSP/Wiggle-a-mass.pd</tt>
+
* Close any other open patches, and then open <tt>~/HSP/Wiggle-a-mass.pd</tt>
-
* Read the patch and notice how the layout of the patch matches the equivalent mechanical system of a Force Stick connected by a springy link~ to a virtual mass.
+
* Read the patch and notice how the layout of the patch matches the equivalent mechanical system of a FireFader connected by a springy link~ to a virtual mass.
<div align="center">
<div align="center">
[[Image:wiggle-mass.jpg]]
[[Image:wiggle-mass.jpg]]
 +
 +
'''Note: Since making this figure, the stiffness was changed from 100 to 180 N/m and the mass from 0.6kg to 1.2kg!'''
</div>
</div>
-
* On the left, the position of the Force Stick is shown with an hslider, and on the right the position of the virtual mass m is shown with an hslider.
+
* On the left, the position of the FireFader is shown with an hslider, and on the right the position of the virtual mass m is shown with an hslider.
-
* Turn on the motors and wiggle the Force Stick back and forth. Can you feel the virtual mass?
+
* Turn on the motors and wiggle the FireFader back and forth. Can you feel the virtual mass?
-
* What happens if you change the virtual mass from 0.6kg to 0.3kg?
+
* What happens if you change the virtual mass from 1.2kg to 0.6kg?
* What happens if you change the damping in the link~ from 1 N/(m/s) to 0 N/(m/s)?
* What happens if you change the damping in the link~ from 1 N/(m/s) to 0 N/(m/s)?
-
* Is it a bad idea to make the damping negative?
+
* Is it a bad idea to make the damping negative? (Be ready to cut the power if you try this!!)
== Optional: Pluck-two-resonators~ ==
== Optional: Pluck-two-resonators~ ==
Line 87: Line 90:
* Read the patch and notice how the layout of the patch matches the equivalent mechanical system.
* Read the patch and notice how the layout of the patch matches the equivalent mechanical system.
** For example, note how one virtual resonator is formed by mass~ ''m'' connected to ground ''g'' by link ''l''. The second resonator is formed by mass~ ''m2'' connected to ground ''g2'' by link ''l2''.
** For example, note how one virtual resonator is formed by mass~ ''m'' connected to ground ''g'' by link ''l''. The second resonator is formed by mass~ ''m2'' connected to ground ''g2'' by link ''l2''.
-
** In case you are wondering about the equivalent mechanical system, here is a similar one: the force stick is plucking a single virtual resonator.
+
** In case you are wondering about the equivalent mechanical system, here is a similar one: the FireFader is plucking a single virtual resonator.
<div align="center">
<div align="center">
[[Image:pluck_resonator.jpg]]
[[Image:pluck_resonator.jpg]]
</div>
</div>
-
* Why does the pitch increase when you can feel the virtual resonators? Hint: contact-pluck~ ''c'' behaves like a spring when the Force-stick is connected to the resonators. Another hint: Consider whether ''c'' is connected in parallel or in series with the virtual resonators.
+
* Why does the pitch increase when you can feel the virtual resonators? Hint: contact-pluck~ ''c'' behaves like a spring when the FireFader is connected to the resonators. Another hint: Consider whether ''c'' is connected in parallel or in series with the virtual resonators.
== Pluck-a-string~ ==
== Pluck-a-string~ ==
* First try interacting with the string without any haptic force feedback. Then turn on the power to the motor amplifier board and try to pluck the string. Is it easier to play with or without haptic feedback?
* First try interacting with the string without any haptic force feedback. Then turn on the power to the motor amplifier board and try to pluck the string. Is it easier to play with or without haptic feedback?
-
* Clicking on the bang in the main patch will cause an impulse to be send into the string. What do you have to do with the Force Stick in order to be able to feel the impulse?
+
* Clicking on the bang in the main patch will cause an impulse to be send into the string. What do you have to do with the FireFader in order to be able to feel the impulse?
* Open up the subpatch to have a look inside.
* Open up the subpatch to have a look inside.
* Try to imagine what it would look like if the <tt>delread~</tt> and <tt>delwrite~</tt> pairs were bypassed? Again, the layout of the patch should provide some indication for the equivalent mechanical model
* Try to imagine what it would look like if the <tt>delread~</tt> and <tt>delwrite~</tt> pairs were bypassed? Again, the layout of the patch should provide some indication for the equivalent mechanical model
<div align="center">
<div align="center">
[[Image:pluck_string.jpg]]
[[Image:pluck_string.jpg]]
 +
 +
'''Note: Since making this figure, the damping for p1 was changed from 0.5 N/(m/s) to 0.2 N/(m/s)!'''
</div>
</div>
* Optional: How could you change either of the <tt>DWG-end~</tt> objects to increase the fundamental frequency of the string's sound?
* Optional: How could you change either of the <tt>DWG-end~</tt> objects to increase the fundamental frequency of the string's sound?
Line 106: Line 111:
== Human-robot-interaction~ ==
== Human-robot-interaction~ ==
-
* Open the patch and notice the shaker sounds when you move the Force Stick back and forth.
+
* First install the STK for physical modeling using the following commands:
 +
** <tt>cd ~</tt>
 +
** <tt>wget ccrma.stanford.edu/courses/250a/labs/stk2pd_help.zip</tt>
 +
** <tt>wget ccrma.stanford.edu/courses/250a/labs/stk2pd_externs.zip</tt>
 +
** <tt>sudo unzip stk2pd_help.zip -d /usr/lib/pd-extended/extra/</tt>
 +
** <tt>sudo unzip stk2pd_externs.zip -d /usr/lib/pd-extended/extra/</tt>
 +
** <tt>rm stk2pd_help.zip</tt>
 +
** <tt>rm stk2pd_externs.zip</tt>
 +
* Open the patch and notice the shaker sounds when you move the FireFader back and forth.
* Open up the <tt>pd Shakers~-abstraction</tt> to see the sound synthesis module.
* Open up the <tt>pd Shakers~-abstraction</tt> to see the sound synthesis module.
* Try changing some of the parameters to see how it changes the sound.
* Try changing some of the parameters to see how it changes the sound.
Line 112: Line 125:
-
* Now hold onto the Force Stick while you turn on the motor amplifier board with the other hand. '''(Be careful because this patch is especially likely to become unstable! If the Force Stick should become unstable, turn off the motor amplifier board again.)'''
+
* Now hold onto the FireFader while you turn on the motor amplifier board with the other hand. '''(Be careful because this patch is especially likely to become unstable! If the FireFader should become unstable, turn off the motor amplifier board again.)'''
-
* You should now feel a virtual "robot" that tends to shake the Force stick about 5 times per second.
+
* You should now feel a virtual "robot" that tends to shake the FireFader about 3 times per second.
-
* Look at the mechanical analog inside <tt>pd subpatch-blocked-at-1</tt>. Again the Force Stick is connected by a link to ground. However, this time the position of ground ''g'' is modulated by <tt>osc~ 5</tt> and neighboring objects.
+
* Look at the mechanical analog inside <tt>pd subpatch-blocked-at-1</tt>. Again the FireFader is connected by a link to ground. However, this time the "virtual mass" is implemented using <tt>osc~ 3</tt> and neighboring objects.
-
 
+
-
 
+
-
 
+
-
* There is an FSR mounted on the end of the Force Stick. We have not used it yet! To change this, click on the toggle in the main patch window. Now the pressure that you apply to the FSR should change the spring stiffness for link ''l1''. That is to say, if you do not apply any pressure, then the spring stiffness is zero, so there is no force feedback. However, as you apply increased pressure, the spring stiffness becomes stronger, providing for stronger force feedback.
+
* Note that in the previous patch, the same physical model was used to synthesize both the audio feedback and the haptic force feedback, in this case, the output from the haptic feedback model is used to control the shaker~.
* Note that in the previous patch, the same physical model was used to synthesize both the audio feedback and the haptic force feedback, in this case, the output from the haptic feedback model is used to control the shaker~.
-
 
-
 
==Build Your Own==
==Build Your Own==
-
Make your very own musical controller using the Force Stick and one of the above patches as a starting point.
+
Make your very own musical controller using the FireFader and one of the above patches as a starting point.
Here are some ideas, but feel free to follow your own interests:
Here are some ideas, but feel free to follow your own interests:
<ol><li>Make a record scratching interface allowing you to feel the record.</li>
<ol><li>Make a record scratching interface allowing you to feel the record.</li>
<li>Or try to impart kinetic energy from your body into a physical model of an instrument.</li>
<li>Or try to impart kinetic energy from your body into a physical model of an instrument.</li>
-
<li>Or can you program the haptic interface so that it allows you to feel a texture? Use the FSR to control the strength of the texture. (This is a haptic illusion--it seems like there are multiple axes that are actuated, but really there is only one actuator.) See [http://www.billverplank.com/HapticDemos.PDF this paper] by Bill Verplank.</li>
+
<li>Or can you program the haptic interface so that it allows you to feel a texture?</li>
<li>Or use the same physical model to calculate both the haptic force feedback and the audio feedback. For instance, you could create multiple virtual objects that you can pluck by giving them different mechanical ground positions.</li>
<li>Or use the same physical model to calculate both the haptic force feedback and the audio feedback. For instance, you could create multiple virtual objects that you can pluck by giving them different mechanical ground positions.</li>
<li>Or if you would like to try some advanced three-dimensional force feedback using the NovInt Falcon, you can use the same physical modeling formalism with [http://ccrma.stanford.edu/~eberdahl/Projects/HSPv2.zip HSP for Max/MSP].</li>
<li>Or if you would like to try some advanced three-dimensional force feedback using the NovInt Falcon, you can use the same physical modeling formalism with [http://ccrma.stanford.edu/~eberdahl/Projects/HSPv2.zip HSP for Max/MSP].</li>
</ol>
</ol>
-
Make us proud. And be ready show off your controller at the next lab session!
+
Make us proud. Post the video of your controller at [[Music 250a Lab Video Wiki]]. And be ready show off your controller at the next lab session!
 +
 
 +
 
 +
==Note==
 +
This lab was inspired by an [https://ccrma.stanford.edu/courses/250a/labs/lab5-winter-2007-haptics/ older lab exercise] for this class by Bill Verplank as well as work done at Claude Cadoz's laboratory.

Current revision as of 10:36, 26 September 2012

Contents

Haptics Lab Using the FireFader for Music 250a

by Edgar Berdahl and edited by Wendy Ju

See this quarter's schedule for due dates.

The goal of this lab is to introduce actuation and active force feedback. Each haptic effect can easily be coupled to a sound because the feedback loop is controlled directly in pd. Different haptic effects suggest different sounds; different sounds suggest different effects. What are the most interesting mappings? Which are appropriate, controllable, even "expressive"? Try each sound control with and without haptic feedback enabled. Are there some that simply cannot be played without haptics?


Feel The Motors

Find the foam-core board that has motors mounted on it and try them out.

For the DC motors, connect one alligator clip to the 6V supply on the Triple Output Power Supply from Hewlett Packard, and connect the other alligator clip to ground, which is labeled COM. Careful! Don't use the 18V supply instead--you could burn out the motors! By adjusting the +6V knob, you can change what voltage you are applying to each of the DC motors. Which way does the solenoid pull? What are small motors good for and what are large motors good for?

For the AC motors, use the Tektronix Function Generator. Try sine waves in the audible range 20Hz-20kHz on the white-colored AC motor. For it to be loud, it needs to be connected to something that can vibrate. Try changing the sound by coupling it to the foam core or the violin body or something else. The other, smaller AC motor can be used to vibrate objects with iron or steel in them or magnets. Try to use it to vibrate the magnet glued to the foam core. Try to use it to vibrate the violin string directly, which contains some steel inside it. (Hint: You will have to place it very closely to the string without touching the string.) Do you know at which frequencies the violin string responds the most?

Image:motor_board.jpg

Connect the FireFader to Your Beagle Board

Be careful with the FireFader. It is possible to break it, for instance if it goes unstable! If it goes unstable, you should immediately cut the power by turning off the power switch on the FireFader. The power cable for the FireFader has a yellow end on it, on which is written 12V (or 15V). Be very careful NEVER to plug this into the Beagle Board because you would break it. (The Beagle Board needs to receive only 5V.)

  • Disconnect the Arduino Nano that you normally use from your Beagle Board.
  • Then connect your Beagle Board instead to the Arduino Nano on the FireFader.
  • You will see that a circuit has already been created on the bread board. This is essentially the circuit for the H-bridge motor driver L298 (see p. 6 of the datasheet) with the large LEDs connected in parallel with the motor.

Setup the Software on Your Satellite CCRMA Kit

  • First startup your kit
    • Connect your Satellite CCRMA kit to your laptop and boot it.
    • Use a terminal window to login to Satellite CCRMA as usual using the command ssh -XY ccrma@192.168.105.106 with the password temppwd
    • Check that your kit has access to the internet through you laptop. You can do this by trying to ping yahoo. Run the command ping yahoo.com. If it is successful, it will tell you how long it takes to send a packet from your Satellite CCRMA kit to yahoo and back.
  • Now copy the online lab files to your kit. At the command line in the terminal window, type wget http://ccrma.stanford.edu/courses/250a/labs/HSP2011.zip to download the haptic signal processing toolbox file to your Beagleboard
  • Unzip the file: change into your ~ directory, and type unzip HSP2011.zip.
  • Run the command arduino& to start the Arduino software. (If it asks you if you want to install a newer version of the Arduino software, tell it no.) Use the Arduino software to open ~/HSP/haptics_firmware/haptics_firmware.pde. Upload this code to the Arduino.
    • Look at the main loop loop() in the source code for this firmware for a minute. You can see that it reads data from the serial connection from pd and uses this to set the PWM pins using analogWrite(). Then it writes data to the serial connection to pd about the position of the Fire Fader. Additional data from the analog input pins 1-3 is also sent over the serial, but these pins aren't currently used.

Touch-a-wall

  • When using the FireFader, you will NOT use Jack. Instead, you will use Alsa to talk to the audio drivers. To start pd using Alsa, use the following command

pd -rt -alsa -audiodev 1 -r 22050 -audiobuf 30 &

  • Plug in your speakers. Make sure they are powered on.
  • in Pd, add the following directories to your path by going to File->Path->New:
~/HSP/models
~/HSP/palette
  • Open pd and load the patch ~/HSP/models/Touch-a-wall.pd
  • Read the text of the patch so that you can understand how the layout of the patch relates to the equivalent mechanical system of the FireFader being connected by a conditional link contact~ to ground.

Image:wall.jpg

  • Turn on audio by clicking on compute audio. This is necessary because HSP uses audio signals to calculate the haptic force feedback. This makes it far easier to build patches because then you do not have to worry about using the trigger object.
  • Verify that by moving the FireFader back and forth, you can make the hslider shown in the patch change.
  • Plug in the 12V (or 15V) yellow power connector to the FireFader.
  • Switch the FireFader on while holding onto the fader.
    • You should be able to feel a spongy "wall" when you move the FireFader to the right of the center position. (If not, then check your setup.)
    • Because of the spring action of the contact~ link c, the force increases when you move to the right. However, if you move far enough to the right, then the motors can no longer increase the force level any further due to mechanical limitations.
    • Try decreasing the stiffness of the contact~ link to 150 N/m. How does this feel?
  • Consider a hypothetical situation involving two springs with stiffness k N/m. If you connect the two springs in series, is the net stiffness 2k or 0.5k? What if you connect the two springs in parallel?
  • When you are done with the patch, turn the motor amplifier board off again. (The motor can get hot if left on while exerting a force.)

Note: Systems with feedback can become unstable if the right conditions arise. This is why it is a good idea to turn off the motor amplifier board when you are not using the system. (Otherwise, consider what can happen with a public address system if you leave it alone and it starts to squeal/howl.)

Wiggle-a-mass

  • Close any other open patches, and then open ~/HSP/Wiggle-a-mass.pd
  • Read the patch and notice how the layout of the patch matches the equivalent mechanical system of a FireFader connected by a springy link~ to a virtual mass.

Image:wiggle-mass.jpg

Note: Since making this figure, the stiffness was changed from 100 to 180 N/m and the mass from 0.6kg to 1.2kg!

  • On the left, the position of the FireFader is shown with an hslider, and on the right the position of the virtual mass m is shown with an hslider.
  • Turn on the motors and wiggle the FireFader back and forth. Can you feel the virtual mass?
  • What happens if you change the virtual mass from 1.2kg to 0.6kg?
  • What happens if you change the damping in the link~ from 1 N/(m/s) to 0 N/(m/s)?
  • Is it a bad idea to make the damping negative? (Be ready to cut the power if you try this!!)

Optional: Pluck-two-resonators~

  • Open this patch and see if you can guess what will happen. Now try it!
  • Read the patch and notice how the layout of the patch matches the equivalent mechanical system.
    • For example, note how one virtual resonator is formed by mass~ m connected to ground g by link l. The second resonator is formed by mass~ m2 connected to ground g2 by link l2.
    • In case you are wondering about the equivalent mechanical system, here is a similar one: the FireFader is plucking a single virtual resonator.

Image:pluck_resonator.jpg

  • Why does the pitch increase when you can feel the virtual resonators? Hint: contact-pluck~ c behaves like a spring when the FireFader is connected to the resonators. Another hint: Consider whether c is connected in parallel or in series with the virtual resonators.

Pluck-a-string~

  • First try interacting with the string without any haptic force feedback. Then turn on the power to the motor amplifier board and try to pluck the string. Is it easier to play with or without haptic feedback?
  • Clicking on the bang in the main patch will cause an impulse to be send into the string. What do you have to do with the FireFader in order to be able to feel the impulse?
  • Open up the subpatch to have a look inside.
  • Try to imagine what it would look like if the delread~ and delwrite~ pairs were bypassed? Again, the layout of the patch should provide some indication for the equivalent mechanical model

Image:pluck_string.jpg

Note: Since making this figure, the damping for p1 was changed from 0.5 N/(m/s) to 0.2 N/(m/s)!

  • Optional: How could you change either of the DWG-end~ objects to increase the fundamental frequency of the string's sound?
  • If you would like to learn more about physical modeling then take Julius Smith's course Music 420 in the winter quarter. For some specific information about this particular physical modeling method, see this brief tutorial.
  • Remember to turn off the power to the motor amplifier board when you are finished.

Human-robot-interaction~

  • First install the STK for physical modeling using the following commands:
    • cd ~
    • wget ccrma.stanford.edu/courses/250a/labs/stk2pd_help.zip
    • wget ccrma.stanford.edu/courses/250a/labs/stk2pd_externs.zip
    • sudo unzip stk2pd_help.zip -d /usr/lib/pd-extended/extra/
    • sudo unzip stk2pd_externs.zip -d /usr/lib/pd-extended/extra/
    • rm stk2pd_help.zip
    • rm stk2pd_externs.zip
  • Open the patch and notice the shaker sounds when you move the FireFader back and forth.
  • Open up the pd Shakers~-abstraction to see the sound synthesis module.
  • Try changing some of the parameters to see how it changes the sound.
  • In particular, try choosing different gain sounds by clicking in the different boxes set in a row at the bottom of the patch. Which is your favorite?


  • Now hold onto the FireFader while you turn on the motor amplifier board with the other hand. (Be careful because this patch is especially likely to become unstable! If the FireFader should become unstable, turn off the motor amplifier board again.)
  • You should now feel a virtual "robot" that tends to shake the FireFader about 3 times per second.
  • Look at the mechanical analog inside pd subpatch-blocked-at-1. Again the FireFader is connected by a link to ground. However, this time the "virtual mass" is implemented using osc~ 3 and neighboring objects.


  • Note that in the previous patch, the same physical model was used to synthesize both the audio feedback and the haptic force feedback, in this case, the output from the haptic feedback model is used to control the shaker~.

Build Your Own

Make your very own musical controller using the FireFader and one of the above patches as a starting point. Here are some ideas, but feel free to follow your own interests:

  1. Make a record scratching interface allowing you to feel the record.
  2. Or try to impart kinetic energy from your body into a physical model of an instrument.
  3. Or can you program the haptic interface so that it allows you to feel a texture?
  4. Or use the same physical model to calculate both the haptic force feedback and the audio feedback. For instance, you could create multiple virtual objects that you can pluck by giving them different mechanical ground positions.
  5. Or if you would like to try some advanced three-dimensional force feedback using the NovInt Falcon, you can use the same physical modeling formalism with HSP for Max/MSP.

Make us proud. Post the video of your controller at Music 250a Lab Video Wiki. And be ready show off your controller at the next lab session!


Note

This lab was inspired by an older lab exercise for this class by Bill Verplank as well as work done at Claude Cadoz's laboratory.

Personal tools