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 -odac -M0 ;;;realtime audio out and realtime MIDI in ;-iadc ;;;uncomment -iadc if realtime audio input is needed too ; -o hsboscil_midi.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 ; synth waveform giwave ftgen 1, 0, 1024, 10, 1, 1, 1, 1 ; blending window giblend ftgen 2, 0, 1024, -19, 1, 0.5, 270, 0.5 instr 1 ibase = cpsoct(6) ioctcnt = 5 ; all octaves sound alike. itona octmidi ; velocity is mapped to brightness ibrite ampmidi 4 ; Map an exponential envelope for the amplitude. kenv expon .8, 1, .01 asig hsboscil kenv, itona, ibrite, ibase, giwave, giblend, ioctcnt outs asig, asig endin i 1 0 30 ; play for 30 seconds e