Back to Schedule

Assignment 1

Due Wednesday, February 11, in class.
Show your work. Have fun.

1) What is the speed of sound in air?  
   Give this in meters/second, feet/s, miles/hour,
   and one other obscure metric of your choice
   (example obscure metrics: angstroms/year cubits/nanosecond).
   Find and report the speed of sound in water, in meters/second.
   Find and report the speed of sound in steel, in meters/second.

2) How far does sound travel (in air) during the
   time of one audio sample at CD sample rate?  
   Give this in cm.  The highest standard sample
   rate today is 192,000 samples per second.
   How far does sound travel (in air, in cm) 
   during one of these higher-rate samples?

3) What is the repetition period (in samples)
   of a 330 Hz. wave at CD sampling rate?
   What musical note is closest to this frequency?
   Assume we can hear (or feel) down to about 22 Hz. 
   How many samples are in each period of a 22 Hz.
   wave?  What is the highest frequency that
   should be encoded on a CD without aliasing?

4) What's the approximate QSNR of 8 bit audio? 6 bits? 10? 4? 16?
   Use quantize.c or .ck to process a couple of short high 
   quality mono sound files (see course directory
   or get your own) and listen to each of these quantization 
   levels on good quality speakers, or better yet headphones.

5) Two speakers are positioned 3 feet apart, and carry the same
   543 Hz. sine wave, in phase.  Plot the points along a line 
   parallel to the line between the two speakers, and 4' in
   front of the speakers (see below), where the waves from the 
   two speakers add together in phase (plot these as X's).  
   Plot the points where the waves cancel (out of phase) as 
   O symbols.  Label all distances clearly.  How does the plot 
   change if we cut the frequency in half?

		    SPKR <------3'-----> SPKR
        		        ^
	        	        |
        	        	|
 		                4'
        	 	        |
                		|
 	               		|
        	        	|
				v
	- - - - - - - - - - - - X - - - - - - - - - - - -

6) Type in, compile, and run this code.  Listen to the file, 
   and look at it in your favorite waveform viewer/editor.  
   Explain what's happening.  

/*************************************************************/
	#include < stdlib.h>
	#include < math.h>
	#include < stdio.h>
	#include "waveio.h"
/*  Note: you need to have waveio.h living in the same directory */
/*        Please attend to the instructions in that file as well */

	#define SRATE 22050
	#define TWO_PI 6.28

	int main(void) {
    	    long i;
    	    float temp;
    	    short data;
    	    FILE *fileOut;
    	    struct soundhdr hdr;

    	    fillheader(&hdr,SRATE);
    	    fileOut = opensoundout("beats.wav",&hdr); /* .snd for others */
	    if (!fileOut) {
		printf("Doh!!!\n");
		return(0);
	    }
    	    for (i=0;i < SRATE*20;i++)    { /* Synth. for 20 seconds */
        	temp =  sin(i * 500.0 * TWO_PI / SRATE);
        	temp += sin(i * 501.0 * TWO_PI / SRATE);
        	data = temp * 15000;       /*  This could be as big as 16383, why?? */
		fwrite(&data,2,1,fileOut);
    	    }
    	    closesoundout(fileOut,i);
	    return(1);
	}
/***********************************************************/

Now code this in ChucK.  You don't have to write out
the sound file, just let ChucK synthesize the two 
sine waves for a twenty seconds.  This should 
take only a few lines of code (like 5 lines).

7) Modify srconvrt.c or timeshif.c to do something interesting 
   and new.  Write up what you did, and use the new capability in 
   the next part of the assignment.  You can also use ChucK code
   to do this.  Just describe and document what you did.

8) Use srconvrt, timeshif, ChucK, and your own hacks, to 
   make a 22.05 second "musical statement."  You may also use
   a soundeditor such as Audacity, snd, GoldWave, CoolEdit,
   etc., but only to edit and mix (cut,copy,paste,gain,fadein,
   fadeout,mix,etc.).  No esoteric menu items or plug-in effects
   should be used, only old fashioned time-domain stuff.
   Create a web directory somewhere for your COS325 projects.
   We're going to use this same directory all semester, and
   I'll build a page of links to all your pages so we can
   get to them easily.  Place your musical statement project 
   in that directory with a name unique to you and the assignment
   number of this format: 

   cook1.aif, perry1.wav, pcook1.mp3, ananya1.au, or similar.  

   Also place a .txt file of the same name (cook1.txt, etc.) there,
   describing what you did, what source(s) you used, what you 
   discovered etc.

   EMail us a link to your course project webpage the day before
   class due date (February 10).  You may edit, hack, upload up
   until class time on the due date.  

   We will listen to these and discuss them in class.

Back to Schedule