more slides

This commit is contained in:
Felix Roos
2023-04-16 23:55:12 +02:00
parent 6a451be50c
commit d38a8ab1fa
15 changed files with 294 additions and 76 deletions
+3 -1
View File
@@ -16,6 +16,7 @@
"@strudel.cycles/react": "workspace:*",
"@strudel.cycles/soundfonts": "workspace:*",
"@strudel.cycles/tonal": "workspace:*",
"@strudel.cycles/csound": "workspace:*",
"@strudel.cycles/webaudio": "workspace:*",
"@uiw/codemirror-themes-all": "^4.19.8",
"escodegen": "^2.0.0",
@@ -23,7 +24,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-syntax-highlighter": "^15.5.0",
"remark-gfm": "^3.0.1"
"remark-gfm": "^3.0.1",
"vite-plugin-top-level-await": "^1.3.0"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.8",
+1 -5
View File
@@ -13,11 +13,7 @@ const snippets = [
function MiniComparison() {
return (
<>
<h1>
User Code: Mini Notation -&gt; JavaScript
<br />
<small>External DSL</small>
</h1>
<h1>User Code: Mini Notation -&gt; JavaScript</h1>
<Stepper
steps={snippets.map(([a, b, label]) => (
<div className="py-4">
+1
View File
@@ -13,6 +13,7 @@ if (typeof window !== 'undefined') {
import('@strudel.cycles/mini'),
import('@strudel.cycles/webaudio'),
import('@strudel.cycles/soundfonts'),
import('@strudel.cycles/csound'),
);
}
+20 -3
View File
@@ -7,14 +7,19 @@ function cx(...classes) {
}
// https://vitejs.dev/guide/features.html#glob-import
const slideImports = import.meta.glob('./slides/*.mdx');
//const slideImports = import.meta.glob('./slides/*.mdx', { eager: true });
console.log('load slides...', slideImports);
const loadedMDXFiles = await Promise.all(
Object.entries(slideImports).map(async ([path, load]) => {
//Object.entries(slideImports).map(async ([path, m]) => {
const segments = path.split('/');
const filename = segments[segments.length - 1].slice(0, -4); // expects .mdx at the end
return [filename, (await load()).default];
//return [filename, m.default];
}),
);
console.log('load done!');
const order = [
'cover',
@@ -39,10 +44,14 @@ const order = [
// Output
'events-audio',
'outputs',
'csound',
//
// pattern alignment?
// flexible typing?
// future outlook?
'bad',
'good',
'future',
'end',
];
@@ -57,7 +66,7 @@ export const next = () => slideIndex.set((parseInt(slideIndex.get()) + 1) % slid
function Slides() {
const activeIndex = parseInt(useStore(slideIndex));
useEvent('click', (e) => {
/*useEvent('click', (e) => {
if (!e.ctrlKey) {
return;
}
@@ -67,7 +76,7 @@ function Slides() {
} else {
next();
}
});
});*/
/*useEvent('keydown', (e) => {
if (e.key === 'Home') {
prev();
@@ -88,10 +97,18 @@ function Slides() {
)}
>
<div className="prose prose-invert w-[1400px] p-12 max-w-full" style={{ fontSize: '2em' }}>
{Math.abs(i - activeIndex) < 2 && <Slide />}
{Math.abs(i - activeIndex) <= 1 && <Slide />}
</div>
</div>
))}
<div className="text-white text-2xl text-bold cursor-pointer select-none">
<div className="fixed left-0 p-4 h-full items-start flex hover:bg-[#00000050]" onClick={() => prev()}>
&lt;
</div>
<div className="fixed right-0 p-4 h-full items-start flex hover:bg-[#00000050]" onClick={() => next()}>
&gt;
</div>
</div>
<div className="absolute top-0 w-full">
<div className="h-[5px] bg-slate-500 w-full z-100">
<div
+20 -22
View File
@@ -42,31 +42,29 @@ const snippets = [
function SyntaxComparison() {
return (
<>
<h1>
Haskell -&gt; JavaScript
<br />
<small>Internal DSL / Fluent Interface</small>
</h1>
<h1>Haskell -&gt; JavaScript</h1>
<Stepper
steps={snippets.map(([hs, js, label]) => (
<div className="py-4 space-y-4">
<h3>{label}</h3>
<div className="space-y-2">
<div className="flex space-x-4">
<img src="./img/haskell.png" className="h-10 mt-2" />
<Highlight language="haskell" code={hs} />
</div>
<div>
{js.map((c, j) => (
<div className="flex space-x-4" key={j}>
<img src="./img/js.jpg" className={`h-10 mt-2`} />
<SlideRepl tune={c} hideHeader />
</div>
))}
steps={snippets
.map(([hs, js, label]) => (
<div className="py-4 space-y-4">
<h3>{label}</h3>
<div className="space-y-2">
<div className="flex space-x-4">
<img src="./img/haskell.png" className="h-10 mt-2" />
<Highlight language="haskell" code={hs} />
</div>
<div>
{js.map((c, j) => (
<div className="flex space-x-4" key={j}>
<img src="./img/js.jpg" className={`h-10 mt-2`} />
<SlideRepl tune={c} hideHeader />
</div>
))}
</div>
</div>
</div>
</div>
))}
))
.concat([<>Fluent Interface: Just chain all the things!</>])}
/>
</>
);
+5
View File
@@ -0,0 +1,5 @@
# What's bad
- Dynamic Typing in JS
- Performance on lower end devices
- Fractions and Hot Paths
+65
View File
@@ -0,0 +1,65 @@
import { SlideRepl } from '../SlideRepl.jsx';
# CSound Example
## Loading ORC instruments
<SlideRepl
tune={`// livecode.orc by Steven Yi
await loadOrc('github:kunstmusik/csound-live-code/master/livecode.orc')
stack(
note("<C^7 A7 Dm7 Fm7>/2".voicings('lefthand'))
.cutoff(sine.range(500,2000).round().slow(16))
.euclidLegato(3,8).csound('FM1'),
note("<C2 A1 D2 F2>/2").ply(8).csound('Bass')
.gain("1 4 1 4"),
note("0 7 [4 3] 2".fast(2/3)
.off(".25 .125", add("<2 4 -3 -1>"))
.slow(2).scale('A4 minor'))
.legato(.25).csound('SynHarp'),
s("bd*2,[~ hh]*2,~ cp").bank('RolandTR909')
)`}
hideHeader
/>
## Synthesis
<SlideRepl
tune={`await loadCsound\`
instr CoolSynth
iduration = p3
ifreq = p4
igain = p5
ioct = octcps(ifreq)
kpwm = oscili(.05, 8)
asig = vco2(igain, ifreq, 4, .5 + kpwm)
asig += vco2(igain, ifreq * 2)
idepth = 2
acut = transegr:a(0, .005, 0, idepth, .06, -4.2, 0.001, .01, -4.2, 0) ; filter envelope
asig = zdf_2pole(asig, cpsoct(ioct + acut + 2), 0.5)
iattack = .01
isustain = .5
idecay = .1
irelease = .1
asig *= linsegr:a(0, iattack, 1, idecay, isustain, iduration, isustain, irelease, 0)
out(asig, asig)
endin\`
"<0 2 [4 6](3,4,2) 3\*2>"
.off(1/4, add(2))
.off(1/2, add(6))
.scale('D minor')
.note()
//.pianoroll()
.csound('CoolSynth')`}
hideHeader
/>
+1
View File
@@ -0,0 +1 @@
# Strudel Docs
+8
View File
@@ -0,0 +1,8 @@
# Future Outlook
- alternative audio backends
- supercollider wasm?
- web audio modules
- pluggable ui controls
- block based evaluation
- live collaboration
+10
View File
@@ -0,0 +1,10 @@
# What's good
- Low barrier of entry for non-techies
- good for teaching music / coding
- beginner friendly syntax (slightly more verbose)
- beginner friendly visualizations
- portable (runs on most devices)
- sharable
- lower barrier of entry for contributors
- strudel features feeding back into tidal
+3 -3
View File
@@ -1,13 +1,13 @@
# Strudel REPL: Features
- Outputs: Web Audio, MIDI, OSC, CSound, Serial, ..
- Visual Feedback
- Examples to shuffle through
- Sharable URLs
- Share-Link Generator
- Sound Browser
- Console
- Reference
- Offline Support (+ installable PWA)
- Themable + Custom Fonts
- Offline Support (+ installable PWA)
- Outputs: Web Audio, MIDI, OSC, CSound, Serial, ..
![illegible](./img/illegible.png)
+1
View File
@@ -3,6 +3,7 @@ import Highlight from '../Highlight.jsx';
# Ways to use Strudel
- "Strudel REPL" at [strudel.tidalcycles.org](https://strudel.tidalcycles.org)
- strudel on [flok.cc](https://flok.cc/) for collaboration
- `@strudel.cycles/*` npm packages for your own projects
- Embeddable [Web Component](https://github.com/tidalcycles/strudel/tree/main/packages/embed#strudelcyclesembed)
- Browser Plugin for [Mastodon](https://github.com/mortuosplango/topfenstrudel) + Discourse Plugin:
+11 -1
View File
@@ -2,6 +2,7 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import mdx from '@mdx-js/rollup';
import gfm from 'remark-gfm';
import topLevelAwait from 'vite-plugin-top-level-await';
const options = {
// See https://mdxjs.com/advanced/plugins
@@ -11,7 +12,16 @@ const options = {
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), mdx(options)],
plugins: [
react(),
mdx(options),
topLevelAwait({
// The export name of top-level await promise for each chunk module
promiseExportName: '__tla',
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: (i) => `__tla_${i}`,
}),
],
build: {
target: 'esnext', //browsers can handle the latest ES features
},
+145 -25
View File
@@ -57,6 +57,7 @@ importers:
'@nanostores/persistent': ^0.7.0
'@nanostores/react': ^0.4.1
'@strudel.cycles/core': workspace:*
'@strudel.cycles/csound': workspace:*
'@strudel.cycles/react': workspace:*
'@strudel.cycles/soundfonts': workspace:*
'@strudel.cycles/tonal': workspace:*
@@ -76,11 +77,13 @@ importers:
remark-gfm: ^3.0.1
tailwindcss: ^3.2.7
vite: ^4.2.0
vite-plugin-top-level-await: ^1.3.0
dependencies:
'@mdx-js/rollup': 2.3.0
'@nanostores/persistent': 0.7.0_nanostores@0.7.4
'@nanostores/react': 0.4.1_nkfnbc2tpc77iht7asm3uqwau4
'@strudel.cycles/core': link:../../packages/core
'@strudel.cycles/csound': link:../../packages/csound
'@strudel.cycles/react': link:../../packages/react
'@strudel.cycles/soundfonts': link:../../packages/soundfonts
'@strudel.cycles/tonal': link:../../packages/tonal
@@ -92,6 +95,7 @@ importers:
react-dom: 18.2.0_react@18.2.0
react-syntax-highlighter: 15.5.0_react@18.2.0
remark-gfm: 3.0.1
vite-plugin-top-level-await: 1.3.0_vite@4.2.0
devDependencies:
'@tailwindcss/typography': 0.5.9_tailwindcss@3.2.7
'@types/react': 18.0.28
@@ -2170,7 +2174,6 @@ packages:
cpu: [arm]
os: [android]
requiresBuild: true
dev: true
optional: true
/@esbuild/android-arm64/0.16.17:
@@ -2187,7 +2190,6 @@ packages:
cpu: [arm64]
os: [android]
requiresBuild: true
dev: true
optional: true
/@esbuild/android-x64/0.16.17:
@@ -2204,7 +2206,6 @@ packages:
cpu: [x64]
os: [android]
requiresBuild: true
dev: true
optional: true
/@esbuild/darwin-arm64/0.16.17:
@@ -2221,7 +2222,6 @@ packages:
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@esbuild/darwin-x64/0.16.17:
@@ -2238,7 +2238,6 @@ packages:
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@esbuild/freebsd-arm64/0.16.17:
@@ -2255,7 +2254,6 @@ packages:
cpu: [arm64]
os: [freebsd]
requiresBuild: true
dev: true
optional: true
/@esbuild/freebsd-x64/0.16.17:
@@ -2272,7 +2270,6 @@ packages:
cpu: [x64]
os: [freebsd]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-arm/0.16.17:
@@ -2289,7 +2286,6 @@ packages:
cpu: [arm]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-arm64/0.16.17:
@@ -2306,7 +2302,6 @@ packages:
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-ia32/0.16.17:
@@ -2323,7 +2318,6 @@ packages:
cpu: [ia32]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-loong64/0.15.18:
@@ -2348,7 +2342,6 @@ packages:
cpu: [loong64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-mips64el/0.16.17:
@@ -2365,7 +2358,6 @@ packages:
cpu: [mips64el]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-ppc64/0.16.17:
@@ -2382,7 +2374,6 @@ packages:
cpu: [ppc64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-riscv64/0.16.17:
@@ -2399,7 +2390,6 @@ packages:
cpu: [riscv64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-s390x/0.16.17:
@@ -2416,7 +2406,6 @@ packages:
cpu: [s390x]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/linux-x64/0.16.17:
@@ -2433,7 +2422,6 @@ packages:
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@esbuild/netbsd-x64/0.16.17:
@@ -2450,7 +2438,6 @@ packages:
cpu: [x64]
os: [netbsd]
requiresBuild: true
dev: true
optional: true
/@esbuild/openbsd-x64/0.16.17:
@@ -2467,7 +2454,6 @@ packages:
cpu: [x64]
os: [openbsd]
requiresBuild: true
dev: true
optional: true
/@esbuild/sunos-x64/0.16.17:
@@ -2484,7 +2470,6 @@ packages:
cpu: [x64]
os: [sunos]
requiresBuild: true
dev: true
optional: true
/@esbuild/win32-arm64/0.16.17:
@@ -2501,7 +2486,6 @@ packages:
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@esbuild/win32-ia32/0.16.17:
@@ -2518,7 +2502,6 @@ packages:
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@esbuild/win32-x64/0.16.17:
@@ -2535,7 +2518,6 @@ packages:
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@eslint/eslintrc/1.4.1:
@@ -3373,6 +3355,16 @@ packages:
rollup: 3.12.0
dev: true
/@rollup/plugin-virtual/3.0.1:
resolution: {integrity: sha512-fK8O0IL5+q+GrsMLuACVNk2x21g3yaw+sG2qn16SnUd3IlBsQyvWxLMGHmCmXRMecPjGRSZ/1LmZB4rjQm68og==}
engines: {node: '>=14.0.0'}
peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0
peerDependenciesMeta:
rollup:
optional: true
dev: false
/@rollup/pluginutils/3.1.0_rollup@2.79.1:
resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==}
engines: {node: '>= 8.0.0'}
@@ -3477,6 +3469,118 @@ packages:
string.prototype.matchall: 4.0.8
dev: true
/@swc/core-darwin-arm64/1.3.51:
resolution: {integrity: sha512-DM15fJgaXQ+BOoTlMCBoRBSzkpC2V8vAXaAvh3BZ+BI6/03FUQ0j9CMIaSkss3VOv+WwqzllmcT71C/oVDQ7Tg==}
engines: {node: '>=10'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@swc/core-darwin-x64/1.3.51:
resolution: {integrity: sha512-EPAneufZfFQUkpkf2m8Ap8TajLvjWI+UmDQz54QaofLaigXgrnLoqTtnZHBfDbUTApGYz3GaqjfZ2fMLGiISLQ==}
engines: {node: '>=10'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@swc/core-linux-arm-gnueabihf/1.3.51:
resolution: {integrity: sha512-sASxO3lJjlY5g8S25yCQirDOW6zqBNeDSUCBrulaVxttx0PcL64kc6qaOlM3HKlNO4W1P7RW/mGFR4bBov+yIg==}
engines: {node: '>=10'}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@swc/core-linux-arm64-gnu/1.3.51:
resolution: {integrity: sha512-z8yHRUK+5mRxSQkw9uND8QSt8lTrW0X8blmP12Q7c7RKWOHqIaGS60a3VvLuTal7k48K4YTstSevIrGwGK88sA==}
engines: {node: '>=10'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@swc/core-linux-arm64-musl/1.3.51:
resolution: {integrity: sha512-lMlp09lv6qDURvETw4AAZAjaJfvjwHjiAuB+JuZrgP3zdxB21M6cMas3EjAGXtNabpU1FJu+8Lsys6/GBBjsPQ==}
engines: {node: '>=10'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@swc/core-linux-x64-gnu/1.3.51:
resolution: {integrity: sha512-6zK4tDr6do6RFTJv38Rb8ZjBLdfSN7GeuyOJpblz1Qu62RqyY2Zf3fxuCZY9tkoEepZ0MvU0d4D7HhAUYKj20A==}
engines: {node: '>=10'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@swc/core-linux-x64-musl/1.3.51:
resolution: {integrity: sha512-ZwW+X9XdEiAszX+zfaLdOVfi5rQP3vnVwuNAiuX9eq5jHdfOKfKaNtJaGTD8w8NgMavaBM5AMaCHshFVNF0vRw==}
engines: {node: '>=10'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@swc/core-win32-arm64-msvc/1.3.51:
resolution: {integrity: sha512-w+IX4xCIZH6RQG7RrOOrrHqIqM7JIj9BDZHM9LAYC5MIbDinwjnSUXz7bpn0L1LRusvPtmbTulLuSkmVBSSwAg==}
engines: {node: '>=10'}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@swc/core-win32-ia32-msvc/1.3.51:
resolution: {integrity: sha512-Bzv/h0HkoKkTWOOoHtehId/6AS5hLBbWE5czzcQc8SWs+BNNV8zjWoq1oYn7/gLLEhdKaBAxv9q7RHzOfBx28A==}
engines: {node: '>=10'}
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@swc/core-win32-x64-msvc/1.3.51:
resolution: {integrity: sha512-dTKAdSd0e2Sfz3Sl3m6RGLQbk6jdSIh8TlFomF4iiHDHq4PxLTzjaOVvKUAP5wux9DtBnAgZeSHMuQfM4aL9oA==}
engines: {node: '>=10'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@swc/core/1.3.51:
resolution: {integrity: sha512-/fdKlrs2NacLeOKrVZjCPfw5GeUIyBcJg0GDBn0+qwC3Y6k85m4aswK1sfRDF3nzyeXXoBr7YBb+/cSdFq9pVw==}
engines: {node: '>=10'}
requiresBuild: true
peerDependencies:
'@swc/helpers': ^0.5.0
peerDependenciesMeta:
'@swc/helpers':
optional: true
optionalDependencies:
'@swc/core-darwin-arm64': 1.3.51
'@swc/core-darwin-x64': 1.3.51
'@swc/core-linux-arm-gnueabihf': 1.3.51
'@swc/core-linux-arm64-gnu': 1.3.51
'@swc/core-linux-arm64-musl': 1.3.51
'@swc/core-linux-x64-gnu': 1.3.51
'@swc/core-linux-x64-musl': 1.3.51
'@swc/core-win32-arm64-msvc': 1.3.51
'@swc/core-win32-ia32-msvc': 1.3.51
'@swc/core-win32-x64-msvc': 1.3.51
dev: false
/@tailwindcss/forms/0.5.3_tailwindcss@3.2.4:
resolution: {integrity: sha512-y5mb86JUoiUgBjY/o6FJSFZSEttfb3Q5gllE4xoKjAAD+vBrnIhE4dViwUuow3va8mpH4s9jyUbUbrRGoRdc2Q==}
peerDependencies:
@@ -6357,7 +6461,6 @@ packages:
'@esbuild/win32-arm64': 0.17.12
'@esbuild/win32-ia32': 0.17.12
'@esbuild/win32-x64': 0.17.12
dev: true
/escalade/3.1.1:
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
@@ -11598,7 +11701,6 @@ packages:
hasBin: true
optionalDependencies:
fsevents: 2.3.2
dev: true
/run-async/2.4.1:
resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==}
@@ -13032,6 +13134,11 @@ packages:
hasBin: true
dev: true
/uuid/9.0.0:
resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==}
hasBin: true
dev: false
/uvu/0.5.6:
resolution: {integrity: sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==}
engines: {node: '>=8'}
@@ -13135,6 +13242,20 @@ packages:
- supports-color
dev: true
/vite-plugin-top-level-await/1.3.0_vite@4.2.0:
resolution: {integrity: sha512-owIfsgWudMlQODWJSwp0sQB3AZZu3qsMygeBjZy8CyjEk6OB9AGd8lHqmgwrcEqgvy9N58lYxSBLVk3/4ejEiA==}
peerDependencies:
vite: '>=2.8'
dependencies:
'@rollup/plugin-virtual': 3.0.1
'@swc/core': 1.3.51
uuid: 9.0.0
vite: 4.2.0
transitivePeerDependencies:
- '@swc/helpers'
- rollup
dev: false
/vite/3.2.5:
resolution: {integrity: sha512-4mVEpXpSOgrssFZAOmGIr85wPHKvaDAcXqxVxVRZhljkJOMZi1ibLibzjLHzJvcok8BMguLc7g1W6W/GqZbLdQ==}
engines: {node: ^14.18.0 || >=16.0.0}
@@ -13266,7 +13387,6 @@ packages:
rollup: 3.19.1
optionalDependencies:
fsevents: 2.3.2
dev: true
/vitefu/0.2.4_vite@3.2.5:
resolution: {integrity: sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==}
-16
View File
@@ -1,4 +1,3 @@
import { Pattern, noteToMidi, valueToMidi } from '@strudel.cycles/core';
import { registerSoundfonts } from '@strudel.cycles/soundfonts';
import { registerSynthSounds, samples } from '@strudel.cycles/webaudio';
import './piano.mjs';
@@ -22,18 +21,3 @@ export async function prebake() {
// samples('github:tidalcycles/Dirt-Samples/master'),
]);
}
const maxPan = noteToMidi('C8');
const panwidth = (pan, width) => pan * width + (1 - width) / 2;
Pattern.prototype.piano = function () {
return this.clip(1)
.s('piano')
.release(0.1)
.fmap((value) => {
const midi = valueToMidi(value);
// pan by pitch
const pan = panwidth(Math.min(Math.round(midi) / maxPan, 1), 0.5);
return { ...value, pan: (value.pan || 1) * pan };
});
};