-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into voicings-doc
- Loading branch information
Showing
180 changed files
with
19,003 additions
and
18,602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
<!doctype html> | ||
<script src="https://unpkg.com/@strudel/[email protected]"></script> | ||
<button id="play">play</button> | ||
<button id="stop">stop</button> | ||
<script> | ||
strudel.initStrudel(); | ||
document.getElementById('play').addEventListener('click', () => evaluate('note("c a f e").jux(rev)')); | ||
document.getElementById('play').addEventListener('stop', () => hush()); | ||
</script> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<!-- <script src="../../packages/web/dist/index.js"></script> --> | ||
<script src="https://unpkg.com/@strudel/[email protected]"></script> | ||
</head> | ||
<body style="background: #222"> | ||
<button id="play">play</button> | ||
<button id="stop">stop</button> | ||
<script> | ||
strudel.initStrudel(); | ||
document.getElementById('play').addEventListener('click', () => | ||
evaluate(` | ||
//@title washover @by Switch Angel | ||
//@social https://www.instagram.com/_switch_angel/ | ||
n("{0 1 3 5 2 }%16") | ||
.add(n(tri.range(0, 6).slow(3))) | ||
.scale("C4:pentatonic") | ||
.sound("sawtooth").att(saw.range(0, 0.05).fast(6)) | ||
.release(3).pan(rand).decay(rand.range(0.1, 0.3)) | ||
.lpf(tri.range(200, 8000).slow(5)).lpq(0) | ||
.gain(.4).vib(1).vibmod(.1) | ||
.scope({pos:.5}) | ||
`), | ||
); | ||
document.getElementById('stop').addEventListener('click', () => strudel.hush()); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
<!doctype html> | ||
<script src="https://unpkg.com/@strudel/[email protected]"></script> | ||
<button id="a">A</button> | ||
<button id="b">B</button> | ||
<button id="c">C</button> | ||
<button id="stop">stop</button> | ||
<script> | ||
initStrudel({ | ||
prebake: () => samples('github:tidalcycles/dirt-samples'), | ||
}); | ||
const click = (id, action) => document.getElementById(id).addEventListener('click', action); | ||
click('a', () => evaluate(`s('bd,jvbass(3,8)').jux(rev)`)); | ||
click('b', () => s('bd*2,hh(3,4),jvbass(5,8,1)').jux(rev).play()); | ||
click('c', () => s('bd*2,hh(3,4),jvbass:[0 4](5,8,1)').jux(rev).stack(s('~ sd')).play()); | ||
click('stop', () => hush()); | ||
</script> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<!-- <script src="../../packages/web/dist/index.js"></script> --> | ||
<script src="https://unpkg.com/@strudel/[email protected]"></script> | ||
</head> | ||
<body style="background: #222"> | ||
<button id="a">A</button> | ||
<button id="b">B</button> | ||
<button id="c">C</button> | ||
<button id="stop">stop</button> | ||
<script> | ||
initStrudel({ | ||
prebake: () => samples('github:tidalcycles/dirt-samples'), | ||
}); | ||
const click = (id, action) => document.getElementById(id).addEventListener('click', action); | ||
click('a', () => evaluate(`s('bd,jvbass(3,8)').jux(rev)`)); | ||
click('b', () => s('bd*2,hh(3,4),jvbass(5,8,1)').jux(rev).play()); | ||
click('c', () => s('bd*2,hh(3,4),jvbass:[0 4](5,8,1)').jux(rev).stack(s('~ sd')).play()); | ||
click('stop', () => hush()); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script src="https://unpkg.com/[email protected]"></script> | ||
<button id="hello">hello</button> | ||
<script> | ||
hs2js.setBase('https://unpkg.com/[email protected]/dist/'); | ||
hs2js.loadParser(); | ||
document.getElementById('hello').addEventListener('click', () => { | ||
hs2js.evaluate('alert "hello from haskell!"'); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>tidal.html</title> | ||
</head> | ||
<body style="margin: 0; padding: 0"> | ||
<textarea id="code" style="width: 100%; height: 200px"></textarea> | ||
<pre id="result"></pre> | ||
<script src="https://unpkg.com/[email protected]"></script> | ||
<script src="https://unpkg.com/@strudel/[email protected]"></script> | ||
<script> | ||
const { initStrudel } = strudel; | ||
const { run, parse, setBase, loadParser } = hs2js; | ||
setBase('https://unpkg.com/[email protected]/dist/'); | ||
const ready = loadParser(); | ||
initStrudel({ | ||
prebake: () => samples('github:tidalcycles/dirt-samples'), | ||
}); | ||
|
||
const textarea = document.getElementById('code'); | ||
if (window.location.hash) { | ||
textarea.value = atob(window.location.hash.slice(1)); | ||
} else { | ||
textarea.value = 'd1 $ s "jvbass(3,8)"'; | ||
} | ||
textarea.addEventListener('input', (e) => { | ||
window.location.hash = btoa(e.target.value); | ||
update(); | ||
}); | ||
update(); | ||
|
||
function getInfixOperators() { | ||
let operators = { | ||
'>': 'set', | ||
'#': 'set', | ||
'+': 'add', | ||
'-': 'sub', | ||
'*': 'mul', | ||
'/': 'div', | ||
}; | ||
let alignments = { | ||
in: (s) => '|' + s, | ||
out: (s) => s + '|', | ||
mix: (s) => '|' + s + '|', | ||
}; | ||
let ops = {}; | ||
Object.entries(operators).forEach(([o, name]) => { | ||
// operator without alignment | ||
ops[o] = (l, r) => reify(l)[name](reify(r)); | ||
Object.entries(alignments).forEach(([a, getSymbol]) => { | ||
// get symbol with alignment | ||
let symbol = getSymbol(o); | ||
ops[symbol] = (l, r) => reify(l)[name][a](reify(r)); | ||
}); | ||
}); | ||
ops['~>'] = (l, r) => reify(l).late(reify(r)); | ||
ops['<~'] = (l, r) => reify(l).early(reify(r)); | ||
ops['<$>'] = (l, r) => reify(r).fmap(l).outerJoin(); // is this right? | ||
return ops; | ||
} | ||
const ops = getInfixOperators(); | ||
|
||
async function update() { | ||
let result, tree; | ||
await ready; | ||
try { | ||
tree = parse(textarea.value); | ||
} catch (err) { | ||
console.warn('parse error'); | ||
console.error(err); | ||
} | ||
console.log('parsed tree'); | ||
console.log(tree.rootNode.toString()); | ||
try { | ||
let patterns = {}; | ||
window.p = (name, pattern) => { | ||
patterns[name] = pattern; | ||
}; | ||
window.d1 = (pat) => window.p(1, pat); | ||
window.d2 = (pat) => window.p(2, pat); | ||
window.d3 = (pat) => window.p(3, pat); | ||
window.rot = late; | ||
result = run(tree.rootNode, window, ops); | ||
if (Object.values(patterns).length) { | ||
stack(...Object.values(patterns)).play(); | ||
} | ||
} catch (err) { | ||
console.warn('eval error'); | ||
console.error(err); | ||
result = 'ERROR: ' + err.message; | ||
} | ||
document.getElementById('result').innerHTML = 'Result: ' + result; | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
public/tree-sitter.wasm | ||
public/tree-sitter-haskell.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# @strudel/tidal | ||
|
||
This is an experiment in implementing tree-sitter for parsing haskell. | ||
|
||
```sh | ||
pnpm i | ||
cd haskell | ||
pnpm copy-wasm | ||
pnpm dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Tree sitter test</title> | ||
<style> | ||
body { | ||
background-color: #121213; | ||
color: white; | ||
} | ||
textarea { | ||
padding: 10px; | ||
color: white; | ||
background-color: transparent; | ||
outline: none; | ||
} | ||
a { | ||
color: white; | ||
} | ||
</style> | ||
</head> | ||
<body style="margin: 0; padding: 0"> | ||
<textarea id="code" style="width: 100%; height: 200px"></textarea> | ||
<pre id="result"></pre> | ||
<script | ||
type="module" | ||
src="/main.js | ||
" | ||
></script> | ||
</body> | ||
</html> |
Oops, something went wrong.