From CCRMA Wiki
Jump to: navigation, search

Homework #2: SonicSlingShot (SSS)

Due date: 2012.2.1 11:59:59pm (or thereabout), Wednesday.


The goals of this assignment:

  • set up a flip view (one for real-time graphics, one for UI elements)
  • using the Synthesis Toolkit for iPhone
  • real-time graphics via OpenGL ES
  • basic physical simulation + interaction
  • musical mapping

Specification (part 1 of 3): Setup: Flip View, OpenGL ES, STK

  • create a project containing a flip view
  • this should be covered in class, and reviewed from the tutorial.
  • get graphics set up with a orthographic projection, using mo_gfx
  • compile in STK, make some sounds via mo_audio

Specification (part 2 of 3): The Slingshot Interaction

The slingshot in this assignment operates as follows:

  • initial state: empty screen
  • two point multitouch: creates a "rubber band" (rendered as some type of line)
  • third point: the rubber band maybe gently plucked (should see some wave forms, may even be the actual waveform)
    • should sounds like a plucked string, pitch determined by length!
  • thrid point: pulling and holding in any direction on the rubber band stretches it
    • release: restores the rubber band, while shooting a projectile into the space
    • the direction and velocity of the projectile should be determined by angle and how far the rubber band is stretched

Specification (part 3 of 3): Collision Detection + Mapping

  • check for collision:
    • against the boundaries of the screen
    • against other projectiles
  • collision detection should generate a visual cue somehow
    • use texture mapping to create an animation
  • collision detection should generate events that gets sonified (you choose the sonification)
  • think about how to map the collisions to sound parameters
  • add a few options to the flip view, here are some to implement and some suggestions:
    • enable accelerometer and introduce gravity into the system (a toggle)
    • shake to clear the space (a toggle)
    • add damping to the system, i.e., projectiles loss energy and slow down over time (a slide for amount of damping)
    • a mapping of your own
    • (optional) reverberation / panning


  • do things in chunks, unit test when possible!
  • make things as simple as possible...Global variables are fine for now.


  • have fun with it!!!
  • comment your code!
  • choose your own coding conventions - but be consistent
  • you are welcome to work together, but you must do/turn in your own work


turn in all files by putting them in your Library/Web/256b/hw2/ directory, and concise online documentation + readme + email ge and mike

  • 1) source code to the project(s) (*.h, *.cpp, *.m *.mm *.c makefile, project files, etc.)
  • 2) online page for your project (should be viewable at http://ccrma.stanford.edu/~YOURID/256b/hw2). It should include:
    • links to your files of various kinds (or to a zip/tar archive)
    • instructions on building the project (for example, anyone in the class should be able to download and run)
    • a short README text section that:
      • conveys your ideas/comments in constructing each program
      • describes any difficulties you encountered in the process
      • lists any collaborators
  • 3) email Ge and Mike with the link to your web page, as a confirmation that you are submitting the assignment