1. Show how to use additive synthesis in Csound to create the following periodic audio waveform (only one period shown).

instr 1 a1 oscil 0.814*p4, p5, 1 a2 oscil 0.092*p4, 3*p5, 1 a3 oscil 0.036*p4, 5*p5, 1 a4 = a1 + a2 + a3 out a4 endin f1 0 1024 10 1 ; sine wave in score file
2. Show how to use subtractive synthesis in Csound to create the same waveform. (Hint: Start with pink noise and pass it through a filter for each harmonic.)
instr 2 a1 buzz p4, p5, 5, 2 a2 reson a1, p5, p5/2 a3 reson a1, 3*p5, p5/2 a4 reson a1, 5*p5, p5/2 a5 = 0.814*a2 + 0.092*a3 + 0.036*a4 a6 balance a5, a1 out a6 endin f2 0 1024 10 1
3. A filter is defined such that it has two poles at z = 0.7 e i pi/4 and z = 0.7 e -i pi/4 and two zeroes at z = 1 and z = -1. Use filter.cpp and graph the amplitude and phase response for this filter. Also determine the time equation of the filter from the transfer function output from filter.cpp.
Fraction Amplitude Phase
of SR Response Response
0.000000 0.000000 -6.283185
0.010000 0.252100 -4.776719
0.020000 0.509001 -4.842552
0.030000 0.775580 -4.911475
0.040000 1.056791 -4.985244
0.050000 1.357504 -5.065868
0.060000 1.681993 -5.155673
0.070000 2.032765 -5.257316
0.080000 2.408301 -5.373655
0.090000 2.799335 0.775844
0.100000 3.184244 0.623256
0.110000 3.526561 0.452692
0.120000 3.780627 0.268914
0.130000 3.908842 0.080588
0.140000 3.901220 -0.101915
0.150000 3.779589 -0.269909
0.160000 3.582998 -0.418586
0.170000 3.349463 -0.546953
0.180000 3.106481 -0.656469
0.190000 2.870291 -0.749655
0.200000 2.648863 -0.829208
0.210000 2.445121 -0.897577
0.220000 2.259273 -0.956829
0.230000 2.090226 -1.008645
0.240000 1.936371 -1.054371
0.250000 1.795980 -1.095081
0.260000 1.667399 -1.131628
0.270000 1.549126 -1.164699
0.280000 1.439836 -1.194844
0.290000 1.338376 -1.222512
0.300000 1.243747 -1.248068
0.310000 1.155091 -1.271814
0.320000 1.071665 -1.294001
0.330000 0.992828 -1.314840
0.340000 0.918025 -1.334507
0.350000 0.846771 -1.353156
0.360000 0.778643 -1.370914
0.370000 0.713269 -1.387895
0.380000 0.650319 -1.404195
0.390000 0.589500 -1.419902
0.400000 0.530550 -1.435090
0.410000 0.473230 -1.449828
0.420000 0.417327 -1.464176
0.430000 0.362642 -1.478191
0.440000 0.308994 -1.491921
0.450000 0.256213 -1.505416
0.460000 0.204141 -1.518717
0.470000 0.152626 -1.531867
0.480000 0.101524 -1.544905
0.490000 0.050694 -1.557869
FILTER TRANSFER EQUATION:
1. + -1.000000Z^-2
H(Z) = 1.0 -------------------------------------------
1. + 0.989949Z^-1 + 0.490000Z^-2
Filter equation: y[n] = x[n] - x[n-2] - 0.99y[n-1] -0.49y[n-2]
4. A computer music instrument uses standard frequency modulation to generate an audio signal. The note parameters used are p4 = amplitude, p5 = carrier frequency, p6 = modulating frequency, and p7 = index of modulation. Write a Csound orchestra for this instrument and determine the frequency spectrum for the following note:
i1 0 2.0 10000 440 220 5
instr 4 a1 oscil p6*p7, p6, 1 a2 = a1 * p5 a3 oscil p4, a2, 1 out a3 endin f1 0 1024 10 1 Harmonics: : At 0 Hz, amp = J2(5) At 440 Hz, amp = -J1(5) At 880 Hz, amp = J0(5) At 1320 Hz, amp = J1(5) At 1760 Hz, amp = J2(5) :
5. A computer music instrument uses waveshaping to generate an audio signal by shaping a unit-amplitude cosine waveform at a frequency given by note parameter p5. The transfer function used is F(x) = 1 - 2x2 + x3. The output of the transfer function is then scaled by an amplitude given by note parameter p4. Write a Csound orchestra and score for this example and determine the frequency spectrum for a note played by this instrument.
h0 = 0 h1 = 3/4 h2 = -1 h3 = 1/4 instr 5 a1 oscil 255, p5, 1 a2 = a1 + 256 a3 table a2, 2 a4 = p4 * a3 out a4 endin f1 0 1024 9 1 1 90 ; cosine wave f2 0 512 13 1 1 0 0.75 -1 0.25 ; transfer function based on harmonics of output OR f2 0 512 3 -1 1 1 0 -2 1 ; transfer function based on coefficients of function
COURSE INFORMATION | HOMEWORK ASSIGNMENTS
COURSE PROJECT | CS240 HELP DESK