220a-spring-2021/hw1

From CCRMA Wiki
Revision as of 11:18, 16 June 2021 by Ge (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Homework #1: Hand-Crafted Digital Audio

Music 220a Spring 2021 | Ge Wang, Matt Wright, Barbara Nerness (TA), and Mike Mulshine (TA)

a woman weaves a colorful pattern using a machine

Due Date

  • 2021.4.13 11:59:59pm, Tuesday


Instructions

(Part 1) Generate several signals in ChucK: impulse, noise, sine, triangle, square waves, modulating pulse widths, with varying envelopes (ADSR etc), with and without low-pass filter (LPF). Bring these into Audacity as WAV files and look at their waveforms (time domain) and spectrograms (time/frequency domain).

a. (1a-noise.ck) Write a ChucK program that continuously generates white noise (Noise). Stop the program manually after a finite period of time.

b. (1b-adsr.ck) Same thing, but apply an amplitude envelope (ADSR) with the following parameters: attack=10ms, decay=40ms, sustain=.5, release=100ms. Do the following in an infinite loop { start the envelope with .keyOn(), then 2::seconds later stop it with .keyOff(), wait for another 2::seconds }. Stop the program manually after a finite period of time.

c. (1c-noise-filtersweep.ck) Write another ChucK program that is the same as (b), but with a LPF whose cutoff frequency is sweeping up and down between 100 to 800 Hz using a loop that is updating the LPF’s .freq parameter every 10::ms; hints: you could use Math.sin() to compute the time-varying cutoff frequencies, but your program can sweep the cutoff frequency with any shape and timing you desire. To perform a smooth sweep between LPF freq values, you may find it useful to either create a while/for loop OR use the Envelope class. If you use the Envelope class, you may need to spork the function that updates the frequency of the LPF.

d. (1d-sine-sweep.ck) Write a ChucK program that generates a sine wave (SinOsc) that sweeps its frequency from 30 to 3000 Hz over 3 seconds smoothly at an time interval of 10::ms

e. (1e-sine-sweep+LPF.ck) Write another ChucK program that is the same as above, but with a LPF whose cutoff frequency is 500 Hz

f. (1f-sqrosc.ck) Next write another ChucK program, same as (e), but with a square wave.

g. (1g-sqrosc-sweep.ck) Next write another ChucK program, like (f), but with the square wave’s frequency constant at 220 Hertz and the LPF frequency sweeping to your taste, along the lines of (c).

h. (1h-q.ck)Same as (g) but increase the LPF’s .Q parameter to at least 3.

i. Using Mini-Audicle’s File->Export feature OR the recording program (rec.ck or rec-auto.ck), record a sound file from each of your eight programs (a) through (h).

j. Open each sound file in Audacity and look at their waveforms (time domain) and spectrograms (time/freq domain).

k. Reflect on what you see: how do these visual representations correspond or not to “what you hear”?

l. Take a screenshot of the one waveform or spectrogram you find most interesting or illuminating. Mention something about it in your written reflection.

m. On your HW1 webpage, include your code from (a)-(h), and your screenshot + reflections from (k) and (l).

(Part 2) Open a digital audio file that’s meaningful to you (e.g., voice mail from a friend/relative) in Audacity and Paulstretch it however you like. Save the output to a wav file.

(Part 3) Make a digital sample “by hand”, writing each successive value (a number between -1.0 and +1.0) in an array. You must put between 25 and 250000 numbers into the array (“your sample must contain at least 25 samples”). (Hint: shorter sounds will be less work.) Record your sample to a wav file. (Hint: you might open the wav file in Audacity and prepare it—make sure it isn’t clipping; trimming out extra silence; boost the volume)

(Part 4) Write a ChucK program to load your generated sample from (3) into a SndBuf and play it at varying amplitudes, rates (=pitch+timbre shift), and timings.

(Part 5) Craft a short musical statement of 30-90 seconds, combining elements from parts 1, 2, and 3/4.

Deliverables

turn in all files by putting them in your 220a CCRMA webpage and submit ONLY your webpage URL to Canvas

Your webpage should include:

  • 1) your hw1 should live at https://ccrma.stanford.edu/~YOURID/220a/hw1
  • 2) ChucK (.ck) files, as applicable, for Parts 1 through 5
  • 3) sound (.wav) files, as applicable, for Parts 1 through 5
  • 4) comments and reflections as you work through the homework
  • 5) notes/title for your short musical statement (Part 5)
  • 6) submit ONLY your webpage URL to Canvas