mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 05:38:35 +00:00
29 lines
762 B
JavaScript
29 lines
762 B
JavaScript
import { controls, repl, evalScope } from '@strudel/core';
|
|
import { getAudioContext, webaudioOutput, initAudioOnFirstClick } 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();
|
|
|
|
evalScope(
|
|
controls,
|
|
import('@strudel/core'),
|
|
import('@strudel/mini'),
|
|
import('@strudel/webaudio'),
|
|
import('@strudel/tonal'),
|
|
);
|
|
|
|
const { evaluate } = repl({
|
|
defaultOutput: webaudioOutput,
|
|
getTime: () => ctx.currentTime,
|
|
transpiler,
|
|
});
|
|
document.getElementById('start').addEventListener('click', () => {
|
|
ctx.resume();
|
|
console.log('eval', input.value);
|
|
evaluate(input.value);
|
|
});
|