From 6da98a5f318784752b5badffcd0458be9a9073d9 Mon Sep 17 00:00:00 2001 From: Enelg52 Date: Tue, 23 Jan 2024 16:47:46 +0100 Subject: [PATCH 01/27] fix midi issue on firefox and quote error --- packages/midi/midi.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index f40a5049e..7d2531144 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -167,10 +167,16 @@ let listeners = {}; const refs = {}; export async function midin(input) { + if (isPattern(input)) { + throw new Error( + `.midi does not accept Pattern input. Make sure to pass device name with single quotes. Example: .midi('${ + WebMidi.outputs?.[0]?.name || 'IAC Driver Bus 1' + }')`, + ); + } const initial = await enableWebMidi(); // only returns on first init const device = getDevice(input, WebMidi.inputs); - - if (initial) { + if (initial || WebMidi.enabled) { const otherInputs = WebMidi.inputs.filter((o) => o.name !== device.name); logger( `Midi enabled! Using "${device.name}". ${ From fb7c2b61d3fce9ca7674a5f0214dc92ea7420677 Mon Sep 17 00:00:00 2001 From: Michael Hetrick Date: Fri, 26 Jan 2024 07:13:09 -0800 Subject: [PATCH 02/27] Update first-sounds.mdx Update the tutorial text to reflect that the default cpm setting has changed from 60 to 30. --- website/src/pages/workshop/first-sounds.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/workshop/first-sounds.mdx b/website/src/pages/workshop/first-sounds.mdx index c8f321b8f..eece6a3f2 100644 --- a/website/src/pages/workshop/first-sounds.mdx +++ b/website/src/pages/workshop/first-sounds.mdx @@ -139,7 +139,7 @@ The content of a sequence will be squished into what's called a cycle. cpm = cycles per minute -By default, the tempo is 60 cycles per minute = 1 cycle per second. +By default, the tempo is 30 cycles per minute = 1 half cycle per second. From d2bf9370eae184bb167f6270561e7069cc9aaa7a Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 4 Feb 2024 23:24:43 +0100 Subject: [PATCH 03/27] Update README.md add link to usage example for repl package --- packages/repl/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/repl/README.md b/packages/repl/README.md index ff3109487..b4cbf37c5 100644 --- a/packages/repl/README.md +++ b/packages/repl/README.md @@ -1,3 +1,5 @@ # @strudel/repl The Strudel REPL as a web component. + +[Usage example](https://github.com/tidalcycles/strudel/blob/main/examples/buildless/web-component-no-iframe.html) From 60129413d3a89877f3457d878519697a4e3ca8a1 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 8 Feb 2024 12:19:11 +0100 Subject: [PATCH 04/27] remove cjs builds + add type module everywhere --- packages/codemirror/package.json | 1 - packages/codemirror/vite.config.js | 4 ++-- packages/core/package.json | 1 - packages/core/vite.config.js | 4 ++-- packages/csound/package.json | 2 +- packages/csound/vite.config.js | 4 ++-- packages/hydra/package.json | 2 +- packages/hydra/vite.config.js | 4 ++-- packages/midi/package.json | 2 +- packages/midi/vite.config.js | 4 ++-- packages/mini/package.json | 1 - packages/mini/vite.config.js | 4 ++-- packages/osc/package.json | 2 +- packages/osc/vite.config.js | 4 ++-- packages/repl/package.json | 1 - packages/serial/package.json | 2 +- packages/serial/vite.config.js | 4 ++-- packages/soundfonts/package.json | 1 - packages/soundfonts/vite.config.js | 4 ++-- packages/superdough/vite.config.js | 2 +- packages/tonal/package.json | 1 - packages/tonal/vite.config.js | 4 ++-- packages/transpiler/package.json | 2 +- packages/transpiler/vite.config.js | 4 ++-- packages/web/package.json | 1 - packages/web/vite.config.js | 4 ++-- packages/webaudio/package.json | 1 - packages/webaudio/vite.config.js | 4 ++-- packages/xen/package.json | 2 +- packages/xen/vite.config.js | 4 ++-- 30 files changed, 36 insertions(+), 44 deletions(-) diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index c45fa2e2d..d310225ae 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -4,7 +4,6 @@ "description": "Codemirror Extensions for Strudel", "main": "index.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/codemirror/vite.config.js b/packages/codemirror/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/codemirror/vite.config.js +++ b/packages/codemirror/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/core/package.json b/packages/core/package.json index 158e51bfc..79557c517 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -5,7 +5,6 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/core/vite.config.js b/packages/core/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/core/vite.config.js +++ b/packages/core/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/csound/package.json b/packages/csound/package.json index 333728863..996cf4011 100644 --- a/packages/csound/package.json +++ b/packages/csound/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "csound bindings for strudel", "main": "index.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/csound/vite.config.js b/packages/csound/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/csound/vite.config.js +++ b/packages/csound/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/hydra/package.json b/packages/hydra/package.json index 97432f673..7329e88d4 100644 --- a/packages/hydra/package.json +++ b/packages/hydra/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Hydra integration for strudel", "main": "hydra.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/hydra/vite.config.js b/packages/hydra/vite.config.js index 215a91140..0caf1d2fb 100644 --- a/packages/hydra/vite.config.js +++ b/packages/hydra/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'hydra.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/midi/package.json b/packages/midi/package.json index aea88d139..ec14e59c6 100644 --- a/packages/midi/package.json +++ b/packages/midi/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Midi API for strudel", "main": "index.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/midi/vite.config.js b/packages/midi/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/midi/vite.config.js +++ b/packages/midi/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/mini/package.json b/packages/mini/package.json index 080c42d9d..781e0a3f1 100644 --- a/packages/mini/package.json +++ b/packages/mini/package.json @@ -5,7 +5,6 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/mini/vite.config.js b/packages/mini/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/mini/vite.config.js +++ b/packages/mini/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/osc/package.json b/packages/osc/package.json index 9e06bd97a..1982fd6ed 100644 --- a/packages/osc/package.json +++ b/packages/osc/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "OSC messaging for strudel", "main": "osc.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/osc/vite.config.js b/packages/osc/vite.config.js index 23e7bb4ea..88e673b31 100644 --- a/packages/osc/vite.config.js +++ b/packages/osc/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'osc.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/repl/package.json b/packages/repl/package.json index 009d33d1e..fd6f33545 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -4,7 +4,6 @@ "description": "Strudel REPL as a Web Component", "main": "index.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/serial/package.json b/packages/serial/package.json index 927414484..b02da3ff7 100644 --- a/packages/serial/package.json +++ b/packages/serial/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Webserial API for strudel", "main": "serial.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/serial/vite.config.js b/packages/serial/vite.config.js index 2f5dcc393..9e2c287db 100644 --- a/packages/serial/vite.config.js +++ b/packages/serial/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'serial.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/soundfonts/package.json b/packages/soundfonts/package.json index dee0ca64e..08f18f462 100644 --- a/packages/soundfonts/package.json +++ b/packages/soundfonts/package.json @@ -4,7 +4,6 @@ "description": "Soundsfont support for strudel", "main": "index.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/soundfonts/vite.config.js b/packages/soundfonts/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/soundfonts/vite.config.js +++ b/packages/soundfonts/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/superdough/vite.config.js b/packages/superdough/vite.config.js index dd71cf678..d94e37f41 100644 --- a/packages/superdough/vite.config.js +++ b/packages/superdough/vite.config.js @@ -8,7 +8,7 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], + formats: ['es'], fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.cjs' })[ext], }, rollupOptions: { diff --git a/packages/tonal/package.json b/packages/tonal/package.json index 918f99659..3677e295b 100644 --- a/packages/tonal/package.json +++ b/packages/tonal/package.json @@ -4,7 +4,6 @@ "description": "Tonal functions for strudel", "main": "index.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/tonal/vite.config.js b/packages/tonal/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/tonal/vite.config.js +++ b/packages/tonal/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/transpiler/package.json b/packages/transpiler/package.json index 662565a92..29ebdebc9 100644 --- a/packages/transpiler/package.json +++ b/packages/transpiler/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Transpiler for strudel user code. Converts syntactically correct but semantically meaningless JS into evaluatable strudel code.", "main": "index.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/transpiler/vite.config.js b/packages/transpiler/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/transpiler/vite.config.js +++ b/packages/transpiler/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/web/package.json b/packages/web/package.json index 10e502905..9732b526b 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -4,7 +4,6 @@ "description": "Easy to setup, opiniated bundle of Strudel for the browser.", "main": "web.mjs", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/web/vite.config.js b/packages/web/vite.config.js index 02873d65c..7fe99498e 100644 --- a/packages/web/vite.config.js +++ b/packages/web/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'web.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/webaudio/package.json b/packages/webaudio/package.json index b27ea94b9..217a197f7 100644 --- a/packages/webaudio/package.json +++ b/packages/webaudio/package.json @@ -8,7 +8,6 @@ "example": "examples" }, "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/webaudio/vite.config.js b/packages/webaudio/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/webaudio/vite.config.js +++ b/packages/webaudio/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], diff --git a/packages/xen/package.json b/packages/xen/package.json index 8f328ba77..34053629e 100644 --- a/packages/xen/package.json +++ b/packages/xen/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "description": "Xenharmonic API for strudel", "main": "index.mjs", + "type": "module", "publishConfig": { - "main": "dist/index.js", "module": "dist/index.mjs" }, "scripts": { diff --git a/packages/xen/vite.config.js b/packages/xen/vite.config.js index c1d1a2ee0..5df3edc1b 100644 --- a/packages/xen/vite.config.js +++ b/packages/xen/vite.config.js @@ -8,8 +8,8 @@ export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'index.mjs'), - formats: ['es', 'cjs'], - fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' })[ext], + formats: ['es'], + fileName: (ext) => ({ es: 'index.mjs' })[ext], }, rollupOptions: { external: [...Object.keys(dependencies)], From 5dc04d9574da43e6c32fa583a9c159570a8031f9 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 8 Feb 2024 12:36:04 +0100 Subject: [PATCH 05/27] make sure to overwrite main field --- packages/codemirror/package.json | 2 +- packages/core/package.json | 2 +- packages/csound/package.json | 2 +- packages/hydra/package.json | 2 +- packages/midi/package.json | 2 +- packages/mini/package.json | 2 +- packages/osc/package.json | 2 +- packages/repl/package.json | 2 +- packages/serial/package.json | 2 +- packages/soundfonts/package.json | 2 +- packages/superdough/package.json | 2 +- packages/tonal/package.json | 2 +- packages/transpiler/package.json | 2 +- packages/web/package.json | 2 +- packages/webaudio/package.json | 2 +- packages/xen/package.json | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index d310225ae..90360abb0 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -4,7 +4,7 @@ "description": "Codemirror Extensions for Strudel", "main": "index.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/core/package.json b/packages/core/package.json index 79557c517..5e0f7eed6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "test": "vitest run", diff --git a/packages/csound/package.json b/packages/csound/package.json index 996cf4011..8bd6394be 100644 --- a/packages/csound/package.json +++ b/packages/csound/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/hydra/package.json b/packages/hydra/package.json index 7329e88d4..3a8638627 100644 --- a/packages/hydra/package.json +++ b/packages/hydra/package.json @@ -5,7 +5,7 @@ "main": "hydra.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "server": "node server.js", diff --git a/packages/midi/package.json b/packages/midi/package.json index ec14e59c6..fb92b4a35 100644 --- a/packages/midi/package.json +++ b/packages/midi/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/mini/package.json b/packages/mini/package.json index 781e0a3f1..21fd9ef2a 100644 --- a/packages/mini/package.json +++ b/packages/mini/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "test": "vitest run", diff --git a/packages/osc/package.json b/packages/osc/package.json index 1982fd6ed..8567a0135 100644 --- a/packages/osc/package.json +++ b/packages/osc/package.json @@ -5,7 +5,7 @@ "main": "osc.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "server": "node server.js", diff --git a/packages/repl/package.json b/packages/repl/package.json index fd6f33545..086f7851f 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -4,7 +4,7 @@ "description": "Strudel REPL as a Web Component", "main": "index.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/serial/package.json b/packages/serial/package.json index b02da3ff7..fba525141 100644 --- a/packages/serial/package.json +++ b/packages/serial/package.json @@ -5,7 +5,7 @@ "main": "serial.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/soundfonts/package.json b/packages/soundfonts/package.json index 08f18f462..0a7c3797f 100644 --- a/packages/soundfonts/package.json +++ b/packages/soundfonts/package.json @@ -4,7 +4,7 @@ "description": "Soundsfont support for strudel", "main": "index.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/superdough/package.json b/packages/superdough/package.json index deb75784f..a2308be86 100644 --- a/packages/superdough/package.json +++ b/packages/superdough/package.json @@ -6,7 +6,7 @@ "type": "module", "publishConfig": { "main": "dist/index.cjs", - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "directories": { "example": "examples" diff --git a/packages/tonal/package.json b/packages/tonal/package.json index 3677e295b..756f84cdd 100644 --- a/packages/tonal/package.json +++ b/packages/tonal/package.json @@ -4,7 +4,7 @@ "description": "Tonal functions for strudel", "main": "index.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/transpiler/package.json b/packages/transpiler/package.json index 29ebdebc9..0a2d68d9c 100644 --- a/packages/transpiler/package.json +++ b/packages/transpiler/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/web/package.json b/packages/web/package.json index 9732b526b..900398dc2 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -4,7 +4,7 @@ "description": "Easy to setup, opiniated bundle of Strudel for the browser.", "main": "web.mjs", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", diff --git a/packages/webaudio/package.json b/packages/webaudio/package.json index 217a197f7..0f12e1f55 100644 --- a/packages/webaudio/package.json +++ b/packages/webaudio/package.json @@ -8,7 +8,7 @@ "example": "examples" }, "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "example": "npx parcel examples/repl.html", diff --git a/packages/xen/package.json b/packages/xen/package.json index 34053629e..ea3aa55cd 100644 --- a/packages/xen/package.json +++ b/packages/xen/package.json @@ -5,7 +5,7 @@ "main": "index.mjs", "type": "module", "publishConfig": { - "module": "dist/index.mjs" + "main": "dist/index.mjs" }, "scripts": { "build": "vite build", From 051bdaccc75ba3f14026e3b652d5e3ff97b83aa6 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 8 Feb 2024 13:04:25 +0100 Subject: [PATCH 06/27] Publish - @strudel/codemirror@1.0.1 - @strudel/core@1.0.1 - @strudel/csound@1.0.1 - @strudel/hydra@1.0.1 - @strudel/midi@1.0.1 - @strudel/mini@1.0.1 - @strudel/osc@1.0.1 - @strudel/repl@1.0.1 - @strudel/serial@1.0.1 - @strudel/soundfonts@1.0.1 - superdough@1.0.1 - @strudel/tonal@1.0.1 - @strudel/transpiler@1.0.1 - @strudel/web@1.0.1 - @strudel/webaudio@1.0.1 - @strudel/xen@1.0.1 --- packages/codemirror/package.json | 2 +- packages/core/package.json | 2 +- packages/csound/package.json | 2 +- packages/hydra/package.json | 2 +- packages/midi/package.json | 2 +- packages/mini/package.json | 2 +- packages/osc/package.json | 2 +- packages/repl/package.json | 2 +- packages/serial/package.json | 2 +- packages/soundfonts/package.json | 2 +- packages/superdough/package.json | 3 +-- packages/tonal/package.json | 2 +- packages/transpiler/package.json | 2 +- packages/web/package.json | 2 +- packages/webaudio/package.json | 2 +- packages/xen/package.json | 2 +- 16 files changed, 16 insertions(+), 17 deletions(-) diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index 90360abb0..22213ac7d 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/codemirror", - "version": "1.0.0", + "version": "1.0.1", "description": "Codemirror Extensions for Strudel", "main": "index.mjs", "publishConfig": { diff --git a/packages/core/package.json b/packages/core/package.json index 5e0f7eed6..7f59ed416 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/core", - "version": "1.0.0", + "version": "1.0.1", "description": "Port of Tidal Cycles to JavaScript", "main": "index.mjs", "type": "module", diff --git a/packages/csound/package.json b/packages/csound/package.json index 8bd6394be..e0811208e 100644 --- a/packages/csound/package.json +++ b/packages/csound/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/csound", - "version": "1.0.0", + "version": "1.0.1", "description": "csound bindings for strudel", "main": "index.mjs", "type": "module", diff --git a/packages/hydra/package.json b/packages/hydra/package.json index 3a8638627..48189663f 100644 --- a/packages/hydra/package.json +++ b/packages/hydra/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/hydra", - "version": "1.0.0", + "version": "1.0.1", "description": "Hydra integration for strudel", "main": "hydra.mjs", "type": "module", diff --git a/packages/midi/package.json b/packages/midi/package.json index fb92b4a35..4cc2dddb7 100644 --- a/packages/midi/package.json +++ b/packages/midi/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/midi", - "version": "1.0.0", + "version": "1.0.1", "description": "Midi API for strudel", "main": "index.mjs", "type": "module", diff --git a/packages/mini/package.json b/packages/mini/package.json index 21fd9ef2a..cb4f459c6 100644 --- a/packages/mini/package.json +++ b/packages/mini/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/mini", - "version": "1.0.0", + "version": "1.0.1", "description": "Mini notation for strudel", "main": "index.mjs", "type": "module", diff --git a/packages/osc/package.json b/packages/osc/package.json index 8567a0135..92725cd42 100644 --- a/packages/osc/package.json +++ b/packages/osc/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/osc", - "version": "1.0.0", + "version": "1.0.1", "description": "OSC messaging for strudel", "main": "osc.mjs", "type": "module", diff --git a/packages/repl/package.json b/packages/repl/package.json index 086f7851f..eae203f1a 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/repl", - "version": "1.0.0", + "version": "1.0.1", "description": "Strudel REPL as a Web Component", "main": "index.mjs", "publishConfig": { diff --git a/packages/serial/package.json b/packages/serial/package.json index fba525141..9a98a2535 100644 --- a/packages/serial/package.json +++ b/packages/serial/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/serial", - "version": "1.0.0", + "version": "1.0.1", "description": "Webserial API for strudel", "main": "serial.mjs", "type": "module", diff --git a/packages/soundfonts/package.json b/packages/soundfonts/package.json index 0a7c3797f..db8370c36 100644 --- a/packages/soundfonts/package.json +++ b/packages/soundfonts/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/soundfonts", - "version": "1.0.0", + "version": "1.0.1", "description": "Soundsfont support for strudel", "main": "index.mjs", "publishConfig": { diff --git a/packages/superdough/package.json b/packages/superdough/package.json index a2308be86..f1abd95bd 100644 --- a/packages/superdough/package.json +++ b/packages/superdough/package.json @@ -1,11 +1,10 @@ { "name": "superdough", - "version": "1.0.0", + "version": "1.0.1", "description": "simple web audio synth and sampler intended for live coding. inspired by superdirt and webdirt.", "main": "index.mjs", "type": "module", "publishConfig": { - "main": "dist/index.cjs", "main": "dist/index.mjs" }, "directories": { diff --git a/packages/tonal/package.json b/packages/tonal/package.json index 756f84cdd..e44182280 100644 --- a/packages/tonal/package.json +++ b/packages/tonal/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/tonal", - "version": "1.0.0", + "version": "1.0.1", "description": "Tonal functions for strudel", "main": "index.mjs", "publishConfig": { diff --git a/packages/transpiler/package.json b/packages/transpiler/package.json index 0a2d68d9c..12038fc4b 100644 --- a/packages/transpiler/package.json +++ b/packages/transpiler/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/transpiler", - "version": "1.0.0", + "version": "1.0.1", "description": "Transpiler for strudel user code. Converts syntactically correct but semantically meaningless JS into evaluatable strudel code.", "main": "index.mjs", "type": "module", diff --git a/packages/web/package.json b/packages/web/package.json index 900398dc2..68ced2d26 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/web", - "version": "1.0.0", + "version": "1.0.1", "description": "Easy to setup, opiniated bundle of Strudel for the browser.", "main": "web.mjs", "publishConfig": { diff --git a/packages/webaudio/package.json b/packages/webaudio/package.json index 0f12e1f55..dce539613 100644 --- a/packages/webaudio/package.json +++ b/packages/webaudio/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/webaudio", - "version": "1.0.0", + "version": "1.0.1", "description": "Web Audio helpers for Strudel", "main": "index.mjs", "type": "module", diff --git a/packages/xen/package.json b/packages/xen/package.json index ea3aa55cd..8ee5d8a38 100644 --- a/packages/xen/package.json +++ b/packages/xen/package.json @@ -1,6 +1,6 @@ { "name": "@strudel/xen", - "version": "1.0.0", + "version": "1.0.1", "description": "Xenharmonic API for strudel", "main": "index.mjs", "type": "module", From c06a3710c148fbb96f283d6a802b5c833d252574 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Mon, 19 Feb 2024 23:43:35 -0500 Subject: [PATCH 07/27] fixed --- packages/desktopbridge/midibridge.mjs | 4 ++-- packages/midi/midi.mjs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/desktopbridge/midibridge.mjs b/packages/desktopbridge/midibridge.mjs index 6959a5bbe..ebbb185b1 100644 --- a/packages/desktopbridge/midibridge.mjs +++ b/packages/desktopbridge/midibridge.mjs @@ -6,11 +6,11 @@ const OFF_MESSAGE = 0x80; const CC_MESSAGE = 0xb0; Pattern.prototype.midi = function (output) { - return this.onTrigger((time, hap, currentTime) => { + return this.onTrigger((time, hap, currentTime, cps) => { const { note, nrpnn, nrpv, ccn, ccv } = hap.value; const offset = (time - currentTime) * 1000; const velocity = Math.floor((hap.context?.velocity ?? 0.9) * 100); // TODO: refactor velocity - const duration = Math.floor(hap.duration.valueOf() * 1000 - 10); + const duration = Math.floor((hap.duration.valueOf() / cps) * 1000 - 10); const roundedOffset = Math.round(offset); const midichan = (hap.value.midichan ?? 1) - 1; const requestedport = output ?? 'IAC'; diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index f40a5049e..96a29c270 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -129,7 +129,7 @@ Pattern.prototype.midi = function (output) { const velocity = hap.context?.velocity ?? 0.9; // TODO: refactor velocity // note off messages will often a few ms arrive late, try to prevent glitching by subtracting from the duration length - const duration = Math.floor(hap.duration.valueOf() * 1000 - 10); + const duration = Math.floor((hap.duration.valueOf() / cps) * 1000 - 10); if (note != null) { const midiNumber = typeof note === 'number' ? note : noteToMidi(note); const midiNote = new Note(midiNumber, { attack: velocity, duration }); From ebdca32c806e89d6d5648462b7c200ae2c9226c5 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 21 Feb 2024 09:48:26 +0100 Subject: [PATCH 08/27] automatically add await to samples call --- packages/transpiler/transpiler.mjs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/transpiler/transpiler.mjs b/packages/transpiler/transpiler.mjs index aedf8f3a5..72f2e8510 100644 --- a/packages/transpiler/transpiler.mjs +++ b/packages/transpiler/transpiler.mjs @@ -1,8 +1,7 @@ -import escodegen from 'escodegen'; -import { parse } from 'acorn'; -import { walk } from 'estree-walker'; -import { isNoteWithOctave } from '@strudel/core'; import { getLeafLocations } from '@strudel/mini'; +import { parse } from 'acorn'; +import escodegen from 'escodegen'; +import { walk } from 'estree-walker'; export function transpiler(input, options = {}) { const { wrapAsync = false, addReturn = true, emitMiniLocations = true, emitWidgets = true } = options; @@ -47,6 +46,9 @@ export function transpiler(input, options = {}) { }); return this.replace(widgetWithLocation(node)); } + if (isBareSamplesCall(node, parent)) { + return this.replace(withAwait(node)); + } }, leave(node, parent, prop, index) {}, }); @@ -119,3 +121,14 @@ function widgetWithLocation(node) { node.callee.name = 'sliderWithID'; return node; } + +function isBareSamplesCall(node, parent) { + return node.type === 'CallExpression' && node.callee.name === 'samples' && parent.type !== 'AwaitExpression'; +} + +function withAwait(node) { + return { + type: 'AwaitExpression', + argument: node, + }; +} From 38d389b83899046b190f594155fb7c374d4b596f Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 21 Feb 2024 09:50:21 +0100 Subject: [PATCH 09/27] add test --- packages/transpiler/test/transpiler.test.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/transpiler/test/transpiler.test.mjs b/packages/transpiler/test/transpiler.test.mjs index 5f1b754f0..988479b4f 100644 --- a/packages/transpiler/test/transpiler.test.mjs +++ b/packages/transpiler/test/transpiler.test.mjs @@ -23,6 +23,9 @@ describe('transpiler', () => { it('supports top level await', () => { expect(transpiler("await samples('xxx');", simple).output).toEqual("await samples('xxx');"); }); + it('adds await to bare samples call', () => { + expect(transpiler("samples('xxx');", simple).output).toEqual("await samples('xxx');"); + }); /* it('parses dynamic imports', () => { expect( transpiler("const { default: foo } = await import('https://bar.com/foo.js');", { From bf63b716af91cf512f3de83758a3b8463f346a0d Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 21 Feb 2024 10:17:45 +0100 Subject: [PATCH 10/27] refactor: remove await before samples calls in docs etc.. + remove /master from dirt-samples calls (there is now a main branch) + remove /main endings from some places --- examples/buildless/headless-with-samples.html | 2 +- examples/buildless/minimal-repl.html | 2 +- examples/codemirror-repl/tunes.mjs | 12 +++++------ examples/headless-repl/index.html | 2 +- examples/minimal-repl/tune.mjs | 2 +- examples/superdough/index.html | 2 +- packages/core/controls.mjs | 2 +- packages/core/pattern.mjs | 6 +++--- packages/superdough/README.md | 4 ++-- packages/superdough/sampler.mjs | 2 +- packages/web/README.md | 2 +- .../blog/release-0.8.0-himbeermuffin.mdx | 2 +- website/src/examples.mjs | 4 ++-- website/src/pages/learn/getting-started.mdx | 2 +- website/src/pages/learn/samples.mdx | 20 +++++++++---------- website/src/pages/recipes/recipes.mdx | 20 +++++++++---------- website/src/pages/recipes/rhythms.mdx | 2 +- website/src/repl/prebake.mjs | 3 +-- website/src/repl/tunes.mjs | 10 +++++----- 19 files changed, 50 insertions(+), 51 deletions(-) diff --git a/examples/buildless/headless-with-samples.html b/examples/buildless/headless-with-samples.html index 40073d70f..2ac7aa713 100644 --- a/examples/buildless/headless-with-samples.html +++ b/examples/buildless/headless-with-samples.html @@ -6,7 +6,7 @@ + + From 2854f0cf347e38413989e420bf803bffe3a67e7b Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 23 Feb 2024 14:28:43 +0100 Subject: [PATCH 17/27] try different main / module setting + bump --- packages/web/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/web/package.json b/packages/web/package.json index 3ce40736e..45946398d 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,10 +1,11 @@ { "name": "@strudel/web", - "version": "1.0.2", + "version": "1.0.3", "description": "Easy to setup, opiniated bundle of Strudel for the browser.", - "main": "web.mjs", + "module": "web.mjs", "publishConfig": { - "main": "dist/index.mjs" + "main": "dist/index.js", + "module": "dist/index.mjs" }, "scripts": { "build": "vite build", From c23d7850c79a426a5cd6a78f06cbb465480de00a Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 23 Feb 2024 14:30:07 +0100 Subject: [PATCH 18/27] simplify web example --- examples/buildless/web.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/buildless/web.html b/examples/buildless/web.html index 785a60716..dc2a4c33c 100644 --- a/examples/buildless/web.html +++ b/examples/buildless/web.html @@ -1,9 +1,8 @@ - + From 6d9327aebc2eec1be619f56112d6d5d0475769b1 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 23 Feb 2024 14:30:29 +0100 Subject: [PATCH 19/27] adapt repl package similar to web package --- packages/repl/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/repl/package.json b/packages/repl/package.json index eae203f1a..e6bce6d56 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -1,10 +1,11 @@ { "name": "@strudel/repl", - "version": "1.0.1", + "version": "1.0.2", "description": "Strudel REPL as a Web Component", - "main": "index.mjs", + "module": "index.mjs", "publishConfig": { - "main": "dist/index.mjs" + "main": "dist/index.js", + "module": "dist/index.mjs" }, "scripts": { "build": "vite build", From 058e554b0f78a464059e6ddf515c22071014b7d6 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 23 Feb 2024 14:33:07 +0100 Subject: [PATCH 20/27] update example --- examples/buildless/web-component-no-iframe.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/buildless/web-component-no-iframe.html b/examples/buildless/web-component-no-iframe.html index 6c86d2824..8afa85cb5 100644 --- a/examples/buildless/web-component-no-iframe.html +++ b/examples/buildless/web-component-no-iframe.html @@ -1,4 +1,4 @@ - +