Hong Kong University of Science and Technology

COMP342: Computer Music

Spring 2008

Midterm Examination

Student Name: key

Student ID:

Instructions:

  1. This is a closed-book, closed-notes examination.
  2. Answer all questions in the space provided.

Question / Score
1 / /4
2 / /6
3 / /6
4 / /4
5 / /4
6 / /6
7 / /6
8 / /5
9 / /4
10 / /10
11 / /4
12 / /4
13 / /8
14 / /8
15 / /7
16 / /7
17 / /7
Total / /100

1. Acoustics [4 marks]

a)Choose the best answer below. (2 marks)
i.If vibrating the whole string will give a tone of certain frequency = f, halving the string length will give a tone of frequency = 0.5f.
ii. If vibrating the whole string will give a tone of certain frequency = f, doubling the string length will give a tone of frequency = 2f.
iii.The frequency of the tone is inversely proportional to the length of the string.
iv.The frequency of the tone is not related to the string length. It is determined by the material of the string.
Answer: iii

b)Which of the below frequencies will not be found in the harmonic series of a given pitch of frequency = f? You may choose more than one answer. (2 marks)
i.3fiii.0.5f
ii.4fiv.4.5f
Answer: iii, iv (must be exactly these two to receive marks)

2. Spectrum Analysis and PVan [6 marks]

a)Choose the best answer below. (2 marks)
i. Spectrum is the relative amplitudes of the harmonics that make up the waveform.
ii. For any periodic waveform, we can find the spectrum of the waveform.
iii. i. and ii. are correct
iv.i. and ii. are wrong
Answer: iii

b)What is Spectrum analysis? Choose the best answer below. (2 marks)
i. Do Fourier transform on a waveform, then isolate one period of the result.
ii. Isolate one period of the waveform, then do Fourier transform on the period.
iii. Just isolate one period of the waveform.
iv. Find the attack time, decay time and pitch of a waveform.
v. All the above are wrong
Answer: ii

c)Choose all the wrong statements below (2marks)
i. Windowing smoothes samples at the window endpoints, when isolating a moment of sound
ii. Windowing extracts half a wave period for Fourier analysis
iii. If we specify an inaccurate user-specified fundamental frequency, the windowing technique will be useless.
iv.All windowing functions are rectangular or square in shape.
Answer: ii, iii and iv (Each statement 0.5 mark)

3. Waveforms [6 marks]

In each of the following cases, write down what is heard; give a brief explanation (in 1-2 sentences) for each.

If you think there is more than one possible answer, list them all.

a) Using a sampling rate of 10000Hz, to sample a sinewave of 6000Hz (2 marks)

Answer: A music tone of 10000 – 6000 = 4000Hz is heard since aliasing occurs.

b) Using a sampling rate of 13010Hz, to sample a sinewave of 6505Hz (2 marks)

Answer: If all sample points fall on zero-crossings, no sound is heard. [1 mark]

Else there will be no aliasing, so a tone of 6505Hz is heard. [1 mark]

c) Using a sampling rate of 9000Hz, to sample a sinewave of 9000Hz (2 marks)

You may give any assumption on your sampling method.

Answer: (Give marks for any one answer with a reasonable explanation)

Nothing can be heard, since a waveform of 0Hz is produced.

A tone of 9000Hz is heard. If the sampler is programmed to produce a sine wave under any situation, hence the simplest sine wave it can estimate is 9000Hz. (but nothing can be heard, if all sample points fall on zero-crossings.)

4. Additive Synthesis [4 marks]

a)What advantage does additive synthesis have over wavetable synthesis on controlling the partials? Explain briefly. (2 marks)
Answer: The frequencies of any partial of additive synthesis can be changed individually. (or any meaningful and correct answers)

b)What disadvantage does additive synthesis have comparing with wavetable synthesis concerning computation time? Please explain briefly. (2 marks)
Answer: Since additive synthesis does computation for each period, it spends much more computation time. Wavetable synthesis only does computation for one period and stores it. (or any meaningful and correct answers)

5. Wavetable Synthesis [4 marks]

Given this wavetable line in a Csound .sco file.
f1 2 8 10 400 800 1200 200 2
Please draw the spectrum of the generated waveform. Make sure you have correct markings for both axes.

Answer:(1 mark for har. 1-4, -1 mark for each extra,-1 mark for each axis error, -half of marks for wrong scale)
Harmonic 1, amp = 0.3333Harmonic 2, amp = 0.6667
Harmonic 3, amp = 1Harmonic 4, amp = 0.1667Harmonic 5, amp = 0.0017

