Compare commits

...

1 Commits

Author SHA1 Message Date
Felix Roos 1ed8438008 started glicol package 2022-04-15 22:55:40 +02:00
5 changed files with 117 additions and 0 deletions
+27
View File
@@ -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",
+32
View File
@@ -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);
}
+28
View File
@@ -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=="
}
}
}
+29
View File
@@ -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"
}
}
+1
View File
@@ -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(