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.
-n ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 instr 1 kA1[] fillarray 0, 1, 2, 3, 4, 5, 6, 7 ; <-- 8 elements printf "lenarray(kA1) before slicearray: %d\n", 1, lenarray:k(kA1) kA1 slicearray kA1, 1, 4 ; <-- 4 elements printf "lenarray(kA1) AFTER slicearray: %d\n", 1, lenarray:k(kA1) trim kA1, 4 printks "kA1 after trim: { ", 0 kCnt = 0 while (kCnt < lenarray:k(kA1)) do printf "%d ", kCnt + 1, kA1[kCnt] kCnt += 1 od printks "}\n", 0 turnoff endin i1 0 0.1 e