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 greaterequal.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 = 44100 ; ksmps = 1 ; nchnls = 1 ; Instrument #1. instr 1 ; Get the 4th p-field from the score. k1 = p4 ; Is it greater than or equal to 3? (1 = true, 0 = false) k2 = (p4 >= 3 ? 1 : 0) ; Print the values of k1 and k2. printks "k1 = %f, k2 = %f\\n", 1, k1, k2 endin ; Call Instrument #1 with a p4 = 2. i 1 0 0.5 2 ; Call Instrument #1 with a p4 = 3. i 1 1 0.5 3 ; Call Instrument #1 with a p4 = 4. i 1 2 0.5 4 e