10 NES BASIC PROGRAMMING GUIDE
Sound and short melodies
BEEP plays a short note on pulse channel one. SOUND channel,pitch,duration starts or replaces a voice asynchronously. Channels 1/2 are pulse, 3 triangle, 4 noise. Tonal notes are integers 33–96 using MIDI note numbering as a convention: 60 is C4, 64 E4, 67 G4 and 69 A4. No MIDI device is required. Noise pitch is a hardware period index 0–15 rather than a musical note.
Duration is 0–32767 emulated frames. Zero mutes that voice, but its channel and pitch must still be valid. SOUND followed by WAIT makes notes sequential. Other BASIC statements add their own frame cost, so this is a simple sequencer, not an exact wall-clock audio workstation. The target is NTSC; PAL retuning is not part of this language edition.
10 SOUND 1,60,20
20 WAIT 20
30 SOUND 1,64,20
40 WAIT 20
50 SOUND 1,67,30
60 WAIT 30
70 ENDThis plays three notes and ends after their waits. Separate channels can form a chord. Voices have fixed amplitudes; there is no volume argument, music-string language or DMC/sample playback API. Normal source completion lets finite tones finish; END/STOP, errors, break, NEW/RUN and sprite-editor entry silence them. Pausing freezes emulation and can preserve a remaining note until resume.
In the browser, select Sound off in the playground toolbar to enable audio after a user gesture. Check device volume and the output route. In the iOS app, also check silent mode and VIDEO / AUDIO settings. Changing an audio route can pause the app.