build
This commit is contained in:
parent
f6be175af0
commit
413d401567
14 changed files with 873 additions and 471 deletions
19
docs/dist/App.js
vendored
19
docs/dist/App.js
vendored
|
|
@ -1,6 +1,6 @@
|
|||
import React, {useCallback, useLayoutEffect, useMemo, useRef, useState} from "../_snowpack/pkg/react.js";
|
||||
import React, {useCallback, useLayoutEffect, useRef, useState} from "../_snowpack/pkg/react.js";
|
||||
import * as Tone from "../_snowpack/pkg/tone.js";
|
||||
import CodeMirror from "./CodeMirror.js";
|
||||
import CodeMirror, {markEvent} from "./CodeMirror.js";
|
||||
import cx from "./cx.js";
|
||||
import {evaluate} from "./evaluate.js";
|
||||
import logo from "./logo.svg.proxy.js";
|
||||
|
|
@ -29,20 +29,10 @@ function getRandomTune() {
|
|||
const randomTune = getRandomTune();
|
||||
function App() {
|
||||
const [editor, setEditor] = useState();
|
||||
const doc = useMemo(() => editor?.getDoc(), [editor]);
|
||||
const {setCode, setPattern, error, code, cycle, dirty, log, togglePlay, activateCode, pattern, pushLog} = useRepl({
|
||||
tune: decoded || randomTune,
|
||||
defaultSynth,
|
||||
onEvent: useCallback((event) => {
|
||||
const locs = event.value.locations;
|
||||
if (!locs) {
|
||||
return;
|
||||
}
|
||||
const marks = locs.map(({start, end}) => doc.markText({line: start.line - 1, ch: start.column}, {line: end.line - 1, ch: end.column}, {css: "background-color: gray;"}));
|
||||
setTimeout(() => {
|
||||
marks.forEach((mark) => mark.clear());
|
||||
}, event.duration * 0.9 * 1e3);
|
||||
}, [doc])
|
||||
onEvent: useCallback(markEvent(editor), [editor])
|
||||
});
|
||||
const logBox = useRef();
|
||||
useLayoutEffect(() => {
|
||||
|
|
@ -112,7 +102,8 @@ function App() {
|
|||
mode: "javascript",
|
||||
theme: "material",
|
||||
lineNumbers: true,
|
||||
styleSelectedText: true
|
||||
styleSelectedText: true,
|
||||
cursorBlinkRate: 0
|
||||
},
|
||||
onChange: (_2, __, value) => setCode(value)
|
||||
}), /* @__PURE__ */ React.createElement("span", {
|
||||
|
|
|
|||
15
docs/dist/CodeMirror.js
vendored
15
docs/dist/CodeMirror.js
vendored
|
|
@ -2,14 +2,15 @@ import React from "../_snowpack/pkg/react.js";
|
|||
import {Controlled as CodeMirror2} from "../_snowpack/pkg/react-codemirror2.js";
|
||||
import "../_snowpack/pkg/codemirror/mode/javascript/javascript.js";
|
||||
import "../_snowpack/pkg/codemirror/mode/pegjs/pegjs.js";
|
||||
import "../_snowpack/pkg/codemirror/theme/material.css.proxy.js";
|
||||
import "../_snowpack/pkg/codemirror/lib/codemirror.css.proxy.js";
|
||||
import "../_snowpack/pkg/codemirror/theme/material.css.proxy.js";
|
||||
export default function CodeMirror({value, onChange, options, editorDidMount}) {
|
||||
options = options || {
|
||||
mode: "javascript",
|
||||
theme: "material",
|
||||
lineNumbers: true,
|
||||
styleSelectedText: true
|
||||
styleSelectedText: true,
|
||||
cursorBlinkRate: 500
|
||||
};
|
||||
return /* @__PURE__ */ React.createElement(CodeMirror2, {
|
||||
value,
|
||||
|
|
@ -18,3 +19,13 @@ export default function CodeMirror({value, onChange, options, editorDidMount}) {
|
|||
editorDidMount
|
||||
});
|
||||
}
|
||||
export const markEvent = (editor) => (event) => {
|
||||
const locs = event.value.locations;
|
||||
if (!locs || !editor) {
|
||||
return;
|
||||
}
|
||||
const marks = locs.map(({start, end}) => editor.getDoc().markText({line: start.line - 1, ch: start.column}, {line: end.line - 1, ch: end.column}, {css: "background-color: #FFCA28; color: black"}));
|
||||
setTimeout(() => {
|
||||
marks.forEach((mark) => mark.clear());
|
||||
}, event.duration * 0.9 * 1e3);
|
||||
};
|
||||
|
|
|
|||
12
docs/dist/evaluate.js
vendored
12
docs/dist/evaluate.js
vendored
|
|
@ -27,10 +27,12 @@ export const evaluate = (code) => {
|
|||
if (typeof evaluated === "function") {
|
||||
evaluated = evaluated();
|
||||
}
|
||||
const pattern = minify(evaluated);
|
||||
if (pattern?.constructor?.name !== "Pattern") {
|
||||
const message = `got "${typeof pattern}" instead of pattern`;
|
||||
throw new Error(message + (typeof pattern === "function" ? ", did you forget to call a function?" : "."));
|
||||
if (typeof evaluated === "string") {
|
||||
evaluated = strudel.withLocationOffset(minify(evaluated), {start: {line: 1, column: -1}});
|
||||
}
|
||||
return {mode: "javascript", pattern};
|
||||
if (evaluated?.constructor?.name !== "Pattern") {
|
||||
const message = `got "${typeof evaluated}" instead of pattern`;
|
||||
throw new Error(message + (typeof evaluated === "function" ? ", did you forget to call a function?" : "."));
|
||||
}
|
||||
return {mode: "javascript", pattern: evaluated};
|
||||
};
|
||||
|
|
|
|||
137
docs/dist/shapeshifter.js
vendored
137
docs/dist/shapeshifter.js
vendored
|
|
@ -1,7 +1,13 @@
|
|||
import { parseScriptWithLocation } from './shift-parser/index.js'; // npm module does not work in the browser
|
||||
import traverser from './shift-traverser/index.js'; // npm module does not work in the browser
|
||||
const { replace } = traverser;
|
||||
import { LiteralStringExpression, IdentifierExpression, CallExpression, StaticMemberExpression } from '../_snowpack/pkg/shift-ast.js';
|
||||
import {
|
||||
LiteralStringExpression,
|
||||
IdentifierExpression,
|
||||
CallExpression,
|
||||
StaticMemberExpression,
|
||||
Script,
|
||||
} from '../_snowpack/pkg/shift-ast.js';
|
||||
import codegen from '../_snowpack/pkg/shift-codegen.js';
|
||||
import * as strudel from '../_snowpack/link/strudel.js';
|
||||
|
||||
|
|
@ -12,20 +18,50 @@ const isNote = (name) => /^[a-gC-G][bs]?[0-9]$/.test(name);
|
|||
const addLocations = true;
|
||||
export const addMiniLocations = true;
|
||||
|
||||
/*
|
||||
not supported for highlighting:
|
||||
- 'b3'.p
|
||||
- mini('b3') / m('b3')
|
||||
- 'b3'.m / 'b3'.mini
|
||||
*/
|
||||
|
||||
export default (code) => {
|
||||
const ast = parseScriptWithLocation(code);
|
||||
const nodesWithLocation = [];
|
||||
const artificialNodes = [];
|
||||
const parents = [];
|
||||
const shifted = replace(ast.tree, {
|
||||
enter(node, parent) {
|
||||
parents.push(parent);
|
||||
const isSynthetic = parents.some((p) => nodesWithLocation.includes(p));
|
||||
const isSynthetic = parents.some((p) => artificialNodes.includes(p));
|
||||
if (isSynthetic) {
|
||||
return node;
|
||||
}
|
||||
const grandparent = parents[parents.length - 2];
|
||||
const isTimeCat = parent?.type === 'ArrayExpression' && isPatternFactory(grandparent);
|
||||
const isMarkable = isPatternFactory(parent) || isTimeCat;
|
||||
|
||||
// replace template string `xxx` with 'xxx'.m
|
||||
if (isBackTickString(node)) {
|
||||
const minified = getMinified(node.elements[0].rawValue);
|
||||
return wrapLocationOffset(minified, node, ast.locations, artificialNodes);
|
||||
}
|
||||
|
||||
// allows to use top level strings, which are normally directives... but we don't need directives
|
||||
if (node.type === 'Script' && node.directives.length === 1 && !node.statements.length) {
|
||||
const minified = getMinified(node.directives[0].rawValue);
|
||||
const wrapped = wrapLocationOffset(minified, node.directives[0], ast.locations, artificialNodes);
|
||||
return new Script({ directives: [], statements: [wrapped] });
|
||||
}
|
||||
|
||||
// replace double quote string "xxx" with 'xxx'.m
|
||||
if (isStringWithDoubleQuotes(node, ast.locations, code)) {
|
||||
const minified = getMinified(node.value);
|
||||
return wrapLocationOffset(minified, node, ast.locations, artificialNodes);
|
||||
}
|
||||
|
||||
// replace double quote string "xxx" with 'xxx'.m
|
||||
if (isStringWithDoubleQuotes(node, ast.locations, code)) {
|
||||
const minified = getMinified(node.value);
|
||||
return wrapLocationOffset(minified, node, ast.locations, artificialNodes);
|
||||
}
|
||||
|
||||
// operator overloading => still not done
|
||||
const operators = {
|
||||
'*': 'fast',
|
||||
|
|
@ -41,22 +77,28 @@ export default (code) => {
|
|||
) {
|
||||
let arg = node.left;
|
||||
if (node.left.type === 'IdentifierExpression') {
|
||||
arg = wrapReify(node.left);
|
||||
arg = wrapFunction('reify', node.left);
|
||||
}
|
||||
return new CallExpression({
|
||||
callee: new StaticMemberExpression({
|
||||
property: operators[node.operator],
|
||||
object: wrapReify(arg),
|
||||
object: wrapFunction('reify', arg),
|
||||
}),
|
||||
arguments: [node.right],
|
||||
});
|
||||
}
|
||||
|
||||
const isMarkable = isPatternArg(parents) || hasModifierCall(parent);
|
||||
// add to location to pure(x) calls
|
||||
if (node.type === 'CallExpression' && node.callee.name === 'pure') {
|
||||
return reifyWithLocation(node.arguments[0].name, node.arguments[0], ast.locations, artificialNodes);
|
||||
}
|
||||
// replace pseudo note variables
|
||||
if (node.type === 'IdentifierExpression') {
|
||||
if (isNote(node.name)) {
|
||||
const value = node.name[1] === 's' ? node.name.replace('s', '#') : node.name;
|
||||
if (addLocations && isMarkable) {
|
||||
return reifyWithLocation(value, node, ast.locations, nodesWithLocation);
|
||||
return reifyWithLocation(value, node, ast.locations, artificialNodes);
|
||||
}
|
||||
return new LiteralStringExpression({ value });
|
||||
}
|
||||
|
|
@ -66,10 +108,10 @@ export default (code) => {
|
|||
}
|
||||
if (addLocations && node.type === 'LiteralStringExpression' && isMarkable) {
|
||||
// console.log('add', node);
|
||||
return reifyWithLocation(node.value, node, ast.locations, nodesWithLocation);
|
||||
return reifyWithLocation(node.value, node, ast.locations, artificialNodes);
|
||||
}
|
||||
if (!addMiniLocations) {
|
||||
return node;
|
||||
return wrapFunction('reify', node);
|
||||
}
|
||||
// mini notation location handling
|
||||
const miniFunctions = ['mini', 'm'];
|
||||
|
|
@ -81,11 +123,11 @@ export default (code) => {
|
|||
console.warn('multi arg mini locations not supported yet...');
|
||||
return node;
|
||||
}
|
||||
return wrapLocationOffset(node, node.arguments, ast.locations, nodesWithLocation);
|
||||
return wrapLocationOffset(node, node.arguments, ast.locations, artificialNodes);
|
||||
}
|
||||
if (node.type === 'StaticMemberExpression' && miniFunctions.includes(node.property) && !isAlreadyWrapped) {
|
||||
// 'c3'.mini or 'c3'.m
|
||||
return wrapLocationOffset(node, node.object, ast.locations, nodesWithLocation);
|
||||
return wrapLocationOffset(node, node.object, ast.locations, artificialNodes);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
|
@ -96,15 +138,58 @@ export default (code) => {
|
|||
return codegen(shifted);
|
||||
};
|
||||
|
||||
function wrapReify(node) {
|
||||
function wrapFunction(name, ...args) {
|
||||
return new CallExpression({
|
||||
callee: new IdentifierExpression({
|
||||
name: 'reify',
|
||||
}),
|
||||
arguments: [node],
|
||||
callee: new IdentifierExpression({ name }),
|
||||
arguments: args,
|
||||
});
|
||||
}
|
||||
|
||||
function getMinified(value) {
|
||||
return new StaticMemberExpression({
|
||||
object: new LiteralStringExpression({ value }),
|
||||
property: 'm',
|
||||
});
|
||||
}
|
||||
|
||||
function isBackTickString(node) {
|
||||
return node.type === 'TemplateExpression' && node.elements.length === 1;
|
||||
}
|
||||
|
||||
function isStringWithDoubleQuotes(node, locations, code) {
|
||||
if (node.type !== 'LiteralStringExpression') {
|
||||
return false;
|
||||
}
|
||||
const loc = locations.get(node);
|
||||
const snippet = code.slice(loc.start.offset, loc.end.offset);
|
||||
return snippet[0] === '"'; // we can trust the end is also ", as the parsing did not fail
|
||||
}
|
||||
|
||||
// returns true if the given parents belong to a pattern argument node
|
||||
// this is used to check if a node should receive a location for highlighting
|
||||
function isPatternArg(parents) {
|
||||
if (!parents.length) {
|
||||
return false;
|
||||
}
|
||||
const ancestors = parents.slice(0, -1);
|
||||
const parent = parents[parents.length - 1];
|
||||
if (isPatternFactory(parent)) {
|
||||
return true;
|
||||
}
|
||||
if (parent?.type === 'ArrayExpression') {
|
||||
return isPatternArg(ancestors);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasModifierCall(parent) {
|
||||
// TODO: modifiers are more than composables, for example every is not composable but should be seen as modifier..
|
||||
// need all prototypes of Pattern
|
||||
return (
|
||||
parent?.type === 'StaticMemberExpression' && Object.keys(Pattern.prototype.composable).includes(parent.property)
|
||||
);
|
||||
}
|
||||
|
||||
function isPatternFactory(node) {
|
||||
return node?.type === 'CallExpression' && Object.keys(Pattern.prototype.factories).includes(node.callee.name);
|
||||
}
|
||||
|
|
@ -115,7 +200,7 @@ function canBeOverloaded(node) {
|
|||
}
|
||||
|
||||
// turn node into withLocationOffset(node, location)
|
||||
function wrapLocationOffset(node, stringNode, locations, nodesWithLocation) {
|
||||
function wrapLocationOffset(node, stringNode, locations, artificialNodes) {
|
||||
// console.log('wrapppp', stringNode);
|
||||
const expression = {
|
||||
type: 'CallExpression',
|
||||
|
|
@ -125,28 +210,22 @@ function wrapLocationOffset(node, stringNode, locations, nodesWithLocation) {
|
|||
},
|
||||
arguments: [node, getLocationObject(stringNode, locations)],
|
||||
};
|
||||
nodesWithLocation.push(expression);
|
||||
artificialNodes.push(expression);
|
||||
// console.log('wrapped', codegen(expression));
|
||||
return expression;
|
||||
}
|
||||
|
||||
// turns node in reify(value).withLocation(location), where location is the node's location in the source code
|
||||
// with this, the reified pattern can pass its location to the event, to know where to highlight when it's active
|
||||
function reifyWithLocation(value, node, locations, nodesWithLocation) {
|
||||
// console.log('reifyWithLocation', value, node);
|
||||
function reifyWithLocation(value, node, locations, artificialNodes) {
|
||||
const withLocation = new CallExpression({
|
||||
callee: new StaticMemberExpression({
|
||||
object: new CallExpression({
|
||||
callee: new IdentifierExpression({
|
||||
name: 'reify',
|
||||
}),
|
||||
arguments: [new LiteralStringExpression({ value })],
|
||||
}),
|
||||
object: wrapFunction('reify', new LiteralStringExpression({ value })),
|
||||
property: 'withLocation',
|
||||
}),
|
||||
arguments: [getLocationObject(node, locations)],
|
||||
});
|
||||
nodesWithLocation.push(withLocation);
|
||||
artificialNodes.push(withLocation);
|
||||
return withLocation;
|
||||
}
|
||||
|
||||
|
|
|
|||
326
docs/dist/tunes.js
vendored
326
docs/dist/tunes.js
vendored
|
|
@ -1,7 +1,7 @@
|
|||
export const timeCatMini = `stack(
|
||||
'c3@3 [eb3, g3, [c4 d4]/2]'.mini,
|
||||
'c2 g2'.mini,
|
||||
'[eb4@5 [f4 eb4 d4]@3] [eb4 c4]/2'.mini.slow(8)
|
||||
"c3@3 [eb3, g3, [c4 d4]/2]",
|
||||
"c2 g2",
|
||||
"[eb4@5 [f4 eb4 d4]@3] [eb4 c4]/2".slow(8)
|
||||
)`;
|
||||
export const timeCat = `stack(
|
||||
timeCat([3, c3], [1, stack(eb3, g3, cat(c4, d4).slow(2))]),
|
||||
|
|
@ -54,47 +54,47 @@ export const tetrisWithFunctions = `stack(sequence(
|
|||
)
|
||||
).slow(16)`;
|
||||
export const tetris = `stack(
|
||||
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 ~'
|
||||
cat(
|
||||
"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 ~"
|
||||
),
|
||||
mini(
|
||||
'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'
|
||||
cat(
|
||||
"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 tetrisRev = `stack(
|
||||
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 ~'
|
||||
cat(
|
||||
"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 ~",
|
||||
).rev(),
|
||||
mini(
|
||||
'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'
|
||||
cat(
|
||||
"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",
|
||||
).rev()
|
||||
).slow(16)`;
|
||||
export const tetrisMini = `\`[[e5 [b4 c5] d5 [c5 b4]]
|
||||
|
|
@ -112,7 +112,7 @@ export const tetrisMini = `\`[[e5 [b4 c5] d5 [c5 b4]]
|
|||
[[d2 d3]*4]
|
||||
[[c2 c3]*4]
|
||||
[[b1 b2]*2 [e2 e3]*2]
|
||||
[[a1 a2]*4]\`.mini.slow(16)
|
||||
[[a1 a2]*4]\`.slow(16)
|
||||
`;
|
||||
export const spanish = `slowcat(
|
||||
stack(c4,eb4,g4),
|
||||
|
|
@ -126,117 +126,117 @@ export const whirlyStrudel = `sequence(e4, [b2, b3], c4)
|
|||
.fast(slowcat(1.25, 1, 1.5))
|
||||
.every(2, _ => sequence(e4, r, e3, d4, r))`;
|
||||
export const swimming = `stack(
|
||||
mini(
|
||||
'~',
|
||||
'~',
|
||||
'~',
|
||||
'A5 [F5@2 C5] [D5@2 F5] F5',
|
||||
'[C5@2 F5] [F5@2 C6] A5 G5',
|
||||
'A5 [F5@2 C5] [D5@2 F5] F5',
|
||||
'[C5@2 F5] [Bb5 A5 G5] F5@2',
|
||||
'A5 [F5@2 C5] [D5@2 F5] F5',
|
||||
'[C5@2 F5] [F5@2 C6] A5 G5',
|
||||
'A5 [F5@2 C5] [D5@2 F5] F5',
|
||||
'[C5@2 F5] [Bb5 A5 G5] F5@2',
|
||||
'A5 [F5@2 C5] A5 F5',
|
||||
'Ab5 [F5@2 Ab5] G5@2',
|
||||
'A5 [F5@2 C5] A5 F5',
|
||||
'Ab5 [F5@2 C5] C6@2',
|
||||
'A5 [F5@2 C5] [D5@2 F5] F5',
|
||||
'[C5@2 F5] [Bb5 A5 G5] F5@2'
|
||||
cat(
|
||||
"~",
|
||||
"~",
|
||||
"~",
|
||||
"A5 [F5@2 C5] [D5@2 F5] F5",
|
||||
"[C5@2 F5] [F5@2 C6] A5 G5",
|
||||
"A5 [F5@2 C5] [D5@2 F5] F5",
|
||||
"[C5@2 F5] [Bb5 A5 G5] F5@2",
|
||||
"A5 [F5@2 C5] [D5@2 F5] F5",
|
||||
"[C5@2 F5] [F5@2 C6] A5 G5",
|
||||
"A5 [F5@2 C5] [D5@2 F5] F5",
|
||||
"[C5@2 F5] [Bb5 A5 G5] F5@2",
|
||||
"A5 [F5@2 C5] A5 F5",
|
||||
"Ab5 [F5@2 Ab5] G5@2",
|
||||
"A5 [F5@2 C5] A5 F5",
|
||||
"Ab5 [F5@2 C5] C6@2",
|
||||
"A5 [F5@2 C5] [D5@2 F5] F5",
|
||||
"[C5@2 F5] [Bb5 A5 G5] F5@2"
|
||||
),
|
||||
mini(
|
||||
'[F4,Bb4,D5] [[D4,G4,Bb4]@2 [Bb3,D4,F4]] [[G3,C4,E4]@2 [[Ab3,F4] [A3,Gb4]]] [Bb3,E4,G4]',
|
||||
'[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, Bb3, Db3] [F3, Bb3, Db3]]',
|
||||
'[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]',
|
||||
'[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]',
|
||||
'[~ [A3, C4, E4] [A3, C4, E4]] [~ [Ab3, C4, Eb4] [Ab3, C4, Eb4]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [G3, C4, E4] [G3, C4, E4]]',
|
||||
'[~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]',
|
||||
'[~ [F3, Bb3, D4] [F3, Bb3, D4]] [~ [F3, Bb3, C4] [F3, Bb3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]]',
|
||||
'[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]',
|
||||
'[~ [A3, C4, E4] [A3, C4, E4]] [~ [Ab3, C4, Eb4] [Ab3, C4, Eb4]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [G3, C4, E4] [G3, C4, E4]]',
|
||||
'[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]',
|
||||
'[~ [F3, Bb3, D4] [F3, Bb3, D4]] [~ [F3, Bb3, C4] [F3, Bb3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]]',
|
||||
'[~ [Bb3, D3, F4] [Bb3, D3, F4]] [~ [Bb3, D3, F4] [Bb3, D3, F4]] [~ [A3, C4, F4] [A3, C4, F4]] [~ [A3, C4, F4] [A3, C4, F4]]',
|
||||
'[~ [Ab3, B3, F4] [Ab3, B3, F4]] [~ [Ab3, B3, F4] [Ab3, B3, F4]] [~ [G3, Bb3, F4] [G3, Bb3, F4]] [~ [G3, Bb3, E4] [G3, Bb3, E4]]',
|
||||
'[~ [Bb3, D3, F4] [Bb3, D3, F4]] [~ [Bb3, D3, F4] [Bb3, D3, F4]] [~ [A3, C4, F4] [A3, C4, F4]] [~ [A3, C4, F4] [A3, C4, F4]]',
|
||||
'[~ [Ab3, B3, F4] [Ab3, B3, F4]] [~ [Ab3, B3, F4] [Ab3, B3, F4]] [~ [G3, Bb3, F4] [G3, Bb3, F4]] [~ [G3, Bb3, E4] [G3, Bb3, E4]]',
|
||||
'[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]',
|
||||
'[~ [F3, Bb3, D4] [F3, Bb3, D4]] [~ [F3, Bb3, C4] [F3, Bb3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]]'
|
||||
cat(
|
||||
"[F4,Bb4,D5] [[D4,G4,Bb4]@2 [Bb3,D4,F4]] [[G3,C4,E4]@2 [[Ab3,F4] [A3,Gb4]]] [Bb3,E4,G4]",
|
||||
"[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, Bb3, Db3] [F3, Bb3, Db3]]",
|
||||
"[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]",
|
||||
"[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]",
|
||||
"[~ [A3, C4, E4] [A3, C4, E4]] [~ [Ab3, C4, Eb4] [Ab3, C4, Eb4]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [G3, C4, E4] [G3, C4, E4]]",
|
||||
"[~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]",
|
||||
"[~ [F3, Bb3, D4] [F3, Bb3, D4]] [~ [F3, Bb3, C4] [F3, Bb3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]]",
|
||||
"[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]",
|
||||
"[~ [A3, C4, E4] [A3, C4, E4]] [~ [Ab3, C4, Eb4] [Ab3, C4, Eb4]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [G3, C4, E4] [G3, C4, E4]]",
|
||||
"[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]",
|
||||
"[~ [F3, Bb3, D4] [F3, Bb3, D4]] [~ [F3, Bb3, C4] [F3, Bb3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]]",
|
||||
"[~ [Bb3, D3, F4] [Bb3, D3, F4]] [~ [Bb3, D3, F4] [Bb3, D3, F4]] [~ [A3, C4, F4] [A3, C4, F4]] [~ [A3, C4, F4] [A3, C4, F4]]",
|
||||
"[~ [Ab3, B3, F4] [Ab3, B3, F4]] [~ [Ab3, B3, F4] [Ab3, B3, F4]] [~ [G3, Bb3, F4] [G3, Bb3, F4]] [~ [G3, Bb3, E4] [G3, Bb3, E4]]",
|
||||
"[~ [Bb3, D3, F4] [Bb3, D3, F4]] [~ [Bb3, D3, F4] [Bb3, D3, F4]] [~ [A3, C4, F4] [A3, C4, F4]] [~ [A3, C4, F4] [A3, C4, F4]]",
|
||||
"[~ [Ab3, B3, F4] [Ab3, B3, F4]] [~ [Ab3, B3, F4] [Ab3, B3, F4]] [~ [G3, Bb3, F4] [G3, Bb3, F4]] [~ [G3, Bb3, E4] [G3, Bb3, E4]]",
|
||||
"[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]",
|
||||
"[~ [F3, Bb3, D4] [F3, Bb3, D4]] [~ [F3, Bb3, C4] [F3, Bb3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]]"
|
||||
),
|
||||
mini(
|
||||
'[G3 G3 C3 E3]',
|
||||
'[F2 D2 G2 C2]',
|
||||
'[F2 D2 G2 C2]',
|
||||
'[F2 A2 Bb2 B2]',
|
||||
'[A2 Ab2 G2 C2]',
|
||||
'[F2 A2 Bb2 B2]',
|
||||
'[G2 C2 F2 F2]',
|
||||
'[F2 A2 Bb2 B2]',
|
||||
'[A2 Ab2 G2 C2]',
|
||||
'[F2 A2 Bb2 B2]',
|
||||
'[G2 C2 F2 F2]',
|
||||
'[Bb2 Bb2 A2 A2]',
|
||||
'[Ab2 Ab2 G2 [C2 D2 E2]]',
|
||||
'[Bb2 Bb2 A2 A2]',
|
||||
'[Ab2 Ab2 G2 [C2 D2 E2]]',
|
||||
'[F2 A2 Bb2 B2]',
|
||||
'[G2 C2 F2 F2]'
|
||||
cat(
|
||||
"[G3 G3 C3 E3]",
|
||||
"[F2 D2 G2 C2]",
|
||||
"[F2 D2 G2 C2]",
|
||||
"[F2 A2 Bb2 B2]",
|
||||
"[A2 Ab2 G2 C2]",
|
||||
"[F2 A2 Bb2 B2]",
|
||||
"[G2 C2 F2 F2]",
|
||||
"[F2 A2 Bb2 B2]",
|
||||
"[A2 Ab2 G2 C2]",
|
||||
"[F2 A2 Bb2 B2]",
|
||||
"[G2 C2 F2 F2]",
|
||||
"[Bb2 Bb2 A2 A2]",
|
||||
"[Ab2 Ab2 G2 [C2 D2 E2]]",
|
||||
"[Bb2 Bb2 A2 A2]",
|
||||
"[Ab2 Ab2 G2 [C2 D2 E2]]",
|
||||
"[F2 A2 Bb2 B2]",
|
||||
"[G2 C2 F2 F2]"
|
||||
)
|
||||
).slow(51);
|
||||
`;
|
||||
export const giantSteps = `stack(
|
||||
// melody
|
||||
mini(
|
||||
'[F#5 D5] [B4 G4] Bb4 [B4 A4]',
|
||||
'[D5 Bb4] [G4 Eb4] F#4 [G4 F4]',
|
||||
'Bb4 [B4 A4] D5 [D#5 C#5]',
|
||||
'F#5 [G5 F5] Bb5 [F#5 F#5]',
|
||||
cat(
|
||||
"[F#5 D5] [B4 G4] Bb4 [B4 A4]",
|
||||
"[D5 Bb4] [G4 Eb4] F#4 [G4 F4]",
|
||||
"Bb4 [B4 A4] D5 [D#5 C#5]",
|
||||
"F#5 [G5 F5] Bb5 [F#5 F#5]",
|
||||
),
|
||||
// chords
|
||||
mini(
|
||||
'[B^7 D7] [G^7 Bb7] Eb^7 [Am7 D7]',
|
||||
'[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]',
|
||||
'Eb^7 [Am7 D7] G^7 [C#m7 F#7]',
|
||||
'B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]'
|
||||
cat(
|
||||
"[B^7 D7] [G^7 Bb7] Eb^7 [Am7 D7]",
|
||||
"[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]",
|
||||
"Eb^7 [Am7 D7] G^7 [C#m7 F#7]",
|
||||
"B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]"
|
||||
).voicings(['E3', 'G4']),
|
||||
// bass
|
||||
mini(
|
||||
'[B2 D2] [G2 Bb2] [Eb2 Bb3] [A2 D2]',
|
||||
'[G2 Bb2] [Eb2 F#2] [B2 F#2] [F2 Bb2]',
|
||||
'[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]',
|
||||
'[B2 F#2] [F2 Bb2] [Eb2 Bb3] [C#2 F#2]'
|
||||
cat(
|
||||
"[B2 D2] [G2 Bb2] [Eb2 Bb3] [A2 D2]",
|
||||
"[G2 Bb2] [Eb2 F#2] [B2 F#2] [F2 Bb2]",
|
||||
"[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]",
|
||||
"[B2 F#2] [F2 Bb2] [Eb2 Bb3] [C#2 F#2]"
|
||||
)
|
||||
).slow(20);`;
|
||||
export const giantStepsReggae = `stack(
|
||||
// melody
|
||||
mini(
|
||||
'[F#5 D5] [B4 G4] Bb4 [B4 A4]',
|
||||
'[D5 Bb4] [G4 Eb4] F#4 [G4 F4]',
|
||||
'Bb4 [B4 A4] D5 [D#5 C#5]',
|
||||
'F#5 [G5 F5] Bb5 [F#5 [F#5 ~@3]]',
|
||||
cat(
|
||||
"[F#5 D5] [B4 G4] Bb4 [B4 A4]",
|
||||
"[D5 Bb4] [G4 Eb4] F#4 [G4 F4]",
|
||||
"Bb4 [B4 A4] D5 [D#5 C#5]",
|
||||
"F#5 [G5 F5] Bb5 [F#5 [F#5 ~@3]]",
|
||||
),
|
||||
// chords
|
||||
mini(
|
||||
'[B^7 D7] [G^7 Bb7] Eb^7 [Am7 D7]',
|
||||
'[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]',
|
||||
'Eb^7 [Am7 D7] G^7 [C#m7 F#7]',
|
||||
'B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]'
|
||||
cat(
|
||||
"[B^7 D7] [G^7 Bb7] Eb^7 [Am7 D7]",
|
||||
"[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]",
|
||||
"Eb^7 [Am7 D7] G^7 [C#m7 F#7]",
|
||||
"B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]"
|
||||
)
|
||||
.groove('~ [x ~]'.m.fast(4*8))
|
||||
.groove("~ [x ~]".fast(4*8))
|
||||
.voicings(['E3', 'G4']),
|
||||
// bass
|
||||
mini(
|
||||
'[B2 D2] [G2 D2] [Eb2 Bb2] [A2 D2]',
|
||||
'[G2 Bb2] [Eb2 F#2] [B2 F#2] [F2 Bb2]',
|
||||
'[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]',
|
||||
'[B2 F#2] [F2 Bb2] [Eb2 Bb2] [C#2 F#2]'
|
||||
cat(
|
||||
"[B2 D2] [G2 D2] [Eb2 Bb2] [A2 D2]",
|
||||
"[G2 Bb2] [Eb2 F#2] [B2 F#2] [F2 Bb2]",
|
||||
"[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]",
|
||||
"[B2 F#2] [F2 Bb2] [Eb2 Bb2] [C#2 F#2]"
|
||||
)
|
||||
.groove('x ~'.m.fast(4*8))
|
||||
.groove("x ~".fast(4*8))
|
||||
).slow(25)`;
|
||||
export const transposedChordsHacked = `stack(
|
||||
'c2 eb2 g2'.mini,
|
||||
'Cm7'.pure.voicings(['g2','c4']).slow(2)
|
||||
"c2 eb2 g2",
|
||||
"Cm7".voicings(['g2','c4']).slow(2)
|
||||
).transpose(
|
||||
slowcat(1, 2, 3, 2).slow(2)
|
||||
).transpose(5)`;
|
||||
|
|
@ -245,24 +245,24 @@ export const scaleTranspose = `stack(f2, f3, c4, ab4)
|
|||
.scaleTranspose(sequence(0, -1, -2, -3).slow(4))
|
||||
.transpose(sequence(0, 1).slow(16))`;
|
||||
export const groove = `stack(
|
||||
'c2 g2 a2 [e2@2 eb2] d2 a2 g2 [d2 ~ db2]'.mini,
|
||||
'[C^7 A7] [Dm7 G7]'.mini.groove('[x@2 x] [~@2 x] [~ x@2]@2 [x ~@2] ~ [~@2 x@4]@2'.mini)
|
||||
"c2 g2 a2 [e2@2 eb2] d2 a2 g2 [d2 ~ db2]",
|
||||
"[C^7 A7] [Dm7 G7]".groove("[x@2 x] [~@2 x] [~ x@2]@2 [x ~@2] ~ [~@2 x@4]@2")
|
||||
.voicings(['G3','A4'])
|
||||
).slow(4)`;
|
||||
export const magicSofa = `stack(
|
||||
'<C^7 F^7 ~> <Dm7 G7 A7 ~>'.m
|
||||
"<C^7 F^7 ~> <Dm7 G7 A7 ~>"
|
||||
.every(2, fast(2))
|
||||
.voicings(),
|
||||
'<c2 f2 g2> <d2 g2 a2 e2>'.m
|
||||
"<c2 f2 g2> <d2 g2 a2 e2>"
|
||||
).slow(1).transpose.slowcat(0, 2, 3, 4)`;
|
||||
export const confusedPhoneDynamic = `stack('[g2 ~@1.3] [c3 ~@1.3]'.mini.slow(2))
|
||||
export const confusedPhoneDynamic = `stack("[g2 ~@1.3] [c3 ~@1.3]".slow(2))
|
||||
.superimpose(
|
||||
...[-12,7,10,12,24].slice(0,5).map((t,i,{length}) => x => transpose(t,x).late(i/length))
|
||||
)
|
||||
.scale(sequence('C dorian', 'C mixolydian').slow(4))
|
||||
.scaleTranspose(slowcat(0,1,2,1).slow(2))
|
||||
.synth('triangle').gain(0.5).filter(1500)`;
|
||||
export const confusedPhone = `'[g2 ~@1.3] [c3 ~@1.3]'.mini
|
||||
export const confusedPhone = `"[g2 ~@1.3] [c3 ~@1.3]"
|
||||
.superimpose(
|
||||
transpose(-12).late(0),
|
||||
transpose(7).late(0.1),
|
||||
|
|
@ -280,14 +280,14 @@ export const zeldasRescue = `stack(
|
|||
[B3@2 D4] [A3@2 [G3 A3]] [B3@2 D4] [A3]
|
||||
[B3@2 D4] [A4@2 G4] D5@2
|
||||
[D5@2 [C5 B4]] [[C5 B4] G4@2] [C5@2 [B4 A4]] [[B4 A4] E4@2]
|
||||
[D5@2 [C5 B4]] [[C5 B4] G4 C5] [G5] [~ ~ B3]\`.mini,
|
||||
[D5@2 [C5 B4]] [[C5 B4] G4 C5] [G5] [~ ~ B3]\`,
|
||||
// bass
|
||||
\`[[C2 G2] E3@2] [[C2 G2] F#3@2] [[C2 G2] E3@2] [[C2 G2] F#3@2]
|
||||
[[B1 D3] G3@2] [[Bb1 Db3] G3@2] [[A1 C3] G3@2] [[D2 C3] F#3@2]
|
||||
[[C2 G2] E3@2] [[C2 G2] F#3@2] [[C2 G2] E3@2] [[C2 G2] F#3@2]
|
||||
[[B1 D3] G3@2] [[Bb1 Db3] G3@2] [[A1 C3] G3@2] [[D2 C3] F#3@2]
|
||||
[[F2 C3] E3@2] [[E2 B2] D3@2] [[D2 A2] C3@2] [[C2 G2] B2@2]
|
||||
[[F2 C3] E3@2] [[E2 B2] D3@2] [[Eb2 Bb2] Db3@2] [[D2 A2] C3 [F3,G2]]\`.mini
|
||||
[[F2 C3] E3@2] [[E2 B2] D3@2] [[Eb2 Bb2] Db3@2] [[D2 A2] C3 [F3,G2]]\`
|
||||
).transpose(12).slow(48).tone(
|
||||
new PolySynth().chain(
|
||||
new Gain(0.3),
|
||||
|
|
@ -296,9 +296,9 @@ export const zeldasRescue = `stack(
|
|||
Destination)
|
||||
)`;
|
||||
export const technoDrums = `stack(
|
||||
'c1*2'.m.tone(new Tone.MembraneSynth().toDestination()),
|
||||
'~ x'.m.tone(new Tone.NoiseSynth().toDestination()),
|
||||
'[~ c4]*2'.m.tone(new Tone.MetalSynth().set({envelope:{decay:0.06,sustain:0}}).chain(new Gain(0.5),Destination))
|
||||
"c1*2".tone(new Tone.MembraneSynth().toDestination()),
|
||||
"~ x".tone(new Tone.NoiseSynth().toDestination()),
|
||||
"[~ c4]*2".tone(new Tone.MetalSynth().set({envelope:{decay:0.06,sustain:0}}).chain(new Gain(0.5),Destination))
|
||||
)`;
|
||||
export const loungerave = `() => {
|
||||
const delay = new FeedbackDelay(1/8, .2).chain(vol(0.5), out);
|
||||
|
|
@ -309,22 +309,22 @@ export const loungerave = `() => {
|
|||
const keys = new PolySynth().set({ ...osc('sawtooth'), ...adsr(0, .5, .2, .7) }).chain(lowpass(1200), vol(.5), out);
|
||||
|
||||
const drums = stack(
|
||||
'c1*2'.m.tone(kick).bypass('<0@7 1>/8'.m),
|
||||
'~ <x!7 [x@3 x]>'.m.tone(snare).bypass('<0@7 1>/4'.m),
|
||||
'[~ c4]*2'.m.tone(hihat)
|
||||
"c1*2".tone(kick).bypass("<0@7 1>/8"),
|
||||
"~ <x!7 [x@3 x]>".tone(snare).bypass("<0@7 1>/4"),
|
||||
"[~ c4]*2".tone(hihat)
|
||||
);
|
||||
|
||||
const thru = (x) => x.transpose('<0 1>/8'.m).transpose(1);
|
||||
const thru = (x) => x.transpose("<0 1>/8").transpose(1);
|
||||
const synths = stack(
|
||||
'<C2 Bb1 Ab1 [G1 [G2 G1]]>/2'.m.groove('[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2'.m).edit(thru).tone(bass),
|
||||
'<Cm7 Bb7 Fm7 G7b9>/2'.m.groove('~ [x@0.1 ~]'.m).voicings().edit(thru).every(2, early(1/4)).tone(keys).bypass('<0@7 1>/8'.m.early(1/4))
|
||||
"<C2 Bb1 Ab1 [G1 [G2 G1]]>/2".groove("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2").edit(thru).tone(bass),
|
||||
"<Cm7 Bb7 Fm7 G7b9>/2".groove("~ [x@0.1 ~]").voicings().edit(thru).every(2, early(1/4)).tone(keys).bypass("<0@7 1>/8".early(1/4))
|
||||
)
|
||||
return stack(
|
||||
drums,
|
||||
synths
|
||||
)
|
||||
//.bypass('<0 1>*4'.m)
|
||||
//.early('0.25 0'.m);
|
||||
//.bypass("<0 1>*4")
|
||||
//.early("0.25 0");
|
||||
}`;
|
||||
export const caverave = `() => {
|
||||
const delay = new FeedbackDelay(1/8, .4).chain(vol(0.5), out);
|
||||
|
|
@ -335,25 +335,41 @@ export const caverave = `() => {
|
|||
const keys = new PolySynth().set({ ...osc('sawtooth'), ...adsr(0, .5, .2, .7) }).chain(lowpass(1200), vol(.5), out);
|
||||
|
||||
const drums = stack(
|
||||
'c1*2'.m.tone(kick).bypass('<0@7 1>/8'.m),
|
||||
'~ <x!7 [x@3 x]>'.m.tone(snare).bypass('<0@7 1>/4'.m),
|
||||
'[~ c4]*2'.m.tone(hihat)
|
||||
"c1*2".tone(kick).bypass("<0@7 1>/8"),
|
||||
"~ <x!7 [x@3 x]>".tone(snare).bypass("<0@7 1>/4"),
|
||||
"[~ c4]*2".tone(hihat)
|
||||
);
|
||||
|
||||
const thru = (x) => x.transpose('<0 1>/8'.m).transpose(-1);
|
||||
const thru = (x) => x.transpose("<0 1>/8").transpose(-1);
|
||||
const synths = stack(
|
||||
'<eb4 d4 c4 b3>/2'.m.scale(timeCat([3,'C minor'],[1,'C melodic minor']).slow(8)).groove('[~ x]*2'.m)
|
||||
"<eb4 d4 c4 b3>/2".scale(timeCat([3,'C minor'],[1,'C melodic minor']).slow(8)).groove("[~ x]*2")
|
||||
.edit(
|
||||
scaleTranspose(0).early(0),
|
||||
scaleTranspose(2).early(1/8),
|
||||
scaleTranspose(7).early(1/4),
|
||||
scaleTranspose(8).early(3/8)
|
||||
).edit(thru).tone(keys).bypass('<1 0>/16'.m),
|
||||
'<C2 Bb1 Ab1 [G1 [G2 G1]]>/2'.m.groove('[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2'.m.fast(2)).edit(thru).tone(bass),
|
||||
'<Cm7 Bb7 Fm7 G7b13>/2'.m.groove('~ [x@0.1 ~]'.m.fast(2)).voicings().edit(thru).every(2, early(1/8)).tone(keys).bypass('<0@7 1>/8'.m.early(1/4))
|
||||
).edit(thru).tone(keys).bypass("<1 0>/16"),
|
||||
"<C2 Bb1 Ab1 [G1 [G2 G1]]>/2".groove("[x [~ x] <[~ [~ x]]!3 [x x]>@2]/2".fast(2)).edit(thru).tone(bass),
|
||||
"<Cm7 Bb7 Fm7 G7b13>/2".groove("~ [x@0.1 ~]".fast(2)).voicings().edit(thru).every(2, early(1/8)).tone(keys).bypass("<0@7 1>/8".early(1/4))
|
||||
)
|
||||
return stack(
|
||||
drums.fast(2),
|
||||
synths
|
||||
).slow(2);
|
||||
}`;
|
||||
export const callcenterhero = `()=>{
|
||||
const bpm = 90;
|
||||
const lead = polysynth().set({...osc('sine4'),...adsr(.004)}).chain(vol(0.15),out)
|
||||
const bass = fmsynth({...osc('sawtooth6'),...adsr(0.05,.6,0.8,0.1)}).chain(vol(0.6), out);
|
||||
const s = scale(slowcat('F3 minor', 'Ab3 major', 'Bb3 dorian', 'C4 phrygian dominant').slow(4));
|
||||
return stack(
|
||||
"0 2".groove("<x ~> [x ~]").edit(s).scaleTranspose(stack(0,2)).tone(lead),
|
||||
"<6 7 9 7>".groove("[~ [x ~]*2]*2").edit(s).scaleTranspose("[0,2] [2,4]".fast(2).every(4,rev)).tone(lead),
|
||||
"-14".groove("[~ x@0.8]*2".early(0.01)).edit(s).tone(bass),
|
||||
"c2*2".tone(membrane().chain(vol(0.6), out)),
|
||||
"~ c2".tone(noise().chain(vol(0.2), out)),
|
||||
"c4*4".tone(metal(adsr(0,.05,0)).chain(vol(0.03), out))
|
||||
)
|
||||
.slow(120 / bpm)
|
||||
}
|
||||
`;
|
||||
|
|
|
|||
8
docs/dist/useRepl.js
vendored
8
docs/dist/useRepl.js
vendored
|
|
@ -12,8 +12,10 @@ function useRepl({tune, defaultSynth, autolink = true, onEvent}) {
|
|||
const [activeCode, setActiveCode] = useState();
|
||||
const [log, setLog] = useState("");
|
||||
const [error, setError] = useState();
|
||||
const [hash, setHash] = useState("");
|
||||
const [pattern, setPattern] = useState();
|
||||
const dirty = code !== activeCode;
|
||||
const dirty = code !== activeCode || error;
|
||||
const generateHash = () => encodeURIComponent(btoa(code));
|
||||
const activateCode = (_code = code) => {
|
||||
!cycle.started && cycle.start();
|
||||
broadcast({type: "start", from: id});
|
||||
|
|
@ -27,6 +29,7 @@ function useRepl({tune, defaultSynth, autolink = true, onEvent}) {
|
|||
if (autolink) {
|
||||
window.location.hash = "#" + encodeURIComponent(btoa(code));
|
||||
}
|
||||
setHash(generateHash());
|
||||
setError(void 0);
|
||||
setActiveCode(_code);
|
||||
} catch (err) {
|
||||
|
|
@ -103,7 +106,8 @@ function useRepl({tune, defaultSynth, autolink = true, onEvent}) {
|
|||
togglePlay,
|
||||
activateCode,
|
||||
activeCode,
|
||||
pushLog
|
||||
pushLog,
|
||||
hash
|
||||
};
|
||||
}
|
||||
export default useRepl;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue