The example creates two original pulse clips and complete answer checks. Q1 uses clipA with one pulse; Q2 uses clipB with two. Both last 800 ms. The page generates their PCM WAV bytes locally and supplies user-started playback plus an explicit text-practice route. Script tests check the generated asset size and answer mappings; they do not establish what a listener heard or that playback succeeded on a device.

Define the audio before the question
Each clip uses a 440 Hz tone, mono 16-bit PCM at 16 kHz, with peak amplitude 0.15 and 5 ms ramped edges. clipA has a 100 ms pulse starting at 0; clipB adds a second 100 ms pulse starting at 400 ms. The remaining time is silence. Each 800 ms file contains 12,800 samples and 25,600 sample-data bytes, plus the 44-byte WAV header. These are authored sounds, not music excerpts, recorded learner responses, or a clinical hearing test. Keep the clip ID and source revision with its question/key manifest.
Q1 maps to clipA and option ONE. Q2 maps to clipB and option TWO. Options ONE,TWO,THREE have stable IDs, regardless of display order. Selecting Q2 changes both sound and key, clears the old response and retires old playback status. A swapped clip with an unchanged key is an authoring defect, not evidence that a learner answered incorrectly. Keep actual sound review and question acceptance together when you later revise either pulse specification or response wording.
Let playback report its own outcome
The page starts no sound automatically. Use Play at a low default volume or the visible native controls. A play request begins pending; resolution reports started, while a rejection reports failure and holds listening-mode checking. A started or ended clip does not prove it was heard or understood. The implementation ties its play outcome to the current question generation, so a late callback from the previous clip cannot enable listening-mode checking for the newly selected question.
Switching questions pauses the old media and assigns the new generated source. Native playing and error events update media state separately from answer state. Each source change explicitly resets playback to not started before a new play request. Blank selection remains incomplete. Repeated Check does not accumulate points; it simply reports the current submitted option against the active manifest. Do not turn a missing sound into an automatic wrong answer or zero. Actual browser playback, decoding, volume perception and device behavior need their own observations, distinct from deterministic generation and answer-check tests.
Label the text route honestly
Text practice displays the pulse intervals directly: Q1 one pulse at 0 to 100 ms, Q2 two at 0 to 100 ms and 400 to 500 ms. It permits the same fixed-answer check without claiming a listening-performance result. A participant counting described pulses is doing a different task from counting heard pulses. Keep that route available for review and teaching choices, and have the teacher decide the appropriate learning objective and supports before use. Do not claim accessibility compliance merely because the alternative exists.
End by tracing question ID to actual clip and key. Retain source generation settings, asset revision, observed playback and submitted answer separately in any native records. The page is current-session practice without a gradebook or response storage. Before classroom use, listen to the finished clips and check the chosen devices; keep those observations beside the byte specification rather than inferring audibility from the existence of a WAV data URI.
Make your own working example
Build an original two-question pulse quiz. Generate real mono PCM 16 WAV data at 16000 Hz, duration 800 ms, amplitude 0.15, 440 Hz tone with 5 ms ramps. clipA pulse 0-100 ms; clipB pulses 0-100 and 400-500 ms. Each has 12800 samples and 25644 total bytes including 44-byte header. Use data URIs, no remote sound.
Map Q1/clipA/key ONE and Q2/clipB/key TWO. Provide question buttons, user-started Play, visible native audio controls that fit the available width with low initial volume, ONE/TWO/THREE choices, Check, Text practice, Listening mode and Reset. No autoplay. Switching stops old media, clears selection/result and retires old asynchronous play outcomes using a generation token.
Listening checks require playback started; play rejection or media error holds rather than grading wrong. Blank selection is incomplete and repeated Check never accumulates points. Text practice exposes the pulse intervals and labels its results as text practice, not equivalent listening evidence. Show question/clip IDs and generated byte size. Keep generation tests distinct from actual audibility, native playback and accessibility checks; no saved results or clinical claims.
Use one self-contained HTML file with no remote dependency. Keep the initial sample, output, and labeled controls near the top. Use at least 16px text, strong contrast, visible focus, and a stacked layout at 360px without horizontal overflow. Use explicit type=button click handlers and explicit DOM selectors; do not depend on native form submission. Clear stale feedback when task inputs change. Render entered text safely. Keep practice data local to the current page; do not imply saving, sending, or production integration. Return only the finished HTML.
Clarify the mode before the next lesson
Keep sound specifications and actual playback observations with the quiz source. For an HTML explanation, NOS allows eligible static instructions to be revised visually without AI regeneration. Clarify whether a group is using text practice or listening before interpreting its responses.