add vite-vanilla-repl-cm6
This commit is contained in:
parent
a035412956
commit
1494cc38fc
13 changed files with 387 additions and 15 deletions
38
packages/core/examples/vite-vanilla-repl-cm6/strudel.js
Normal file
38
packages/core/examples/vite-vanilla-repl-cm6/strudel.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { controls, repl, evalScope } from "@strudel.cycles/core";
|
||||
import { transpiler } from "@strudel.cycles/transpiler";
|
||||
import {
|
||||
getAudioContext,
|
||||
webaudioOutput,
|
||||
initAudioOnFirstClick,
|
||||
registerSynthSounds
|
||||
} from "@strudel.cycles/webaudio";
|
||||
import { registerSoundfonts } from "@strudel.cycles/soundfonts";
|
||||
|
||||
const initAudio = initAudioOnFirstClick();
|
||||
const ctx = getAudioContext();
|
||||
|
||||
const loadModules = (scope = {}) =>
|
||||
evalScope(
|
||||
controls,
|
||||
import("@strudel.cycles/core"),
|
||||
import("@strudel.cycles/mini"),
|
||||
import("@strudel.cycles/tonal"),
|
||||
import("@strudel.cycles/webaudio"),
|
||||
scope
|
||||
);
|
||||
|
||||
export async function initStrudel(options = {}) {
|
||||
await Promise.all([
|
||||
initAudio,
|
||||
loadModules(),
|
||||
registerSynthSounds(),
|
||||
registerSoundfonts()
|
||||
]);
|
||||
|
||||
return repl({
|
||||
defaultOutput: webaudioOutput,
|
||||
getTime: () => ctx.currentTime,
|
||||
transpiler,
|
||||
...options
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue