Difference between revisions of "256-fall-2008/hw2"

From CCRMA Wiki
Jump to: navigation, search
Line 3: Line 3:
Due date: 2008.10.22 11:59:59pm (or thereabout), Wednesday.
Due date: 2008.10.22 11:59:59pm (or thereabout), Wednesday.
<div style="text-align: left;">[[Image:ingredients.jpg]]</div>
<div style="text-align: left;">[[Image:delayed.png]]</div>
Let's get cookin'.
Let's get cookin'.

Revision as of 00:37, 13 October 2008

Homework #2: Delay, Feedback, Moving Average, Polyphony

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


Let's get cookin'.

Specification (part 1 of 2): Delay + Feedback + Moving Average

  • create a program that is capable of real-time audio input/output (e.g., use the skeleton framework from HW1)
  • craft the framework for a delay by implementing a circular buffer:
    • think about how to implement a delay element that delays the input signal by some integer number of samples
    • think about how to implement this efficiently, without shifting all the elements for each sample
      • an array of samples
      • two pointers: one for reading, and another for writing, initialize them
      • advance the pointers accordingly, writing and reading into the corresponding locations via the pointers
    • test with with the microphone (with varying delay lengths)
  • now add feedback, with some attenuation factor (<1)
    • take each output sample of the delay, multiply it by attenuation factor (<1), and add it into the input
    • test with the microphone (with varying delay lengths)
  • final test: on demand (e.g., via console input), load the array with white noise, and let it run

Specification (part 2 of 2): Polyphony

  • abstract the above into something you can reuse
  • design an interface for straightforward control
  • add RtMIDI support with polyphony, so we can play our construction above

Specification (part 3 of 3): Sonic/Musical Statement

  • use the framework above, algorithmically generate and/or play a sonic/musical statement
  • record it turn it in


  • have fun with it!!!
  • your code should compile and run on the CCRMA machines
  • 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 (you'll likely get more out of it this way)
  • some considerations:
    • how to organize the code for the various types of signals?
    • how much error-checking and error-reporting on the command line arguments?


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

  • 1) source code to the project (*.h, *.cpp, *.c makefile, etc.)
  • 2) online page for your project (should be viewable at http://ccrma.stanford.edu/~YOURID/256/hw2/). It should include:
    • links to your files of various kinds
    • instructions on building the project (for example, anyone in the class should be able to download
    • 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 with the link to your web page, as a confirmation that you are submitting the assignment