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.
; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 ; sr = 44100 ; ksmps = 128 ; nchnls = 2 0dbfs = 1.0 instr 1 ; smooth a krate signal kx = floor(line(0, p3, 10)) kx2 = lag(kx, 0.1) printk2 kx2 endin instr 2 ; smooth an audio signal kmidi = floor(line(60, p3, 72)/2)*2 afreq = upsamp(mtof(kmidi)) afreqsmooth = lag(afreq, 1) a1 = oscili(1, afreq) a2 = oscili(1, afreqsmooth) outch 1, a1 outch 2, a2 endin i 1 0 5 i 2 0 10