Files
strudel/examples/minimal-repl/main.js
T
Felix Roos 4a0d9de664 rename repl defaultOutput to onSchedule, error when defaultOutput is
passed. also rename xScheduler to xOutput, to be consistent with
webaudioOutput and friends
2026-10-11 20:54:50 +02:00

24 lines
770 B
JavaScript

import { repl, evalScope } from '@strudel/core';
import { getAudioContext, webaudioOutput, initAudioOnFirstClick, registerSynthSounds } from '@strudel/webaudio';
import { transpiler } from '@strudel/transpiler';
import tune from './tune.mjs';
const ctx = getAudioContext();
const input = document.getElementById('text');
input.innerHTML = tune;
initAudioOnFirstClick();
registerSynthSounds();
evalScope(import('@strudel/core'), import('@strudel/mini'), import('@strudel/webaudio'), import('@strudel/tonal'));
const { evaluate } = repl({
onSchedule: webaudioOutput,
getTime: () => ctx.currentTime,
transpiler,
});
document.getElementById('start').addEventListener('click', () => {
ctx.resume();
console.log('eval', input.value);
evaluate(input.value);
});