Difference between revisions of "256b-winter-2010/hw1"

From CCRMA Wiki
Jump to: navigation, search
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Homework #1: iPhone: Get Set, Synthesis, Interact =
+
= Homework #1: iPhone Programming Lab: Audio + Interaction =
  
Due date: 2009.1.13 11:59:59pm (or thereabout), Wednesday.
+
Due date: 2010.1.13 11:59:59pm (or thereabout), Wednesday.
  
 
<div style="text-align: left;">[[Image:JoyOfCooking.png]]</div>
 
<div style="text-align: left;">[[Image:JoyOfCooking.png]]</div>
Line 14: Line 14:
 
** compile and run on the device (not just in the simulator).  Make sure the .plist file is correct (Bundle identifier= edu.stanford.ccrma.${PRODUCT_NAME}
 
** compile and run on the device (not just in the simulator).  Make sure the .plist file is correct (Bundle identifier= edu.stanford.ccrma.${PRODUCT_NAME}
 
* make basic audio I/O work (this will be covered in class and in tutorial)
 
* make basic audio I/O work (this will be covered in class and in tutorial)
** use mo_audio.* to set up an audio callback, and initialize it.
+
** use mo_audio.* to set up an audio callback, and initialize it (see [http://mopho.stanford.edu/api/beta/ MoPhO API (beta)]
 
** create the audio callback, and populated the buffer, e.g., synthesize a simple sine wave to fill in the output buffer (if you do not do anything in the audio callback loop, feedback will most likely result.)
 
** create the audio callback, and populated the buffer, e.g., synthesize a simple sine wave to fill in the output buffer (if you do not do anything in the audio callback loop, feedback will most likely result.)
 
** test it
 
** test it
Line 20: Line 20:
  
 
=== Specification (part 2 of 3): Real-time Audio Synthesize ===
 
=== Specification (part 2 of 3): Real-time Audio Synthesize ===
* modify your code from above to synthesize each of the following:
+
* based on the code above, create '''three apps''', one for each of the following:
 
** a sine wave
 
** a sine wave
** white noise
 
 
** FM synthesis tone
 
** FM synthesis tone
** a delayed version of the audio input (set up a circular buffer, as in hw2 from 256a)
+
** a delayed version of the audio input (set up a circular buffer, as in [[256a-fall-2009/hw2|hw2]] from 256a)
** (for now, hardcode the selection of which type of sound to synthesis - we'll add UI elements to control this in section 3 below)
+
 
* be mindful of the parameters for each of these synthesis methods  (and be ready to expose and chance them in section 3 below).
 
* be mindful of the parameters for each of these synthesis methods  (and be ready to expose and chance them in section 3 below).
  
 
=== Specification (part 3 of 3): Exploring Interaction ===
 
=== Specification (part 3 of 3): Exploring Interaction ===
* first, add some basic controls to select the synthesis on-the-fly
+
* for the respective apps, connect synthesis parameters to interactions as follows:
* next connect synthesis parameters to interactions as follows:
+
** (app #1) '''sine wave''': connect the first axis of the accelerometer to the frequency
** '''sine wave''': connect the first axis of the accelerometer to the frequency
+
** (app #2) '''FM synthesis''':
** '''FM synthesis''':
+
 
*** connect the first two axes to carrier and modulator frequencies (you determine the ranges), and add a GUI element (e.g., slider) to control the modulation index.
 
*** connect the first two axes to carrier and modulator frequencies (you determine the ranges), and add a GUI element (e.g., slider) to control the modulation index.
*** add a toggle between a) continuous audio output and b) manually triggered notes
+
*** add a toggle (UISwitch) between a) continuous audio output and b) manually triggered notes
 
*** for the latter (manually triggered notes), add a GUI button to trigger the notes.
 
*** for the latter (manually triggered notes), add a GUI button to trigger the notes.
** '''delayed input''': use multi-touch and the two-point pinch gesture to control delay length (you may add another slider to control the feedback coefficient, and a label to output the current delay length)
+
** (app #3) '''delayed input''': use multi-touch and the two-point pinch gesture to control delay length (you may add another slider to control the feedback coefficient, and a label to output the current delay length)
* even though this assignment is intended to familiarize you with audio + interaction on the phone, consider the aesthetic and user experience.
+
* even though this assignment is intended to familiarize you with audio + interaction on the phone, consider the aesthetic and user experience.
 +
 
 +
=== Tips ===
 +
* make a delayline class of some sort
 +
* figure out a simple way to slew control parameters to eliminating audio clicks and glitches
 +
* use a simple counting mechanism or envelope generator to trigger notes on and off--possibly in a separate class
 +
* make things as simple as possible...Global variables are fine for now.
  
 
=== Note ===
 
=== Note ===
Line 44: Line 47:
 
* choose your own coding conventions - but '''be consistent'''
 
* choose your own coding conventions - but '''be consistent'''
 
* you are welcome to work together, but you must do/turn in your own work
 
* you are welcome to work together, but you must do/turn in your own work
 
  
 
=== Deliverables ===
 
=== Deliverables ===
Line 50: Line 52:
 
'''turn in all files by putting them in your Library/Web/256b/hw1/ directory, and concise online documentation + readme'''
 
'''turn in all files by putting them in your Library/Web/256b/hw1/ directory, and concise online documentation + readme'''
  
* 1) source code to the project (*.h, *.cpp, *.m *.mm *.c makefile, project files, etc.)
+
* 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/hw1/).  It should include:
 
* 2) online page for your project (should be viewable at http://ccrma.stanford.edu/~YOURID/256b/hw1/).  It should include:
 
** links to your files of various kinds (or to a zip/tar archive)
 
** links to your files of various kinds (or to a zip/tar archive)

Latest revision as of 20:46, 18 January 2010

Homework #1: iPhone Programming Lab: Audio + Interaction

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

JoyOfCooking.png

The goal of the first homework is to set up real-time audio on the phone, and explore basic interactions with input from the accelerometer, multi-touch, or GUI elements. Let's get cookin'.


Specification (part 1 of 3): Get Set Up

  • set up your development environment (XCode, have your development device provisioned, installed the provision, etc.)
  • compile and run a standalone program and install it on your physical iPhone device:
    • create a new "View-based Application" project for iPhone (OS File-> New Project -> View-based Project) - name it as you like
    • compile and run on the device (not just in the simulator). Make sure the .plist file is correct (Bundle identifier= edu.stanford.ccrma.${PRODUCT_NAME}
  • make basic audio I/O work (this will be covered in class and in tutorial)
    • use mo_audio.* to set up an audio callback, and initialize it (see MoPhO API (beta)
    • create the audio callback, and populated the buffer, e.g., synthesize a simple sine wave to fill in the output buffer (if you do not do anything in the audio callback loop, feedback will most likely result.)
    • test it
    • this should be covered in class, and reviewed from the tutorial.

Specification (part 2 of 3): Real-time Audio Synthesize

  • based on the code above, create three apps, one for each of the following:
    • a sine wave
    • FM synthesis tone
    • a delayed version of the audio input (set up a circular buffer, as in hw2 from 256a)
  • be mindful of the parameters for each of these synthesis methods (and be ready to expose and chance them in section 3 below).

Specification (part 3 of 3): Exploring Interaction

  • for the respective apps, connect synthesis parameters to interactions as follows:
    • (app #1) sine wave: connect the first axis of the accelerometer to the frequency
    • (app #2) FM synthesis:
      • connect the first two axes to carrier and modulator frequencies (you determine the ranges), and add a GUI element (e.g., slider) to control the modulation index.
      • add a toggle (UISwitch) between a) continuous audio output and b) manually triggered notes
      • for the latter (manually triggered notes), add a GUI button to trigger the notes.
    • (app #3) delayed input: use multi-touch and the two-point pinch gesture to control delay length (you may add another slider to control the feedback coefficient, and a label to output the current delay length)
  • even though this assignment is intended to familiarize you with audio + interaction on the phone, consider the aesthetic and user experience.

Tips

  • make a delayline class of some sort
  • figure out a simple way to slew control parameters to eliminating audio clicks and glitches
  • use a simple counting mechanism or envelope generator to trigger notes on and off--possibly in a separate class
  • make things as simple as possible...Global variables are fine for now.

Note

  • 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

Deliverables

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

  • 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/hw1/). 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 Nick with the link to your web page, as a confirmation that you are submitting the assignment