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 ;;;realtime audio out ;-iadc ;;;uncomment -iadc if realtime audio input is needed too ; For Non-realtime ouput leave only the line below: ; -o gen25.wav -W ;;; for file output any platform ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 ; sr = 44100 ; ksmps = 32 ; nchnls = 2 0dbfs = 1 gisin ftgen 1, 0, 32768, 10, 1 gienv ftgen 2, 0, 1025, 25, 0, 0.01, 200, 1, 400, 1, 513, 0.01 ; y value must be >= 0 instr 1 kcps init 3/p3 ;play 3x over duration of note kndx phasor kcps ixmode = 1 ;normalize to 0-1 kval table kndx, gienv, ixmode kval =kval*100 ;scale up to 0-100 asig poscil 1, 220+kval, gisin ;use table for amplitude outs asig, asig endin i 1 0 4 e