From CCRMA Wiki
Revision as of 20:05, 6 October 2010 by Njb (→Homework #2: Delay, Feedback, Moving Average, and Polyphony)
Homework #2: Delay, Feedback, Moving Average, and Polyphony
Due date: 2010.10.12 11:59:59pm (or thereabout), Tuesday.
See 256a-fall-2010/hw2_hints hw2 hints if needed.
Specification (part 1 of 3): Delay + Feedback + Moving Average
- create a program that is capable of real-time audio input/output (suggestion: 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 feedback by adding 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
- NOTE: If you do not have a MIDI keyboard, you can download a virtual midi keyboard to trigger your synthesis such as Midi Keys
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 in a single zip file (*.h, *.cpp, *.c makefile, etc.). It must compile on the CCRMA linux machines.
- 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 Nick and Ge with the link to your web page, as a confirmation that you are submitting the assignment