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 ; Audio out Audio in -odac -iadc ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o sprintfk.wav -W ;;; for file output any platform ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 sr = 48000 ksmps = 16 ; nchnls = 2 0dbfs = 1 ; Example by Jonathan Murphy 2007 instr 1 S1 = "1" S2 = " + 1" ktrig init 0 kval init 2 if (ktrig == 1) then S1 strcatk S1, S2 kval = kval + 1 endif String sprintfk "%s = %d", S1, kval puts String, kval ktrig metro 1 endin i1 0 10 e