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 ; For Non-realtime ouput leave only the line below: ; -o outch.wav -W ;;; for file output any platform ; By Stefano Cucchi - 2020 ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 ; sr = 44100 ; ksmps = 32 ; nchnls = 2 0dbfs = 1 instr 1 asig vco2 0.2, 100 ; Audio signal. kout randomh 1, 2, 5 ; Extracts random number between 1 & 2 - 5 times per second. outch kout,asig ; Sends the signal to the channel according to "kout". printks "signal is sent to channel %d\\n", .2, kout ; Prints the channel where you hear the sound. endin i 1 0 15 e