1import { repl, evalScope } from '@strudel/core';
2import { getAudioContext, webaudioOutput, initAudioOnFirstClick, registerSynthSounds } from '@strudel/webaudio';
3import { transpiler } from '@strudel/transpiler';
4import tune from './tune.mjs';
5
6const ctx = getAudioContext();
7const input = document.getElementById('text');
8input.innerHTML = tune;
9initAudioOnFirstClick();
10registerSynthSounds();
11
12evalScope(import('@strudel/core'), import('@strudel/mini'), import('@strudel/webaudio'), import('@strudel/tonal'));
13
14const { evaluate } = repl({
15  defaultOutput: webaudioOutput,
16  getTime: () => ctx.currentTime,
17  transpiler,
18});
19document.getElementById('start').addEventListener('click', () => {
20  ctx.resume();
21  console.log('eval', input.value);
22  evaluate(input.value);
23});