256-fall-2008/hw2

From CCRMA Wiki
Revision as of 20:11, 13 October 2008 by Ge (Talk | contribs)

Jump to: navigation, search

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

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


Delayed.png


Specification (part 1 of 3): 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)
  • next, modify the attenuation a 2-point moving average filter into the feedback loop: simply average the current output sample with the previous output sample.
  • final test: on demand (e.g., via console input), load the array with white noise, and let it run


Specification (part 2 of 3): 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


Note

  • 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?


Deliverables

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