6. FM Synthesis (Parts 1-2) [6 marks]

a)Given these three terms, please arrange them into a meaningful and correct equation. (2 marks)
- Modulation index (index)
- Vibrato width (vibwid)
- Modulation frequency (freqmod)
Answer: vibwid = index * freqmod OR index = vibwid / freqmod

b)As the modulation index increases, will the tone get brighter or duller? Why? (2 marks)
Answer: The tone gets brighter because 1) more high frequency componentsappear OR 2) the spectrum is wider.”vibwid increased” is not sufficient.

c)If an FM instrument has a carrier frequency of 1280Hz and a modulator frequency of 384Hz, what will the fundamental frequency be? (2 marks)
Answer: 128Hz

7. FM Spectra (Part 3) [6 marks]

a)For a simple formant FM instrument with the carrier frequency set to a certain harmonic of a fundamental, the amplitude of which harmonic will depend on sidebands 3 and -13? And what harmonic number is the carrier frequency at? Please show your steps. (4 marks)
Answer:
ak = J(k-nc)(I) - J-(k+nc)(I)
k+nc = 13
k-nc = 3
2k = 16
k = 8
nc = 5
Amplitude of 8th harmonic (a8) is affected, and carrier frequency is at 5th harmonic (nc = 5).
(2 marks for each, deduct half of marks if no steps)

b)There are no negative frequencies, but sometimes when calculating formant FM spectra there will be sidebands with negative frequencies. What will happen to these sidebands? (2 marks)
Answer:
Negative frequencies fold up to corresponding positive harmonic frequencies.

8. Voices [5 marks]

a)Choose ALL the correct answers below (1 mark)
i.Formant is the spectral peak in the amplitude/time graph.
ii.Formant contributes to the color of the voice.
iii.Formant is placed at the fundamental frequency.
Answer: ii

b)Voice A is 100 times larger than voice B in amplitude. What is the decibel difference between them? (2 marks)
Answer: 4020 log10 100 = 40

c)The decibel difference between voice A (the louder voice) and voice B (the softer voice) is 60db. How many times is voice A louder than voice B in terms of amplitude? (2 marks)
Answer: 1000. 20 log10 X = 60, X = 1000

9. Effects, Filters [4 marks]

a)What type of filter would be used to reduce electric hum? (1 mark)
Answer: Band Stop

b)What type of filter would be used to reduce hiss noise? (1 mark)
Answer: Low pass

c)What is the meaning of “cutoff frequency” in a filter? (2 marks)
Answer: The point in the frequency response curve where power is halved (amplitude is sqrt(2)/2 ~71%)

10. Comb Filters, All-pass Filters [10 marks]

Complete the following Csound code, which generates a comb-filtered sound.

  1. Generate the comb filtered part of the output signal.
    Hint: Csound comb filter function:
    [ OutputSignal comb InputSignal, ringTime, loopTime ]
  2. Mix the uncombed and combed parts (the percentage of the uncombed part is: 100% - combedPercent)
  3. Output the mixed signal to soundfile. Reset all global signals to prevent feedback.

* Note: The original music in the score below lasts for 4 seconds. After comb filtering, the length of the output signal will change, and you should account for this.

11. Reverb [4 marks]

a)Imagine you are recording a vocal voice in a studio. Suggest 2 ways to reduce the Reverberation time of the vocal. (2 marks)
Answer: (Give marks to any answer which mark sense / which shows that the student understand what is reverb)
Use better absorption wall.
Use Filter in the mixer
Open the door of the studio

b)Briefly statethe difference between echo and reverb (2 marks)
Answer: If so many reflections arrive at a listener that he or she is unable to distinguish between them, it is reverberation.

12. Amplitude and Meter [4 marks]

Write a tempo statement, where

•At t=0, the tempo is 74bpm, and rise gradually to 92bpm over 6 seconds

•At t=6, it stays at 92bpm for 3 seconds.

•At t=9, it changes to 117bpm suddenly, and stays at 117bpm until t=11.

•At t=11, it changes to 90bpm suddenly, then decrease gradually to 60bpm over 7 seconds

Answer:

t0 74 6 92 9 92 9 117 11 117 11 90 18 60

(t0 74 1 mark, for the rest, each time-tempo pair 0.5 mark)

