Quiz: Audio Synthesis, Oscillators & Envelopes¶
Test your understanding of p5.sound library, oscillators, waveforms, ADSR envelopes, and sound synthesis with these review questions.
1. Why must userStartAudio() be invoked in response to a user gesture (like a button click) in modern web browsers before audio plays?¶
- Modern browsers enforce Autoplay Policies to prevent websites from playing unwanted sound without user interaction
- Because web audio requires downloading a 50MB audio codec on demand
- Because audio cards can only process sound when mouse buttons are held down
- To allow the browser to check the user's audio copyright license
Show Answer
The correct answer is A. Web browsers block audio contexts from starting automatically until the user performs an explicit gesture (click or tap), avoiding jarring unsolicited sound. userStartAudio() initializes the audio hardware. Options B, C, and D are false.
Concept Tested: User Start Audio Policy
2. What type of basic electronic waveform produces a pure, smooth tone with no harmonic overtones?¶
- Sine wave ('sine')
- Square wave ('square')
- Sawtooth wave ('sawtooth')
- Triangle wave ('triangle')
Show Answer
The correct answer is A. A sine wave is a fundamental pure tone containing no additional harmonic frequencies. Square, sawtooth, and triangle waves contain rich odd and even harmonics. Options B, C, and D are harmonically rich waves.
Concept Tested: Sine Wave Oscillator Tone
3. Which waveform contains all integer harmonic frequencies (both odd and even) and produces a bright, buzzy, brassy timbre?¶
- Sine wave ('sine')
- Sawtooth wave ('sawtooth')
- Triangle wave ('triangle')
- Square wave ('square')
Show Answer
The correct answer is B. Sawtooth waves contain all integer harmonics ($1/n$), creating a bright, harsh, buzzy timbre common in synthesizer leads and brass sounds. Square waves only contain odd harmonics. Sine has none. Triangle has weak odd harmonics.
Concept Tested: Sawtooth Harmonic Content
4. What four stages comprise a standard ADSR amplitude envelope in sound synthesis?¶
- Amplitude, Decibel, Sound, Resonance
- Attack, Decay, Sustain, Release
- Audio, Digital, Signal, Rate
- Ascend, Drop, Stabilize, Return
Show Answer
The correct answer is B. ADSR stands for Attack (time to reach peak level), Decay (time to drop to sustain level), Sustain (held volume level), and Release (time to fade to silence after key release). Options B, C, and D are incorrect terms.
Concept Tested: ADSR Envelope Stages
5. Which p5.sound class generates periodic audio waveforms at a specified frequency?¶
- p5.SoundFile
- p5.Oscillator
- p5.AudioIn
- p5.FFT
Show Answer
The correct answer is B. p5.Oscillator([freq], [type]) generates synthesized audio tones at adjustable frequencies and waveforms. p5.SoundFile plays recorded audio files. p5.AudioIn captures microphone input. p5.FFT analyzes spectra.
Concept Tested: p5 Oscillator Class
6. How do you configure an oscillator's pitch to 440 Hz (Concert A) and start audio generation?¶
- let osc = createAudio(440); osc.loop();
- let osc = new p5.Sound('A4'); osc.play();
- let osc = new p5.Oscillator('sine'); osc.freq(440); osc.start();
- let osc = new p5.Envelope(440); osc.trigger();
Show Answer
The correct answer is C. Instantiating new p5.Oscillator('sine'), calling .freq(440), and invoking .start() generates a continuous 440 Hz tone. Options B, C, and D are incorrect syntax.
Concept Tested: Oscillator Frequency Start
7. What does the p5.Envelope class control when connected to an oscillator's amplitude?¶
- It converts audio into 3D WebGL meshes
- It changes the audio pan from left to right
- It shapes the volume dynamics over time (fade-in, sustain, fade-out) when triggered
- It records audio to an MP3 file on disk
Show Answer
The correct answer is C. A p5.Envelope dynamically modulates parameters (typically amplitude or filter cutoff frequency) over time when triggered, creating percussive hits, plucks, or swelling pads. Options B, C, and D are incorrect.
Concept Tested: p5 Envelope Amplitude Control
8. What audio effect simulates acoustic reflections in a physical room or cathedral?¶
- p5.Distortion
- p5.Delay
- p5.Reverb
- p5.Compressor
Show Answer
The correct answer is C. p5.Reverb simulates acoustic space reflections (echo density and decay time) of rooms, halls, or cathedrals. p5.Delay creates discrete echo repeats. Options C and D distort and compress dynamics.
Concept Tested: p5 Reverb Effect
9. To map mouse X-position across the musical frequency spectrum from 200 Hz to 800 Hz, which code is used inside draw()?¶
- let freq = lerp(200, 800, mouseX); osc.freq(freq);
- let freq = mouseX * 800 + 200; osc.pitch(freq);
- let freq = constrain(mouseX, 200, 800); osc.set(freq);
- let freq = map(mouseX, 0, width, 200, 800); osc.freq(freq);
Show Answer
The correct answer is D. map(mouseX, 0, width, 200, 800) smoothly converts horizontal mouse coordinates to frequency values, and osc.freq(freq) updates the synthesizer pitch in real time. Options B, C, and D are incorrect math or method calls.
Concept Tested: Interactive Pitch Mapping
10. Why does Frequency Modulation (FM Synthesis)—where one oscillator modulates the frequency of another audio oscillator—produce complex metallic, bell-like, or harsh timbres?¶
- FM synthesis converts digital audio into analog FM radio waves
- FM synthesis disables anti-aliasing filters on the sound card
- FM synthesis doubles the CPU clock frequency
- Modulating frequency at audio rates creates complex sideband frequencies that enrich the harmonic spectrum
Show Answer
The correct answer is D. When carrier frequency is modulated at audio rates by a modulator oscillator, mathematical Bessel functions produce sideband frequencies on both sides of the carrier, generating rich, metallic, and bell-like timbres. Options B, C, and D are false.
Concept Tested: FM Synthesis Sidebands