Ready.
Code
Ctrl/Cmd+Shift+Space/I ยท Ctrl/Cmd+Space/IMonaco editor is loading. If it cannot load, the fallback textarea stays active.
pg
pgis the main playground helper namespacepg.play("C4", { channel: CH1, duration: 0.2 })plays one notepg.sleep(0.25)waits in secondspg.liveLoop("bass", async () => {})keeps a named loop alivepg.setBpm(120),await pg.beat(1),await pg.nextBeat(),await pg.tween(1, (t) => {})pg.setMasterVolume(1.5),pg.getMasterVolume()await pg.livePrepare("main-fx", async ({ fx }) => ...)reuses prepared live state across runspg.scale("Eb2", "majorPentatonic", 2),pg.chord("B2", "minor")pg.noteToBlockFnum("C4"),pg.noteLerp("B2", "E3", 0.5),pg.lerp(0, 100, 0.5)pg.choose(array),pg.cycle(array),pg.cycle("bass", array)pg.rand(),pg.rrange(0.2, 0.8),pg.randInt(0, 7)pg.stopLoop(name),pg.stopAllLoops(),pg.stopAll()
fm
fmis the rawYM2612Synthlayerawait play("C4")plays one notepg.fmpoints to the same YM2612 layerfm.setPreset(CH1, pg.presets["one-op-basic"])applies one presetfm.setFrequency(CH1, 4, 553),fm.keyOn(CH1),fm.keyOff(CH1)expose the YM2612 note trigger flowfm.write(port, register, value)sends one YM2612 register writefm.writeAddress(port, register),fm.writeData(value)follow the YM2612 address/data flowfm.read(offset),fm.readStatus(),fm.getIrq()expose low-level chip state where available
psg
psgis the raw Sega PSG (SN76489-compatible) layer, mixed into the same output asfmpg.psgpoints to the same PSG layerpg.psgTone(channel, period, attenuation)writes one PSG tone note helper for channel0..2pg.psgNoise(mode, attenuation)writes one PSG noise helper using raw mode0..7psg.write(value)sends one raw PSG register byte (tone/noise/attenuation, same format asdocs/demos/psg.html)psg.reset()resets only PSGpsg.resetAll()resets both PSG and YM2612
fx
fxis the master FX helper layerpg.fxpoints to the same FX helper layerfx.eq(...),fx.filter(...),fx.delay(...),fx.distortion(...),fx.compressor(...),fx.gate(...),fx.wobble(...),fx.flanger(...),fx.reverb(...),fx.slicer(...)fx.setChain([filter, delay])replaces the master FX chaineq.bass.set(...),eq.mid.rampTo(...),eq.treble.set(...)filter.cutoff.set(...),filter.cutoff.rampTo(...)
Note
This first version already includes a small liveLoop()
runtime with shared BPM/beat timing. It is enough to start trying
Sonic Pi style loop ideas on top of YM2612, though hot reload and
safer live coding behavior still need more work.
Shared Playground URLs may include JavaScript source via ?src=.
That source is loaded into the editor and waits for an explicit
Run. During execution, common network APIs are disabled.
This is a small safety guard, not a full security sandbox.
?ex=live-looploads one built-in example by name?src=...loads base64-encoded JavaScript source into the editor?tfi=...&tfi-id=bassloads one URL TFI preset with idbass?tfi=...,...with?tfi-id=a,bloads multiple URL TFI presets