Lab Week 11

The goal of this lab is to create sounds that are driven by events in your animation.

This lab has 2 tasks:

Task A. Use continuous sounds with continuous control, e.g. use a particle’s height or velocity to control the pitch or amplitude of a continuous tone. If you have swarms of particles, you can have swarms of tones.

Task B. Use sound files and “trigger” them when events take place in an animation. You must put sound files containing the sounds in your project directory and use a local server, as with images. You can start playing a sound when some event happens, e.g. a particle bounces off the wall or collides with an object.

Task A. Continuous control of synthesized sound.

  1. Start with any animation.
    • Use your own sketch, or
    • Use a class example from Notes pages, or
    • Modify a sketch or class example, or
    • Use the sketch of a bouncing ball below.
    • sketch

  2. Copy index.html into your project directory from template-all.zip. (You must use template-all.zip because template-p5only.zip does not contain functions for sound.
  3. Add sounds to the animation. Here are some techniques:

Task B. Triggering sound file playback.

  1. As with Task A, start with any animation.
  2. Set up a server and test to make sure you can load your sketch from your local server:
    • Open a Terminal in OS X or a command window (cmd) in Windows.
    • Change your current directory to the directory you want to serve:

      Type cd path-to-your-directory

    • Type in Terminal:
      python -m SimpleHTTPServer

      Or if you are using Python 3, type:
      python -m http.server

    • Visit the URL http://localhost:8000 in your browser to test your sketch.
    • You can exit the server by typing Control-C in the window where you started it.
  3. Find or make a sound effect.
    • Get a sound from the web, e.g. http://freesound.org, or
    • Make your own sound (it’s easy to record with Audacity).
  4. Add/test sound file playback (e.g. play a “boing” when something bounces).

Have fun!