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 No messages -odac -iadc -d ;;;RT audio I/O ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 ; sr= 44100 ; ksmps=128 ; nchnls=2 ;Example by Andres Cabrera 2007 giwidth = 400 giheight = 300 FLpanel "FLmouse", giwidth, giheight, 10, 10 FLpanelEnd FLrun 0dbfs = 1 instr 1 kx, ky, kb1, kb2, kb3 FLmouse 2 ktrig changed kx, ky ;Print only if coordinates have changed printf "kx = %f ky = %f \n", ktrig, kx, ky kfreq = ((giwidth - ky)*1000/giwidth) + 300 ; y coordinate determines frequency, x coordinate determines amplitude ; Left mouse button (kb1) doubles the frequency ; Right mouse button (kb3) activates sound on channel 2 aout oscil kx /giwidth , kfreq * (kb1 + 1), 1 outs aout, aout * kb3 endin f 1 0 1024 10 1 i 1 0 120 e