This should play if your Web browser has WebAssembly enabled (most do). Most examples will play unless they need to load files. The first time you click Play, Csound will spend a few seconds loading, then play. You can edit this code and replay it.
; Select audio/midi flags here according to platform -odac -M0 -+rtmidi=virtual ;;;realtime audio out with virtual MIDI in ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 ; sr = 44100 ; ksmps = 32 ; nchnls = 2 0dbfs = 1 massign 1, 1 ; set MIDI channel 1 to play instr 1 instr 1 iNum notnum print iNum ; Convert MIDI note number to Hz iHz = (440.0*exp(log(2.0)*((iNum)-69.0)/12.0)) aosc oscil 0.6, iHz, 1 outs aosc, aosc endin f 1 0 16384 10 1 ;sine wave f 0 60 ;play 60 seconds e