13. Pitch [8 marks]

a)The fundamental frequency (1st harmonic frequency) of the pitch A2 is 110Hz. What is the frequency and pitch of the 8th harmonic of A2? (4 marks)
(Hints P.S. A2 = 110Hz, A3 = 220Hz)
Answer: Frequency: 880Hz [2 mark], Pitch: A5 [2 marks]

b)What can you hear for a 5Hz signal? Why? (2 marks)
Answer: Clicks in 5Hz. Below 20Hz, we can only hear clicks.

c)What can you hear with a 60000Hz signal? Why? (2 marks)
Answer: Nothing. The human ear can hear frequencies up to about 20000Hz maximum (less as a person gets older).

14. Lab Exercise - Sound Analysis [8 marks]

In this part, you will analyze a real a trumpet tone, and then re-synthesize it.

First, you analyze a real trumpet tone, and here is the result:

AmplitudeFrequencyStart timeDuration

0.25101.92

2010201.98

22430101.99

2786020.011.85

909030.021.7

109120401.8

Write your own trumpet.sco , so that it re-synthesizes the trumpet tone.

f1 0 16385 10 1

;startdurampfreq

i1______

______

______

______

______

______

______

end

Answer:

i101.99224301

i10.011.85278602

i10.021.790903

i101.81091204

(1 mark for st and dur; 3 marks for omitting 51hz/102hz. 2 marks for 301-1204Hz)

What is the fundamental frequency of that real trumpet tone?

Answer: 301Hz (2 marks)

15. Lab Exercise - Vibrato [7 marks]

The following orchestra file implements a simple vibrato instrument with the following features:

  1. The vibrato frequency changes from 0Hz to 3Hz in the first 1/3 of the note, and then from 3Hz to 6Hz in the next 1/3 of the note, and finally from 6Hz to 9Hz to the end.
  2. The vibrato width is 1% of the input frequency

Fill in the blanks below to complete the orchestra file.

sr = 22050
kr = 2205
ksmps = 10
nchnls = 1
;------
instr 1
idur= p3
iamp= p4; p4 controls the amplitude
ifreq= p5; p5 controls fundamental frequency
iwave= 1
aviberlinseg0,idur/3,3,idur/3,6,idur/3,9 ; 3 marks
avibosciliifreq *0.01 ,aviber ,iwave ; 4 marks
asigosciliiamp,ifreq+avib,iwave ; signal
outasig; output
endin

16. Lab Exercise - FM Synthesis [7 marks]

The following code is supposed to generate a FM synthesis tone with fundamental frequency of 440Hz. The tone color we want can be achieved when we use a modulation frequency of 820Hz for a carrier frequency of 615Hz.

Correct all the problems in the file fm.orconly, so that it works as expected.

Answer: (1 mark each, if all correct for these pts extra wrong corrections = -1 mark each)

  1. sr = 22050 OR kr = 4410 OR ksmps = 20
  2. instr 1
  3. icarfr = p5 * 3
  4. imodfr = p5 * 4 (3. and 4. in any parameters of ratio 3:4)
  5. index = p6
  6. iwave = 1 OR change in oscili lines
  7. acaroscili iamp, icarfr+amod, iwave

17. Lab Exercise - Filter [7 marks]

In this part, you have to produce a bandpass filtered voice.

0s – 5s / 5s – 10s
Filter Central Frequency / Rising from 200 Hz to 8000 Hz / Decreasing from 8000Hz to 200Hz
Filter Bandwidth / 1Hz / Rising from 1Hz to 500Hz
  1. The central frequency and bandwidth of the filter is as follows
  2. The Csound bandpass filter function:
    [ outputSignalreson inputSignal, filterFrequency, filterBandwidth, 0 ]

Complete the code below.

;BandPassFilteredVoice.orc

sr = 22050

kr = 2205

ksmps = 10

nchnls = 1

;------

instr 1

idur= p3

iamp= p4

ifreq= p5

aenvlinseg0,.02,iamp,idur-.03,iamp,.01,0

asigosciliaenv,ifreq,1

;Write down your code here

Answer:

kfilterfrlinseg200,5,8000,5,200(2)

kbwlinseg1,5,1,5,500(2)

asigfresonasig,kfilterfr,kbw,0(2)

abalbalanceasigf,asig;can omit this line

outabal(1) or out asigf

endin

END OF PAPER

COMP342 Spring 2008HKUST1 of 17