mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-14 06:43:47 -04:00
Compare commits
1 Commits
sample_note
...
glicol
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ed8438008 |
Generated
+27
@@ -1877,6 +1877,10 @@
|
||||
"resolved": "packages/eval",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@strudel.cycles/glicol": {
|
||||
"resolved": "packages/glicol",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@strudel.cycles/midi": {
|
||||
"resolved": "packages/midi",
|
||||
"link": true
|
||||
@@ -4234,6 +4238,11 @@
|
||||
"ini": "^1.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/glicol": {
|
||||
"version": "0.2.8",
|
||||
"resolved": "https://registry.npmjs.org/glicol/-/glicol-0.2.8.tgz",
|
||||
"integrity": "sha512-nNRiZIxc4LXXA2J1AsLch6gGC6R43wyLEE4eDjZPG/t9mciRqRoNGo06Fi1e9kkX/viJgFnD25jzoUPlYkEIHg=="
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
|
||||
@@ -9266,6 +9275,13 @@
|
||||
"shift-traverser": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"packages/glicol": {
|
||||
"version": "0.0.1",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"glicol": "^0.2.8"
|
||||
}
|
||||
},
|
||||
"packages/hooks": {
|
||||
"name": "@strudel.cycles/hooks",
|
||||
"version": "0.0.1",
|
||||
@@ -10872,6 +10888,12 @@
|
||||
"shift-traverser": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"@strudel.cycles/glicol": {
|
||||
"version": "file:packages/glicol",
|
||||
"requires": {
|
||||
"glicol": "^0.2.8"
|
||||
}
|
||||
},
|
||||
"@strudel.cycles/midi": {
|
||||
"version": "file:packages/midi",
|
||||
"requires": {
|
||||
@@ -12783,6 +12805,11 @@
|
||||
"ini": "^1.3.2"
|
||||
}
|
||||
},
|
||||
"glicol": {
|
||||
"version": "0.2.8",
|
||||
"resolved": "https://registry.npmjs.org/glicol/-/glicol-0.2.8.tgz",
|
||||
"integrity": "sha512-nNRiZIxc4LXXA2J1AsLch6gGC6R43wyLEE4eDjZPG/t9mciRqRoNGo06Fi1e9kkX/viJgFnD25jzoUPlYkEIHg=="
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Pattern } from '@strudel.cycles/core';
|
||||
import Glicol from 'glicol';
|
||||
|
||||
const glicol = new Glicol();
|
||||
|
||||
// TODO: make sure SharedArrayBuffer is working
|
||||
|
||||
Pattern.prototype.glicol = function () {
|
||||
return this._withEvent((event) => {
|
||||
const onTrigger = (time, event) => {
|
||||
const freq = getFrequency(event);
|
||||
const amp = event.context.velocity ?? 0.9;
|
||||
glicol.run(`o: sin ${freq} >> mul ${amp}`);
|
||||
// TODO
|
||||
};
|
||||
return event.setContext({ ...event.context, onTrigger });
|
||||
});
|
||||
};
|
||||
|
||||
function getFrequency(event) {
|
||||
let { value } = event;
|
||||
if (typeof value === 'string') {
|
||||
if (!isNote(value)) {
|
||||
throw new Error('cannot get frequency of: ' + value);
|
||||
}
|
||||
value = toMidi(value);
|
||||
}
|
||||
if (typeof value !== 'number') {
|
||||
throw new Error('cannot get frequency of: ' + value);
|
||||
}
|
||||
return fromMidi(value);
|
||||
}
|
||||
Generated
+28
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "@strudel.cycles/glicol",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@strudel.cycles/glicol",
|
||||
"version": "0.0.1",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"glicol": "^0.2.8"
|
||||
}
|
||||
},
|
||||
"node_modules/glicol": {
|
||||
"version": "0.2.8",
|
||||
"resolved": "https://registry.npmjs.org/glicol/-/glicol-0.2.8.tgz",
|
||||
"integrity": "sha512-nNRiZIxc4LXXA2J1AsLch6gGC6R43wyLEE4eDjZPG/t9mciRqRoNGo06Fi1e9kkX/viJgFnD25jzoUPlYkEIHg=="
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"glicol": {
|
||||
"version": "0.2.8",
|
||||
"resolved": "https://registry.npmjs.org/glicol/-/glicol-0.2.8.tgz",
|
||||
"integrity": "sha512-nNRiZIxc4LXXA2J1AsLch6gGC6R43wyLEE4eDjZPG/t9mciRqRoNGo06Fi1e9kkX/viJgFnD25jzoUPlYkEIHg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@strudel.cycles/glicol",
|
||||
"version": "0.0.1",
|
||||
"description": "Glicol Bindings for Strudel",
|
||||
"main": "index.mjs",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tidalcycles/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
"algorave"
|
||||
],
|
||||
"author": "Felix Roos <flix91@gmail.com>",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://github.com/tidalcycles/strudel/issues"
|
||||
},
|
||||
"homepage": "https://github.com/tidalcycles/strudel#readme",
|
||||
"dependencies": {
|
||||
"glicol": "^0.2.8"
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import '@strudel.cycles/core/speak.mjs';
|
||||
import '@strudel.cycles/tone/pianoroll.mjs';
|
||||
import '@strudel.cycles/tone/draw.mjs';
|
||||
import '@strudel.cycles/osc/osc.mjs';
|
||||
import '@strudel.cycles/glicol';
|
||||
import controls from '@strudel.cycles/core/controls.mjs';
|
||||
|
||||
extend(
|
||||
|
||||
Reference in New Issue
Block a user