simplify without-audio example
This commit is contained in:
parent
f9bf2122b7
commit
805bd7e930
1 changed files with 6 additions and 14 deletions
|
|
@ -44,30 +44,22 @@
|
||||||
const input = document.getElementById('text');
|
const input = document.getElementById('text');
|
||||||
|
|
||||||
Promise.all(modules).then(() => {
|
Promise.all(modules).then(() => {
|
||||||
input.innerHTML = getTune();
|
input.innerHTML = `note("<c3 [d3 e3]>").cutoff(1000)`;
|
||||||
|
document.getElementById('start').addEventListener('click', () => {
|
||||||
|
evaluate(input.value);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
evalScope(controls, ...modules);
|
evalScope(controls, ...modules);
|
||||||
|
|
||||||
const { evaluate } = repl({
|
const { evaluate } = repl({
|
||||||
defaultOutput: (...args) => {
|
defaultOutput: (hap, deadline, duration) => {
|
||||||
console.log(args);
|
console.log(deadline, duration, hap.value);
|
||||||
},
|
},
|
||||||
getTime: () => Date.now() / 1000,
|
getTime: () => Date.now() / 1000,
|
||||||
transpiler,
|
transpiler,
|
||||||
beforeEval: (code) => console.log('evaluate', code),
|
beforeEval: (code) => console.log('evaluate', code),
|
||||||
afterEval: (code) => {},
|
afterEval: (code) => {},
|
||||||
});
|
});
|
||||||
document.getElementById('start').addEventListener('click', () => {
|
|
||||||
evaluate(input.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
function getTune() {
|
|
||||||
return `const output = (deadline, hap, now) => {
|
|
||||||
const { whole: { begin, end }, value } = hap;
|
|
||||||
console.log(deadline, begin+0, end+0, value);
|
|
||||||
}
|
|
||||||
note("<c3 [d3 e3]>").cutoff(1000).onTrigger(output)`;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue