Merge remote-tracking branch 'origin/main' into binaries

This commit is contained in:
Felix Roos 2022-11-10 10:11:47 +01:00
commit f0b099d9f7
293 changed files with 51427 additions and 15289 deletions

View file

@ -35,3 +35,5 @@ s("<bd sd> hh").osc()
```
or just [click here](http://localhost:3000/#cygiPGJkIHNkPiBoaCIpLm9zYygp)...
You can read more about [how to use Superdirt with Strudel the Tutorial](https://strudel.tidalcycles.org/tutorial/#superdirt-api)

View file

@ -5,7 +5,7 @@ This program is free software: you can redistribute it and/or modify it under th
*/
import OSC from 'osc-js';
import { Pattern } from '@strudel.cycles/core';
import { parseNumeral, Pattern } from '@strudel.cycles/core';
const comm = new OSC();
comm.open();
@ -22,13 +22,19 @@ let startedAt = -1;
*/
Pattern.prototype.osc = function () {
return this._withHap((hap) => {
const onTrigger = (time, hap, currentTime, cps, cycle, delta) => {
const onTrigger = (time, hap, currentTime, cps) => {
const cycle = hap.wholeOrPart().begin.valueOf();
const delta = hap.duration.valueOf();
// time should be audio time of onset
// currentTime should be current time of audio context (slightly before time)
if (startedAt < 0) {
startedAt = Date.now() - currentTime * 1000;
}
const controls = Object.assign({}, { cps: cps, cycle: cycle, delta: delta }, hap.value);
const controls = Object.assign({}, { cps, cycle, delta }, hap.value);
// make sure n and note are numbers
controls.n && (controls.n = parseNumeral(controls.n));
controls.note && (controls.note = parseNumeral(controls.note));
const keyvals = Object.entries(controls).flat();
const ts = Math.floor(startedAt + (time + latency) * 1000);
const message = new OSC.Message('/dirt/play', ...keyvals);

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/osc",
"version": "0.1.0",
"version": "0.2.0",
"description": "OSC messaging for strudel",
"main": "osc.mjs",
"scripts": {
@ -31,7 +31,7 @@
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"osc-js": "^2.3.2"
"osc-js": "^2.4.0"
},
"devDependencies": {
"pkg": "^5.7.0"