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 sfplaym.wav -W ;;; for file output any platform ; By Menno Knevel - 2020 ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 ; sr = 44100 ; ksmps = 32 ; nchnls = 2 0dbfs = 1 gisf sfload "07AcousticGuitar.sf2" sfplist gisf sfpassign 100, gisf ;in this case, the number 100 is assigned to the preset instr 1 inum = p4 ivel = p5 kamp linsegr 1, 1, 1, .1, 0 kamp = kamp * .000001 ;scale amplitude- small value due to 0dbfs = 0 a1 sfplaym ivel, inum, kamp * ivel, p6, 100, 1 ; flag = 1 so frequencies is used intead of midi pitch outs a1, a1 endin i1 0 1 60 127 100 ; use sample of this key and set new frequency i1 + 1 62 < < i1 + 1 65 < < i1 + 1 69 10 70 e