A 32-step NES-style source table reconstructed as a 24-harmonic PeriodicWave is a different audio artifact from the browser's native triangle oscillator. The contrast is audible when both are played as bare oscillator tones at a synced pitch.

  • Native uses the browser's built-in oscillator.type = 'triangle'.
  • NES-style uses a Web Audio PeriodicWave built by createNesTriangleWave from a 32-step NES-style source table, projected onto 24 cosine/sine harmonics with the DC offset removed.

Audio dormant. Click either button to arm and play.

Type
Toy note
Status
Active toy note
Published
2026-04-29
Canonical URL
https://shanecurry.com/lab/toys/triangle-engines/
Related project
ChewGum Animation
Source library
chewgum-dsp v0.1.0

The page shows two buttons. Each click shuts off the current oscillator and sustains the selected source at the current synced note. The note advances after both sources have been heard at that pitch, or after one source is clicked twice successively.

The chewgum-dsp library exists because the NES-style PeriodicWave has a different audible character from the browser's native triangle oscillator. This page is the proof: synced pitch, same sustain path, no filter or effects, only the wave differs.

Source library
chewgum-dsp v0.1.0 (vendored inline on this page)
NES-style wave
32-step source table → 24-harmonic Web Audio PeriodicWave with DC offset removed
Native wave
Browser's built-in oscillator.type = 'triangle'
Playback path
One sustained oscillator into one gain node into the master output; no filters, added sine partials, panning, reverb, or bell synthesis
Master gain
0.34
Pitch set
Random C major diatonic note within one octave: C4, D4, E4, F4, G4, A4, B4, C5
Pitch advancement
The note advances after both native and NES-style sources have been played at the current pitch, or after a single source is clicked twice successively
Stop behavior
Stop shuts off the active oscillator and keeps the current queued note in place
Envelope
15 ms attack, permanent sustain until the next source click cuts over to a new oscillator
  • Library: chewgum-dsp v0.1.0 on GitHub. Source for createNesTriangleWave and midiToFrequency.
  • NES-style PeriodicWave deployed in Dead Beat (bell tones) and Falling Hall (wall-strike chimes).
  • Native triangle oscillator deployed in Phosphor, used here as the contrast point.
  • Implementation note: this page vendors the chewgum-dsp v0.1.0 wave code inline and uses the same sustained tone path for both buttons; the only difference is whether setPeriodicWave receives the NES-style wave.

ChewGum Animation

Shane Curry, "Native Triangle vs. NES-Style Triangle," https://shanecurry.com/lab/toys/triangle-engines/, published 2026-04-29.

The point is to listen before any bell-making gets involved. Same synced pitch, same sustain path. One button uses a 24-harmonic NES-style PeriodicWave; the other uses the browser's native triangle. That is the smallest honest A/B.