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 tempest.wav -W ;;; for file output any platform ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 ; Initialize the global variables. ; sr = 44100 ; kr = 4410 ; ksmps = 10 ; nchnls = 1 ; Instrument #1. instr 1 ; Use the "beats.wav" sound file. asig soundin "beats.wav" ; Extract the pitch and the envelope. kcps, krms pitchamdf asig, 150, 500, 200 iprd = 0.01 imindur = 0.1 imemdur = 3 ihp = 1 ithresh = 30 ihtim = 0.005 ixfdbak = 0.05 istartempo = 110 ifn = 1 ; Estimate its tempo. k1 tempest krms, iprd, imindur, imemdur, ihp, ithresh, ihtim, ixfdbak, istartempo, ifn printk2 k1 out asig endin ; Table #1, a declining line. f 1 0 128 16 1 128 1 ; Play Instrument #1 for two seconds. i 1 0 2 e