← Week 6 slides · SD5913

Sound, one layer at a time.

Start with sound you can see

Open the two-second browser sound lab No Python, account or microphone: choose a 220 Hz tone or seeded noise, click Play, inspect the sample graph, and click Stop or press Escape. The page starts silent; set your device volume low before playing. The same instrument appears near the beginning of the slides.

The graph shows the samples sent to the browser audio buffer, not a microphone recording. If listening is uncomfortable or unavailable, compare the tone and noise graphs without pressing Play.

Play, multiply, speak

These three p5 sketches also run inside the HTML slides. Start at low volume; none starts sound or microphone capture on load. The PFAD Week 6 browser folder has the same source and standalone launchers.

  1. Play the keyboard Tap or press 1–8. Can you find the octave above C4? Student source.
  2. Build harmonics Set a base and a multiplier, then compare each tone with their sum. Student source.
  3. Speak to a 3D surface Try DEMO first; MIC asks for permission on localhost or HTTPS and stops on Escape or navigation. It displays frequencies, not words, and stores nothing. Student source.

Slides in PDF/PPTX show stills, not live controls. Denied microphone? Use DEMO or read the changing graph. The microphone sketch never sends audio to a server.

Start in the Strudel editor. Play the existing starter or an instructor-selected example, change one value, then stop it. The four links below each open a complete, cumulative score. Each next link restores the supplied baseline, so save or undo your experiment before adding the next layer.

Start with low device volume. Click Play or use Ctrl+Enter to start/update; click Stop or use Ctrl+. to stop. Stop before switching tabs or returning to the slides. These links never start sound automatically.

Read the small language

setcpm(100/4) gives 25 cycles/minute. Here a cycle is four beats at 100 BPM. *8 repeats eight times; ~ leaves a rest; [c3,e3,g3] places three notes together. stack combines the layers.

First sounds · First notes

1. Hi-hat

Open this stage in Strudel Download score

setcpm(100/4)
stack(
  s("hh*8").gain(.12),
)

2. Add bass

Open this stage in Strudel Download score

setcpm(100/4)
stack(
  s("hh*8").gain(.12),
  note("c2 ~ g2 ~").s("triangle").gain(.15),
)

3. Add chords

Open this stage in Strudel Download score

setcpm(100/4)
stack(
  s("hh*8").gain(.12),
  note("c2 ~ g2 ~").s("triangle").gain(.15),
  note("[c3,e3,g3]").s("sine").gain(.08),
)

4. Add melody

Open this stage in Strudel Download score

setcpm(100/4)
stack(
  s("hh*8").gain(.12),
  note("c2 ~ g2 ~").s("triangle").gain(.15),
  note("[c3,e3,g3]").s("sine").gain(.08),
  note("c4 e4 g4 b4").s("sine").gain(.12),
)

Make one change with an agent

  1. Keep a copy of the four-layer score. Predict a change to rhythm, register, harmony or melody.
  2. In the current Easel client, create a fresh project, then Templates → Strudel sound. Older projects can retain older sample kits.
  3. Paste the complete score, then press Run. Ask the agent: “Change only the melody to feel more spacious. Keep the tempo and other three layers. Explain the edit and preserve my starting version.”
  4. Listen, inspect the code, compare, then Stop or Escape. If the local hi-hat is unavailable, continue in strudel.cc or omit that layer while checking the installed kit.
  5. Keep the before/after score and one sentence about the effect. The native oscillators and bundled drums avoid remote sample banks; their timbre need not match the website.

Verified Easel Strudel workflow · Compatibility and export limits

Source-verified workflow. Check the installed classroom build and audible Run/Stop. Export WAV is a bounded render of supported code, not a recording of every live effect.

Python samples and optional music API

The runnable scripts are in PFAD week06/sound. From that folder, run python noise.py or python tone.py; each writes a two-second WAV in out/ without playing it. The helper stays beside the scripts.

The song API needs a separately configured service for a live request. Students do not need an account for this lesson.

Speech: console to browser to response

Open the separate speech progression. Start with the PFAD Python console transcript, then try the optional local Streamlit WebRTC app with consent. Correct the editable chat input and press Enter; LM Studio replies and Kokoro ONNX speaks the reply. The browser app is not hosted on this static course site; file-based transcription and a written response remain valid fallbacks. CPU is the default for Windows, Macs and AMD; NVIDIA CUDA is optional.

Classroom follow-ups

Quiz: Thursday 22 October 2026. Open-book, multiple choice: 40 questions in 30 minutes. Practise with the existing mock test on Canvas, available through the course page.

Tutorial video: pending the instructor’s exact selection. No assessed questions or answer bank are published here.