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 vmap.wav -W ;;; for file output any platform ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 ; ksmps = 256 ; nchnls = 2 gisize = 64 gitable ftgen 0, 0, gisize, 10, 1 ;Table to be processed gimap1 ftgen 0, 0, gisize, -7, gisize-1, gisize-1, 0 ; Mapping function to reverse table gimap2 ftgen 0, 0, gisize, -5, 1, gisize-1, gisize-1 ; Mapping function for PWM gimap3 ftgen 0, 0, gisize, -7, 1, (gisize/2)-1, gisize-1, 1, 1, (gisize/2)-1, gisize-1 ; Double frequency instr 1 ;Hear an oscillator using gitable asig oscil 10000, 440, gitable outs asig,asig endin instr 2 ;Reverse the table (no sound change, except for a single click vmap gimap1, gitable, gisize vcopy_i gitable, gimap1, gisize turnoff endin instr 3 ;Non-interpolated PWM (or phase waveshaping) vmap gimap2, gitable, gisize vcopy_i gitable, gimap2, gisize turnoff endin instr 4 ;Double frequency vmap gimap3, gitable, gisize vcopy_i gitable, gimap3, gisize turnoff endin i 1 0 8 i 2 2 1 i 3 4 1 i 4 6 1 e