diff --git a/docs/dist/App.js b/docs/dist/App.js index 92ad6e4a..2565580f 100644 --- a/docs/dist/App.js +++ b/docs/dist/App.js @@ -4,8 +4,9 @@ import * as strudel from "../_snowpack/link/strudel.js"; import cx from "./cx.js"; import * as Tone from "../_snowpack/pkg/tone.js"; import useCycle from "./useCycle.js"; -import {tetris} from "./tunes.js"; +import * as tunes from "./tunes.js"; import _mini from "./mini.js"; +const {tetris, tetrisMini} = tunes; const {sequence, pure, reify, slowcat, fastcat, cat, stack, silence} = strudel; const mini = _mini; const parse = (code) => eval(code); @@ -17,7 +18,7 @@ synth.set({ } }); function App() { - const [code, setCode] = useState(tetris); + const [code, setCode] = useState(tetrisMini); const [log, setLog] = useState(""); const logBox = useRef(); const [error, setError] = useState(); diff --git a/docs/dist/mini.js b/docs/dist/mini.js index 15b82788..c491801b 100644 --- a/docs/dist/mini.js +++ b/docs/dist/mini.js @@ -1,9 +1,12 @@ import * as krill from "../_snowpack/link/repl/krill-parser.js"; import * as strudel from "../_snowpack/link/strudel.js"; -const {sequence, silence} = strudel; +const {sequence, stack, silence} = strudel; export function patternifyAST(ast) { switch (ast.type_) { case "pattern": + if (ast.arguments_.alignment === "v") { + return stack(...ast.source_.map(patternifyAST)); + } return sequence(...ast.source_.map(patternifyAST)); case "element": if (ast.source_ === "~") { @@ -16,5 +19,9 @@ export function patternifyAST(ast) { } } export default (...strings) => { - return sequence(...strings.map((str) => patternifyAST(krill.parse(`"${str}"`)))); + const pattern = sequence(...strings.map((str) => { + const ast = krill.parse(`"${str}"`); + return patternifyAST(ast); + })); + return pattern; }; diff --git a/docs/dist/tunes.js b/docs/dist/tunes.js index 4d71f41f..95eb653e 100644 --- a/docs/dist/tunes.js +++ b/docs/dist/tunes.js @@ -44,6 +44,7 @@ export const tetris = `stack( ) ) )._slow(16);`; +export const tetrisMini = `mini('[[e5 [b4 c5] d5 [c5 b4]] [a4 [a4 c5] e5 [d5 c5]] [b4 [~ c5] d5 e5] [c5 a4 a4 ~] [[~ d5] [~ f5] a5 [g5 f5]] [e5 [~ c5] e5 [d5 c5]] [b4 [b4 c5] d5 e5] [c5 a4 a4 ~]],[[e2 e3 e2 e3 e2 e3 e2 e3] [a2 a3 a2 a3 a2 a3 a2 a3] [g#2 g#3 g#2 g#3 e2 e3 e2 e3] [a2 a3 a2 a3 a2 a3 b1 c2] [d2 d3 d2 d3 d2 d3 d2 d3] [c2 c3 c2 c3 c2 c3 c2 c3] [b1 b2 b1 b2 e2 e3 e2 e3] [a1 a2 a1 a2 a1 a2 a1 a2]]')._slow(16);`; export const spanish = `slowcat( stack('c4','eb4','g4'), stack('bb3','d4','f4'),