mirror of
https://codeberg.org/uzu/strudel
synced 2026-09-24 06:04:13 -04:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1fdd87a4f3 | |||
| 16e9aca222 |
@@ -8,7 +8,7 @@ import { logger } from './logger.mjs';
|
||||
import { ClockCollator, cycleToSeconds } from './util.mjs';
|
||||
|
||||
export class NeoCyclist {
|
||||
constructor({ onTrigger, onToggle, getTime, latency = 0.1 }) {
|
||||
constructor({ onTrigger, onToggle, getTime }) {
|
||||
this.started = false;
|
||||
this.cps = 0.5;
|
||||
this.lastTick = 0; // absolute time when last tick (clock callback) happened
|
||||
@@ -20,7 +20,7 @@ export class NeoCyclist {
|
||||
// in order to schedule events consistently.
|
||||
this.collator = new ClockCollator({ getTargetClockTime: getTime });
|
||||
this.onToggle = onToggle;
|
||||
this.latency = latency; // fixed trigger time offset
|
||||
this.latency = 0.1; // fixed trigger time offset
|
||||
this.cycle = 0;
|
||||
this.id = Math.round(Date.now() * Math.random());
|
||||
this.worker = new SharedWorker(new URL('./clockworker.js', import.meta.url));
|
||||
|
||||
@@ -18,7 +18,6 @@ export function repl({
|
||||
editPattern,
|
||||
onUpdateState,
|
||||
sync = false,
|
||||
latency = 0.1,
|
||||
setInterval,
|
||||
clearInterval,
|
||||
id,
|
||||
@@ -57,7 +56,6 @@ export function repl({
|
||||
setInterval,
|
||||
clearInterval,
|
||||
beforeStart,
|
||||
latency,
|
||||
};
|
||||
|
||||
// NeoCyclist uses a shared worker to communicate between instances, which is not supported on mobile chrome
|
||||
|
||||
@@ -42,6 +42,7 @@ lib['%'] = pace;
|
||||
lib['?'] = degradeBy; // todo: default 0.5 not working..
|
||||
lib[':'] = tail;
|
||||
lib['..'] = range;
|
||||
lib['def'] = () => silence;
|
||||
lib['or'] = (...children) => chooseIn(...children); // always has structure but is cyclewise.. e.g. "s oh*8.dec[.04 | .5]"
|
||||
//lib['or'] = (...children) => chooseOut(...children); // "s oh*8.dec[.04 | .5]" is better but "dec[.04 | .5].s oh*8" has no struct
|
||||
|
||||
|
||||
@@ -176,3 +176,16 @@ $ chord <Dm9!3 Db7> # voicing
|
||||
/>
|
||||
|
||||
The `$` sign is an alias for `,` so it will create a stack behind the scenes.
|
||||
|
||||
## variables
|
||||
|
||||
using the `def` keyword, you can define variables:
|
||||
|
||||
<MiniRepl
|
||||
client:idle
|
||||
mondo
|
||||
tune={`
|
||||
$ def melody [0 1 2 3]
|
||||
$ n melody # scale C:minor
|
||||
`}
|
||||
/>
|
||||
|
||||
@@ -108,7 +108,6 @@ export function SettingsTab({ started }) {
|
||||
audioEngineTarget,
|
||||
togglePanelTrigger,
|
||||
maxPolyphony,
|
||||
latency,
|
||||
multiChannelOrbits,
|
||||
isTabIndentationEnabled,
|
||||
isMultiCursorEnabled,
|
||||
@@ -166,24 +165,6 @@ export function SettingsTab({ started }) {
|
||||
value={maxPolyphony ?? ''}
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem label="Latency">
|
||||
<Textbox
|
||||
min={0}
|
||||
max={Infinity}
|
||||
onBlur={(e) => {
|
||||
let v = parseFloat(e.target.value);
|
||||
v = isNaN(v) ? 0.1 : v;
|
||||
settingsMap.setKey('latency', v);
|
||||
}}
|
||||
onChange={(v) => {
|
||||
v = parseFloat(v);
|
||||
settingsMap.setKey('latency', isNaN(v) ? undefined : v);
|
||||
}}
|
||||
type="number"
|
||||
placeholder=""
|
||||
value={latency ?? 0.1}
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem>
|
||||
<Checkbox
|
||||
label="Multi Channel Orbits"
|
||||
|
||||
@@ -37,7 +37,7 @@ import './Repl.css';
|
||||
import { setInterval, clearInterval } from 'worker-timers';
|
||||
import { getMetadata } from '../metadata_parser';
|
||||
|
||||
const { latestCode, maxPolyphony, audioDeviceName, multiChannelOrbits, latency } = settingsMap.get();
|
||||
const { latestCode, maxPolyphony, audioDeviceName, multiChannelOrbits } = settingsMap.get();
|
||||
let modulesLoading, presets, drawContext, clearCanvas, audioReady;
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
@@ -73,7 +73,6 @@ export function useReplContext() {
|
||||
const drawContext = getDrawContext();
|
||||
const editor = new StrudelMirror({
|
||||
sync: isSyncEnabled,
|
||||
latency,
|
||||
defaultOutput,
|
||||
getTime,
|
||||
setInterval,
|
||||
|
||||
Reference in New Issue
Block a user