Back to Schedule

## Assignment 3

### Due Wednesday, March 4, in class. Show your work. Have fun.

```1) More sines and stuff, show your work

a)  cos2(θ) = (1 + ??) / 2

b)  ejθtcos(ωt) = exp(j Theta t) * cos(Omega t) = ??

What happens if θ = ω?

if θ = -ω?

2) Linearity and Time Invariance

For each of these, say whether the system is
linear, time-invariant, or both, and show why.

a)   y(n) = x(n) + x(n-1) - 1

b)   y(n) = x(n) + 0.9y(n-1)

c)   y(n) = x(n)1.09

d)   y(n) = x(n) * 2-n

e)   y(n) = x(n) + 0.9-1x(n-1) + 0.9-2x(n-2) + ... + 0.9-kx(n-k) + ...

f)   y(n) =  7.0, n>11
0.0, otherwise

g)   y(n) = x(n) - x(n-1) + 0.1*x(n)*x(n-1)

3)  Convoluted thinking

x(n)*x(n) = x*x(n) = SUMkx(k)x(n-k);
( here * means convolution, not multiplication)

let x(n) = [1, 1, 0, 0, 0, ...]

then x*x(n) = [1,2,1,0,0,0,...]

a) compute and write out 	x*x*x(n) =

x*x*x*x(n) =

x*x*x*x*x(n) =

b) repeat all operations in (a) for x(n) = [1,-1,0,0,0,...]

c) compute the mean of each (non zero) sequence segment in a) and b)

d) think (and write) a little about what's up with a) and b)

4)  Filtration

a)  yH(n) = (x(n) + x(n-1)) / 2.0

Find | Y/X(ω) |

(This is the magnitude of the Z transform of Y/X
Do Z transform of y as Y(Z) = X(Z)(1-Z-1)
Solve for Y/X, replace Z with ejω,
use Euler's identity for the complex exponential,
compute magnitude as sqrt(Real2 + Imag2)

b) Repeat a, but with
yL(n) = (x(n) - x(n-1)) / 2.0

c) what's up with a) and b)?

5)  Beats Me!!  Type in, compile, and run this code.  What's up??

/****************************************************************/
/*  First done by Risset at Bell Labs  */
/*   From Music, Cognition, and Computerized Sound:
An Introduction to PsychoAcoustics, Perry R. Cook, Editor
MIT Press, January 1999,
The code is Copyright, 1998, Perry R. Cook
#include < math.h>
#include < stdio.h>
#define TWO_PI 6.28318530718
#define SRATE 44100
#include "waveio.h"
#define PEAKMAX 6000

void main()
{
long i,j,k,m,total,harm,freq;
double temp;
double amps[7] = {1.0, 0.5, 0.33, 0.25, 0.166, 0.143, 0.111};
double freqs[7] = {100.0,100.1,100.2,100.3,100.4,100.5,100.6};
short data[256];
FILE *fileOut;
struct soundhdr hdr;

fileOut = opensoundout("rissbeat.wav",&hdr); /* or .snd here */
total = 0;
m = 0;
for (j=0;j<4000;j++)     {
for (k=0;k<256;k++,m++,total++)   {
temp = 0.0;
for (freq=0;freq<7;freq++)   {
for (harm=1;harm<=7;harm++) {
temp += amps[harm-1] * sin(m * TWO_PI *
freqs[freq] * harm / SRATE);
}
}
data[k] = 2000 * temp;
}
fwrite(data,256,2,fileOut);
}
closesoundout(fileOut,total);
exit(0);
}
/***********************************************************************/

Now code it in ChucK.  See how few lines it might take...

6)  Do a 44.1 second musical statement using only convolution.  Use at most
two original soundfiles (but you can convolve them any number of times,
cut them up how you like, reverse them, etc.).  Use no other fancy
tools (you may use Goldwave or other editor for trimming or editing,
but not for any effects).  Name it appropriately (prcAss3.wav) and
place it in your magical assignment place, with a descriptive text
file about what you did, what happened, surprises encountered, etc.

```

Back to Schedule