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.
; Prints a table showing the equivalents of all Midi ; note numbers from 0-127 in cycles-per-second, ; octave.decimal, and octave.pitchclass units. ; Select audio/midi flags here according to platform. ; This example produces no audio, so we render in ; non-realtime and turn off sound to disk: -n ; Required settings for WebAudio: sr = 48000 ksmps = 128 nchnls = 2 nchnls_i = 1 instr 1 ; i-time loop to print conversion table imidiNN = 0 loop1: icps = cpsmidinn(imidiNN) ioct = octmidinn(imidiNN) ipch = pchmidinn(imidiNN) print imidiNN, icps, ioct, ipch imidiNN = imidiNN + 1 if (imidiNN < 128) igoto loop1 endin instr 2 ; test k-rate converters kMiddleC = 60 kcps = cpsmidinn(kMiddleC) koct = octmidinn(kMiddleC) kpch = pchmidinn(kMiddleC) printks "%d %f %f %f\n", 1.0, kMiddleC, kcps, koct, kpch endin i1 0 0 i2 0 0.1 e