Back to Schedule

Assignment 1 Solutions

32 points total, creative assignment graded separately.

1) (8 points, 2 for each correct answer)
   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).

   331.45 meters/second (330 close enough), 
   1116.4 ft./sec, I like 1100, (some people use 1000 as "pretty close")
   761.18 MPH
   1 furlong = 660 feet, 1 fortnight = 14 days = 1209600 seconds
       yielding a speed of sound of 2046056.72 furlongs/fortnight
   An obvious unit is also 1.0 Mach, which is the speed of sound

   Give the speed of sound in water in meters/second.  

   1482 m/s at 20 degrees C, varies with salinity, density 
	(sea level vs. not), and temperature.

2) (2 points)
   How far does sound travel (in air) during 
   the time of one audio sample at CD rate?  
   Give this in cm.

   33145 cm/second / 44100 samples/second = .7516 cm / sample

   at 192000 samples/second we get 0.177 cm / sample

3) (4 points)
   What is the repetition period (in samples)
   of a 330 Hz. wave at CD sampling rate?

   44100 samples/second / 330 cycles/second = 133.636363 samples/cycle
   330 Hz. is closest to a musical E4
   22 Hz. has 44100/22 = 2004.54545454 samples per cycle

4) (5 points)
   What's the approximate QSNR of 8 bits? 6 bits? 10? 12? 16?
   Use quantize.c to process a couple of short high quality 
   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.

   Use approx. rule of 6dB per bit:  8->48, 6->36, 10->60, 12->72, 16->96dB

5) (10 points.  4 for plausable thought.  3 for correct peaks/nulls.
	1 for plot. 2 for 1/2 frequency solutions)

    Given the slight speed of sound variance with 
    temperature, humidity, etc., we can use 2' as wavelength.
    If we say the origin is at the point midway between 
    the two point sources, then they're in phase along the
    line connecting them at 
         x = 0, +/- 1.50 (right in front of either speaker), and infinity
    and out of phase at 
         x = +/- 3.72

  Technically the waves don't actually completely cancel, because there's
  a 1/distance loudness change, but there are nulls.  These happen whenever
  the path difference is a half-wavelength.  

  If we halve the frequency, the same arguments apply, but the wavelengths
  double, giving us a similar set of peaks/nulls, but spaced much farther

Here's a stupid ChucK program to help calculate this:

0.0 => float x;
0.0 => float eval;
0.0 => float lastEval;
1.0 => float diff;	// Set this to half wavelengths, or full wavelengths

while (x < 200.0)   {
    Math.sqrt(4*4+(1.5+x)*(1.5+x))-Math.sqrt(4*4+(x-1.5)*(x-1.5)) - diff => eval;
    if (eval*lastEval < 0.0) <<< x, eval >>>;  // Find a zero crossing
    eval => lastEval;
    0.01 +=> x;

6) (2 points for a good explanation of beats)
   Type in, compile, and run this code.  Listen to the file, 
   and look at it in Goldwave or other waveform viewer/editor.  
   Explain what's happening.  

BEATS!!!  (Constructive and Destructive Interference)

In ChucK, in ONLY 4 Lines!!

SinOsc s1 => dac;
SinOsc s2 => dac;
((500.0 => s1.freq) + 1.0) => s2.freq;
20.0 :: second => now;

7) (3 points for this description of modified code)
   Modify srconvrt.c or timeshif.c to do something interesting 
   and new.  Write up what you did, and use the capability in 
   the next part of the assignment.




Back to Schedule