mirror of
https://codeberg.org/uzu/strudel
synced 2026-11-23 17:11:35 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 62b8ec2402 | |||
| 24baaf7933 | |||
| 55dc8650f1 | |||
| 3b2208bc36 | |||
| d6e231a9fd | |||
| 6c345ed827 |
@@ -1,23 +0,0 @@
|
||||
In line with [our humane policy](POLICY.md#post-ai-humane-policy-for-live-coding-development), code and documentation
|
||||
should not be written by LLM agents. To this end, agents should not
|
||||
edit the codebase or make any commits that are intended to be
|
||||
contributed upstream. Likewise, LLM output should not be pasted into
|
||||
issues, comments, pull requests and so on.
|
||||
|
||||
A contributor's personal use of LLMs and related technology is their
|
||||
own business, whether for research, analysis, bug discovery or other
|
||||
assistive technology, so long as the output is not included in any
|
||||
contributions to our projects.
|
||||
|
||||
Strudel is [AGPL licensed](LICENSE), and so any code integrated with it also
|
||||
comes under that license. This should be carefully considered before
|
||||
distributing software integrated with strudel, including making it
|
||||
available over a network.
|
||||
|
||||
Strudel has purposefully moved away from github.com, as a closed
|
||||
source platform with ethical issues. Please do not fork strudel back
|
||||
to that platform, or similar corporate platforms.
|
||||
|
||||
Projects using strudel must not use "strudel" in their name, unless
|
||||
they are 'official' projects, or have the blessing of the strudel
|
||||
community.
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
"@strudel/soundfonts": "workspace:*",
|
||||
"@strudel/tonal": "workspace:*",
|
||||
"@strudel/transpiler": "workspace:*",
|
||||
"@strudel/webaudio": "workspace:*"
|
||||
"@strudel/webaudio": "workspace:*",
|
||||
"@strudel/websocket": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-replace": "^6.0.2",
|
||||
|
||||
@@ -15,6 +15,7 @@ export async function prebake() {
|
||||
import('@strudel/hydra'),
|
||||
import('@strudel/soundfonts'),
|
||||
import('@strudel/midi'),
|
||||
import('@strudel/websocket'),
|
||||
// import('@strudel/xen'),
|
||||
// import('@strudel/serial'),
|
||||
// import('@strudel/csound'),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# @strudel/websocket
|
||||
|
||||
This package adds websocket input to strudel Patterns.
|
||||
|
||||
It connects to a websocket server and exposes the latest received value (parsed as JSON) as a pattern.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import './websocket.mjs';
|
||||
|
||||
export * from './websocket.mjs';
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "@strudel/websocket",
|
||||
"version": "1.0.0",
|
||||
"description": "Websocket input for strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
"main": "dist/index.mjs"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
"algorave"
|
||||
],
|
||||
"author": "Alex McLean <alex@slab.org>",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://codeberg.org/uzu/strudel/issues"
|
||||
},
|
||||
"homepage": "https://codeberg.org/uzu/strudel#readme",
|
||||
"dependencies": {
|
||||
"@strudel/core": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^6.0.11"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { dependencies } from './package.json';
|
||||
import { resolve } from 'path';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [],
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'index.mjs'),
|
||||
formats: ['es'],
|
||||
fileName: (ext) => ({ es: 'index.mjs' })[ext],
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [...Object.keys(dependencies)],
|
||||
},
|
||||
target: 'esnext',
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
websocket.mjs - simple websocket client as a pattern
|
||||
Copyright (C) 2026 Strudel contributors -- see <https://codeberg.org/uzu/strudel/src/branch/main/packages/websocket/websocket.mjs>
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { logger, signal } from '@strudel/core';
|
||||
|
||||
const connections = {};
|
||||
const values = {};
|
||||
|
||||
function connect(addr) {
|
||||
if (connections[addr]) {
|
||||
return connections[addr];
|
||||
}
|
||||
const ws = new WebSocket(addr);
|
||||
connections[addr] = ws;
|
||||
ws.addEventListener('open', () => {
|
||||
logger(`[websocket] connected to ${addr}`);
|
||||
});
|
||||
ws.addEventListener('message', (event) => {
|
||||
try {
|
||||
console.log(event.data);
|
||||
values[addr] = JSON.parse(event.data);
|
||||
} catch {
|
||||
logger(`[websocket] received invalid json on ${addr}`);
|
||||
}
|
||||
});
|
||||
ws.addEventListener('close', () => {
|
||||
logger(`[websocket] disconnected from ${addr}`);
|
||||
delete connections[addr];
|
||||
});
|
||||
ws.addEventListener('error', () => {
|
||||
logger(`[websocket] failed to connect to ${addr}`);
|
||||
delete connections[addr];
|
||||
});
|
||||
return ws;
|
||||
}
|
||||
|
||||
export function websocket(addr) {
|
||||
connect(addr);
|
||||
return signal(() => values[addr] ?? {});
|
||||
}
|
||||
Generated
+16
@@ -538,6 +538,9 @@ importers:
|
||||
'@strudel/webaudio':
|
||||
specifier: workspace:*
|
||||
version: link:../webaudio
|
||||
'@strudel/websocket':
|
||||
specifier: workspace:*
|
||||
version: link:../websocket
|
||||
devDependencies:
|
||||
'@rollup/plugin-replace':
|
||||
specifier: ^6.0.2
|
||||
@@ -722,6 +725,16 @@ importers:
|
||||
specifier: ^6.0.11
|
||||
version: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||
|
||||
packages/websocket:
|
||||
dependencies:
|
||||
'@strudel/core':
|
||||
specifier: workspace:*
|
||||
version: link:../core
|
||||
devDependencies:
|
||||
vite:
|
||||
specifier: ^6.0.11
|
||||
version: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||
|
||||
packages/xen:
|
||||
dependencies:
|
||||
'@strudel/core':
|
||||
@@ -857,6 +870,9 @@ importers:
|
||||
'@strudel/webaudio':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/webaudio
|
||||
'@strudel/websocket':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/websocket
|
||||
'@strudel/xen':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/xen
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
"@strudel/tonal": "workspace:*",
|
||||
"@strudel/transpiler": "workspace:*",
|
||||
"@strudel/webaudio": "workspace:*",
|
||||
"@strudel/websocket": "workspace:*",
|
||||
"@strudel/mondo": "workspace:*",
|
||||
"@strudel/xen": "workspace:*",
|
||||
"@supabase/supabase-js": "^2.48.1",
|
||||
|
||||
@@ -11,7 +11,7 @@ import QA from '@components/QA';
|
||||
|
||||
Up until now, most of the functions we've seen are what other music programs are typically capable of: sequencing sounds, playing notes, controlling effects.
|
||||
|
||||
In this chapter, we are going to look at functions that are more unique to Strudel.
|
||||
In this chapter, we are going to look at functions that are more unique to tidal.
|
||||
|
||||
**reverse patterns with rev**
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ export function loadModules() {
|
||||
import('@strudel/desktopbridge/oscbridge.mjs'),
|
||||
]);
|
||||
} else {
|
||||
modules = modules.concat([import('@strudel/midi'), import('@strudel/osc')]);
|
||||
modules = modules.concat([import('@strudel/midi'), import('@strudel/osc'), import('@strudel/websocket')]);
|
||||
}
|
||||
|
||||
return evalScope(settingPatterns, ...modules);
|
||||
|
||||
Reference in New Issue
Block a user