lint
This commit is contained in:
16
src/API.ts
16
src/API.ts
@ -1581,7 +1581,9 @@ export class UserAPI {
|
||||
// Low Frequency Oscillators
|
||||
// =============================================================
|
||||
|
||||
line = (start: number, end: number, step: number = 1): number[] => {
|
||||
public range = (v: number, a: number, b: number): number => v * (b - a) + a;
|
||||
|
||||
public line = (start: number, end: number, step: number = 1): number[] => {
|
||||
/**
|
||||
* Returns an array of values between start and end, with a given step.
|
||||
*
|
||||
@ -1603,7 +1605,11 @@ export class UserAPI {
|
||||
return result;
|
||||
};
|
||||
|
||||
sine = (freq: number = 1, times: number = 1, offset: number = 0): number => {
|
||||
public sine = (
|
||||
freq: number = 1,
|
||||
times: number = 1,
|
||||
offset: number = 0,
|
||||
): number => {
|
||||
/**
|
||||
* Returns a sine wave between -1 and 1.
|
||||
*
|
||||
@ -1617,7 +1623,11 @@ export class UserAPI {
|
||||
);
|
||||
};
|
||||
|
||||
usine = (freq: number = 1, times: number = 1, offset: number = 0): number => {
|
||||
public usine = (
|
||||
freq: number = 1,
|
||||
times: number = 1,
|
||||
offset: number = 0,
|
||||
): number => {
|
||||
/**
|
||||
* Returns a sine wave between 0 and 1.
|
||||
*
|
||||
|
||||
67
src/Clock.ts
67
src/Clock.ts
@ -4,7 +4,8 @@ import { tryEvaluate } from "./Evaluator";
|
||||
import { getAudioContext } from "superdough";
|
||||
// @ts-ignore
|
||||
import "zyklus";
|
||||
const zeroPad = (num: number, places: number) => String(num).padStart(places, "0");
|
||||
const zeroPad = (num: number, places: number) =>
|
||||
String(num).padStart(places, "0");
|
||||
|
||||
export interface TimePosition {
|
||||
/**
|
||||
@ -61,35 +62,37 @@ export class Clock {
|
||||
this.running = true;
|
||||
this.deadline = 0;
|
||||
this.timeviewer = document.getElementById("timeviewer")!;
|
||||
this.clock = getAudioContext().createClock(this.clockCallback, this.pulse_duration)
|
||||
}
|
||||
this.clock = getAudioContext().createClock(
|
||||
this.clockCallback,
|
||||
this.pulse_duration,
|
||||
);
|
||||
}
|
||||
|
||||
clockCallback = (time: number, duration: number, tick: number) => {
|
||||
let deadline = time - getAudioContext().currentTime;
|
||||
this.deadline = deadline;
|
||||
this.tick = tick;
|
||||
if (this.app.clock.running) {
|
||||
if (this.app.settings.send_clock) {
|
||||
this.app.api.MidiConnection.sendMidiClock();
|
||||
}
|
||||
const futureTimeStamp = this.app.clock.convertTicksToTimeposition(
|
||||
this.app.clock.tick,
|
||||
);
|
||||
this.app.clock.time_position = futureTimeStamp;
|
||||
if (futureTimeStamp.pulse % this.app.clock.ppqn == 0) {
|
||||
this.timeviewer.innerHTML = `${zeroPad(futureTimeStamp.bar, 2)}:${
|
||||
futureTimeStamp.beat + 1
|
||||
} / ${this.app.clock.bpm}`;
|
||||
}
|
||||
if (this.app.exampleIsPlaying) {
|
||||
tryEvaluate(this.app, this.app.example_buffer);
|
||||
} else {
|
||||
tryEvaluate(this.app, this.app.global_buffer);
|
||||
}
|
||||
}
|
||||
if (this.app.clock.running) {
|
||||
if (this.app.settings.send_clock) {
|
||||
this.app.api.MidiConnection.sendMidiClock();
|
||||
}
|
||||
const futureTimeStamp = this.app.clock.convertTicksToTimeposition(
|
||||
this.app.clock.tick,
|
||||
);
|
||||
this.app.clock.time_position = futureTimeStamp;
|
||||
if (futureTimeStamp.pulse % this.app.clock.ppqn == 0) {
|
||||
this.timeviewer.innerHTML = `${zeroPad(futureTimeStamp.bar, 2)}:${
|
||||
futureTimeStamp.beat + 1
|
||||
} / ${this.app.clock.bpm}`;
|
||||
}
|
||||
if (this.app.exampleIsPlaying) {
|
||||
tryEvaluate(this.app, this.app.example_buffer);
|
||||
} else {
|
||||
tryEvaluate(this.app, this.app.global_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
// Implement TransportNode clock callback and update clock info with it
|
||||
|
||||
};
|
||||
|
||||
convertTicksToTimeposition(ticks: number): TimePosition {
|
||||
@ -108,27 +111,27 @@ export class Clock {
|
||||
}
|
||||
|
||||
get next_beat_in_ticks(): number {
|
||||
return this.app.clock.pulses_since_origin + this.time_position.pulse;
|
||||
return this.app.clock.pulses_since_origin + this.time_position.pulse;
|
||||
}
|
||||
|
||||
get beats_per_bar(): number {
|
||||
return this.time_signature[0];
|
||||
return this.time_signature[0];
|
||||
}
|
||||
|
||||
get beats_since_origin(): number {
|
||||
return Math.floor(this.tick / this.ppqn);
|
||||
return Math.floor(this.tick / this.ppqn);
|
||||
}
|
||||
|
||||
get pulses_since_origin(): number {
|
||||
return this.tick;
|
||||
return this.tick;
|
||||
}
|
||||
|
||||
get pulse_duration(): number {
|
||||
return 60 / this.bpm / this.ppqn;
|
||||
return 60 / this.bpm / this.ppqn;
|
||||
}
|
||||
|
||||
public pulse_duration_at_bpm(bpm: number = this.bpm): number {
|
||||
return 60 / bpm / this.ppqn;
|
||||
return 60 / bpm / this.ppqn;
|
||||
}
|
||||
|
||||
get bpm(): number {
|
||||
@ -162,7 +165,7 @@ export class Clock {
|
||||
}
|
||||
|
||||
public nextTickFrom(time: number, nudge: number): number {
|
||||
const pulseDuration = this.pulse_duration;
|
||||
const pulseDuration = this.pulse_duration;
|
||||
const nudgedTime = time + nudge;
|
||||
const nextTickTime = Math.ceil(nudgedTime / pulseDuration) * pulseDuration;
|
||||
const remainingTime = nextTickTime - nudgedTime;
|
||||
@ -183,13 +186,13 @@ export class Clock {
|
||||
this.app.audioContext.resume();
|
||||
this.running = true;
|
||||
this.app.api.MidiConnection.sendStartMessage();
|
||||
this.clock.start()
|
||||
this.clock.start();
|
||||
}
|
||||
|
||||
public pause(): void {
|
||||
this.running = false;
|
||||
this.app.api.MidiConnection.sendStopMessage();
|
||||
this.clock.pause()
|
||||
this.clock.pause();
|
||||
}
|
||||
|
||||
public stop(): void {
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
import { tryEvaluate } from "./Evaluator";
|
||||
const zeroPad = (num, places) => String(num).padStart(places, "0");
|
||||
|
||||
export class TransportNode extends AudioWorkletNode {
|
||||
constructor(context, options, application) {
|
||||
super(context, "transport", options);
|
||||
this.app = application;
|
||||
this.port.addEventListener("message", this.handleMessage);
|
||||
this.port.start();
|
||||
this.timeviewer = document.getElementById("timeviewer");
|
||||
}
|
||||
|
||||
/** @type {(this: MessagePort, ev: MessageEvent<any>) => any} */
|
||||
handleMessage = (message) => {
|
||||
if (message.data) {
|
||||
if (message.data.type === "bang") {
|
||||
if (this.app.clock.running) {
|
||||
if (this.app.settings.send_clock) {
|
||||
this.app.api.MidiConnection.sendMidiClock();
|
||||
}
|
||||
const futureTimeStamp = this.app.clock.convertTicksToTimeposition(
|
||||
this.app.clock.tick,
|
||||
);
|
||||
this.app.clock.time_position = futureTimeStamp;
|
||||
if (futureTimeStamp.pulse % this.app.clock.ppqn == 0) {
|
||||
this.timeviewer.innerHTML = `${zeroPad(futureTimeStamp.bar, 2)}:${
|
||||
futureTimeStamp.beat + 1
|
||||
} / ${this.app.clock.bpm}`;
|
||||
}
|
||||
if (this.app.exampleIsPlaying) {
|
||||
tryEvaluate(this.app, this.app.example_buffer);
|
||||
} else {
|
||||
tryEvaluate(this.app, this.app.global_buffer);
|
||||
}
|
||||
this.app.clock.incrementTick(message.data.bpm);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
start() {
|
||||
this.port.postMessage({ type: "start" });
|
||||
}
|
||||
|
||||
pause() {
|
||||
this.port.postMessage({ type: "pause" });
|
||||
}
|
||||
|
||||
resume() {
|
||||
this.port.postMessage({ type: "resume" });
|
||||
}
|
||||
|
||||
setBPM(bpm) {
|
||||
this.port.postMessage({ type: "bpm", value: bpm });
|
||||
}
|
||||
|
||||
setPPQN(ppqn) {
|
||||
this.port.postMessage({ type: "ppqn", value: ppqn });
|
||||
}
|
||||
|
||||
setNudge(nudge) {
|
||||
this.port.postMessage({ type: "nudge", value: nudge });
|
||||
}
|
||||
|
||||
stop() {
|
||||
this.port.postMessage({ type: "stop" });
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,11 @@
|
||||
import { type Editor } from "../main";
|
||||
import { freqToMidi, chord as parseChord, noteNameToMidi, resolvePitchBend, safeScale } from "zifferjs";
|
||||
import {
|
||||
freqToMidi,
|
||||
chord as parseChord,
|
||||
noteNameToMidi,
|
||||
resolvePitchBend,
|
||||
safeScale,
|
||||
} from "zifferjs";
|
||||
import { SkipEvent } from "./SkipEvent";
|
||||
|
||||
export type EventOperation<T> = (instance: T, ...args: any[]) => void;
|
||||
@ -311,16 +317,16 @@ export abstract class AudibleEvent extends AbstractEvent {
|
||||
return this;
|
||||
};
|
||||
|
||||
protected updateValue<T>(
|
||||
key: string,
|
||||
value: T | T[] | null
|
||||
): this {
|
||||
protected updateValue<T>(key: string, value: T | T[] | null): this {
|
||||
if (value == null) return this;
|
||||
this.values[key] = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public note = (value: number | string | null, ...kwargs: number[]|string[]) => {
|
||||
public note = (
|
||||
value: number | string | null,
|
||||
...kwargs: number[] | string[]
|
||||
) => {
|
||||
if (typeof value === "string") {
|
||||
const parsedNote = noteNameToMidi(value);
|
||||
return this.updateValue("note", [parsedNote, ...kwargs].flat(Infinity));
|
||||
@ -331,8 +337,8 @@ export abstract class AudibleEvent extends AbstractEvent {
|
||||
}
|
||||
};
|
||||
|
||||
public chord = (value: number|string, ...kwargs: number[]) => {
|
||||
if(typeof value === "string") {
|
||||
public chord = (value: number | string, ...kwargs: number[]) => {
|
||||
if (typeof value === "string") {
|
||||
const chord = parseChord(value);
|
||||
return this.updateValue("note", chord);
|
||||
} else {
|
||||
|
||||
@ -5,10 +5,7 @@ import {
|
||||
arrayOfObjectsToObjectWithArrays,
|
||||
objectWithArraysToArrayOfObjects,
|
||||
} from "../Utils/Generic";
|
||||
import {
|
||||
midiToFreq,
|
||||
noteFromPc,
|
||||
} from "zifferjs";
|
||||
import { midiToFreq, noteFromPc } from "zifferjs";
|
||||
|
||||
import {
|
||||
superdough,
|
||||
@ -66,7 +63,7 @@ export class SoundEvent extends AudibleEvent {
|
||||
phaserDepth: ["phaserDepth", "phasdepth"],
|
||||
phaserSweep: ["phaserSweep", "phassweep"],
|
||||
phaserCenter: ["phaserCenter", "phascenter"],
|
||||
fmadsr: function(
|
||||
fmadsr: function (
|
||||
self: SoundEvent,
|
||||
a: number,
|
||||
d: number,
|
||||
@ -79,7 +76,7 @@ export class SoundEvent extends AudibleEvent {
|
||||
self.updateValue("fmrelease", r);
|
||||
return self;
|
||||
},
|
||||
fmad: function(self: SoundEvent, a: number, d: number) {
|
||||
fmad: function (self: SoundEvent, a: number, d: number) {
|
||||
self.updateValue("fmattack", a);
|
||||
self.updateValue("fmdecay", d);
|
||||
return self;
|
||||
@ -90,7 +87,7 @@ export class SoundEvent extends AudibleEvent {
|
||||
decay: ["decay", "dec"],
|
||||
sustain: ["sustain", "sus"],
|
||||
release: ["release", "rel"],
|
||||
adsr: function(
|
||||
adsr: function (
|
||||
self: SoundEvent,
|
||||
a: number,
|
||||
d: number,
|
||||
@ -103,21 +100,21 @@ export class SoundEvent extends AudibleEvent {
|
||||
self.updateValue("release", r);
|
||||
return self;
|
||||
},
|
||||
ad: function(self: SoundEvent, a: number, d: number) {
|
||||
ad: function (self: SoundEvent, a: number, d: number) {
|
||||
self.updateValue("attack", a);
|
||||
self.updateValue("decay", d);
|
||||
self.updateValue("sustain", 0.0);
|
||||
self.updateValue("release", 0.0);
|
||||
return self;
|
||||
},
|
||||
scope: function(self: SoundEvent) {
|
||||
self.updateValue("analyze", true)
|
||||
return self
|
||||
scope: function (self: SoundEvent) {
|
||||
self.updateValue("analyze", true);
|
||||
return self;
|
||||
},
|
||||
debug: function(self: SoundEvent, callback?: Function) {
|
||||
self.updateValue("debug", true)
|
||||
debug: function (self: SoundEvent, callback?: Function) {
|
||||
self.updateValue("debug", true);
|
||||
if (callback) {
|
||||
self.updateValue("debugFunction", callback)
|
||||
self.updateValue("debugFunction", callback);
|
||||
}
|
||||
return self;
|
||||
},
|
||||
@ -126,27 +123,27 @@ export class SoundEvent extends AudibleEvent {
|
||||
lpdecay: ["lpdecay", "lpd"],
|
||||
lpsustain: ["lpsustain", "lps"],
|
||||
lprelease: ["lprelease", "lpr"],
|
||||
cutoff: function(self: SoundEvent, value: number, resonance?: number) {
|
||||
cutoff: function (self: SoundEvent, value: number, resonance?: number) {
|
||||
self.updateValue("cutoff", value);
|
||||
if (resonance) {
|
||||
self.updateValue("resonance", resonance);
|
||||
}
|
||||
return self;
|
||||
},
|
||||
lpf: function(self: SoundEvent, value: number, resonance?: number) {
|
||||
lpf: function (self: SoundEvent, value: number, resonance?: number) {
|
||||
self.updateValue("cutoff", value);
|
||||
if (resonance) {
|
||||
self.updateValue("resonance", resonance);
|
||||
}
|
||||
return self;
|
||||
},
|
||||
resonance: function(self: SoundEvent, value: number) {
|
||||
resonance: function (self: SoundEvent, value: number) {
|
||||
if (value >= 0 && value <= 1) {
|
||||
self.updateValue("resonance", 50 * value);
|
||||
}
|
||||
return self;
|
||||
},
|
||||
lpadsr: function(
|
||||
lpadsr: function (
|
||||
self: SoundEvent,
|
||||
depth: number,
|
||||
a: number,
|
||||
@ -161,7 +158,7 @@ export class SoundEvent extends AudibleEvent {
|
||||
self.updateValue("lprelease", r);
|
||||
return self;
|
||||
},
|
||||
lpad: function(self: SoundEvent, depth: number, a: number, d: number) {
|
||||
lpad: function (self: SoundEvent, depth: number, a: number, d: number) {
|
||||
self.updateValue("lpenv", depth);
|
||||
self.updateValue("lpattack", a);
|
||||
self.updateValue("lpdecay", d);
|
||||
@ -174,25 +171,25 @@ export class SoundEvent extends AudibleEvent {
|
||||
hpdecay: ["hpdecay", "hpd"],
|
||||
hpsustain: ["hpsustain", "hpsus"],
|
||||
hprelease: ["hprelease", "hpr"],
|
||||
hcutoff: function(self: SoundEvent, value: number, resonance?: number) {
|
||||
hcutoff: function (self: SoundEvent, value: number, resonance?: number) {
|
||||
self.updateValue("hcutoff", value);
|
||||
if (resonance) {
|
||||
self.updateValue("hresonance", resonance);
|
||||
}
|
||||
return self;
|
||||
},
|
||||
hpf: function(self: SoundEvent, value: number, resonance?: number) {
|
||||
hpf: function (self: SoundEvent, value: number, resonance?: number) {
|
||||
self.updateValue("hcutoff", value);
|
||||
if (resonance) {
|
||||
self.updateValue("hresonance", resonance);
|
||||
}
|
||||
return self;
|
||||
},
|
||||
hpq: function(self: SoundEvent, value: number) {
|
||||
hpq: function (self: SoundEvent, value: number) {
|
||||
self.updateValue("hresonance", value);
|
||||
return self;
|
||||
},
|
||||
hpadsr: function(
|
||||
hpadsr: function (
|
||||
self: SoundEvent,
|
||||
depth: number,
|
||||
a: number,
|
||||
@ -207,7 +204,7 @@ export class SoundEvent extends AudibleEvent {
|
||||
self.updateValue("hprelease", r);
|
||||
return self;
|
||||
},
|
||||
hpad: function(self: SoundEvent, depth: number, a: number, d: number) {
|
||||
hpad: function (self: SoundEvent, depth: number, a: number, d: number) {
|
||||
self.updateValue("hpenv", depth);
|
||||
self.updateValue("hpattack", a);
|
||||
self.updateValue("hpdecay", d);
|
||||
@ -220,14 +217,14 @@ export class SoundEvent extends AudibleEvent {
|
||||
bpdecay: ["bpdecay", "bpd"],
|
||||
bpsustain: ["bpsustain", "bps"],
|
||||
bprelease: ["bprelease", "bpr"],
|
||||
bandf: function(self: SoundEvent, value: number, resonance?: number) {
|
||||
bandf: function (self: SoundEvent, value: number, resonance?: number) {
|
||||
self.updateValue("bandf", value);
|
||||
if (resonance) {
|
||||
self.updateValue("bandq", resonance);
|
||||
}
|
||||
return self;
|
||||
},
|
||||
bpf: function(self: SoundEvent, value: number, resonance?: number) {
|
||||
bpf: function (self: SoundEvent, value: number, resonance?: number) {
|
||||
self.updateValue("bandf", value);
|
||||
if (resonance) {
|
||||
self.updateValue("bandq", resonance);
|
||||
@ -235,7 +232,7 @@ export class SoundEvent extends AudibleEvent {
|
||||
return self;
|
||||
},
|
||||
bandq: ["bandq", "bpq"],
|
||||
bpadsr: function(
|
||||
bpadsr: function (
|
||||
self: SoundEvent,
|
||||
depth: number,
|
||||
a: number,
|
||||
@ -250,7 +247,7 @@ export class SoundEvent extends AudibleEvent {
|
||||
self.updateValue("bprelease", r);
|
||||
return self;
|
||||
},
|
||||
bpad: function(self: SoundEvent, depth: number, a: number, d: number) {
|
||||
bpad: function (self: SoundEvent, depth: number, a: number, d: number) {
|
||||
self.updateValue("bpenv", depth);
|
||||
self.updateValue("bpattack", a);
|
||||
self.updateValue("bpdecay", d);
|
||||
@ -260,7 +257,7 @@ export class SoundEvent extends AudibleEvent {
|
||||
},
|
||||
vib: ["vib"],
|
||||
vibmod: ["vibmod"],
|
||||
fm: function(self: SoundEvent, value: number | string) {
|
||||
fm: function (self: SoundEvent, value: number | string) {
|
||||
if (typeof value === "number") {
|
||||
self.values["fmi"] = value;
|
||||
} else {
|
||||
@ -276,11 +273,11 @@ export class SoundEvent extends AudibleEvent {
|
||||
begin: ["begin"],
|
||||
end: ["end"],
|
||||
gain: ["gain"],
|
||||
dbgain: function(self: SoundEvent, value: number) {
|
||||
dbgain: function (self: SoundEvent, value: number) {
|
||||
self.updateValue("gain", Math.min(Math.pow(10, value / 20), 10));
|
||||
return self;
|
||||
},
|
||||
db: function(self: SoundEvent, value: number) {
|
||||
db: function (self: SoundEvent, value: number) {
|
||||
self.updateValue("gain", Math.min(Math.pow(10, value / 20), 10));
|
||||
return self;
|
||||
},
|
||||
@ -303,32 +300,32 @@ export class SoundEvent extends AudibleEvent {
|
||||
roomlp: ["roomlp", "rlp"],
|
||||
roomdim: ["roomdim", "rdim"],
|
||||
sound: ["s", "sound"],
|
||||
size: function(self: SoundEvent, value: number) {
|
||||
size: function (self: SoundEvent, value: number) {
|
||||
self.updateValue("roomsize", value);
|
||||
return self;
|
||||
},
|
||||
sz: function(self: SoundEvent, value: number) {
|
||||
sz: function (self: SoundEvent, value: number) {
|
||||
self.updateValue("roomsize", value);
|
||||
return self;
|
||||
},
|
||||
comp: ["compressor", "cmp"],
|
||||
ratio: function(self: SoundEvent, value: number) {
|
||||
ratio: function (self: SoundEvent, value: number) {
|
||||
self.updateValue("compressorRatio", value);
|
||||
return self;
|
||||
},
|
||||
knee: function(self: SoundEvent, value: number) {
|
||||
knee: function (self: SoundEvent, value: number) {
|
||||
self.updateValue("compressorKnee", value);
|
||||
return self;
|
||||
},
|
||||
compAttack: function(self: SoundEvent, value: number) {
|
||||
compAttack: function (self: SoundEvent, value: number) {
|
||||
self.updateValue("compressorAttack", value);
|
||||
return self;
|
||||
},
|
||||
compRelease: function(self: SoundEvent, value: number) {
|
||||
compRelease: function (self: SoundEvent, value: number) {
|
||||
self.updateValue("compressorRelease", value);
|
||||
return self;
|
||||
},
|
||||
stretch: function(self: SoundEvent, beat: number) {
|
||||
stretch: function (self: SoundEvent, beat: number) {
|
||||
self.updateValue("unit", "c");
|
||||
self.updateValue("speed", 1 / beat);
|
||||
self.updateValue("cut", beat);
|
||||
@ -467,16 +464,12 @@ export class SoundEvent extends AudibleEvent {
|
||||
}
|
||||
if (this.values["debug"]) {
|
||||
if (this.values["debugFunction"]) {
|
||||
this.values["debugFunction"](filteredEvent)
|
||||
this.values["debugFunction"](filteredEvent);
|
||||
} else {
|
||||
console.log(filteredEvent)
|
||||
console.log(filteredEvent);
|
||||
}
|
||||
}
|
||||
superdough(
|
||||
filteredEvent,
|
||||
this.app.clock.deadline,
|
||||
filteredEvent.dur,
|
||||
);
|
||||
superdough(filteredEvent, this.app.clock.deadline, filteredEvent.dur);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -10,17 +10,18 @@ You can turn on the oscilloscope to generate interesting visuals or to inspect a
|
||||
You need to manually feed the scope with the sounds you want to inspect:
|
||||
|
||||
${makeExample(
|
||||
"Feeding a sine to the oscilloscope",
|
||||
`
|
||||
"Feeding a sine to the oscilloscope",
|
||||
`
|
||||
beat(1)::sound('sine').freq(200).ad(0, .2).scope().out()
|
||||
`, true
|
||||
)}
|
||||
`,
|
||||
true,
|
||||
)}
|
||||
|
||||
Here is a layout of the scope configuration options:
|
||||
|
||||
${makeExample(
|
||||
"Oscilloscope configuration",
|
||||
`
|
||||
"Oscilloscope configuration",
|
||||
`
|
||||
scope({
|
||||
enabled: true, // off by default
|
||||
color: "#fdba74", // any valid CSS color or "random"
|
||||
@ -34,12 +35,12 @@ scope({
|
||||
refresh: 1 // refresh rate (in pulses)
|
||||
})
|
||||
`,
|
||||
true,
|
||||
)}
|
||||
true,
|
||||
)}
|
||||
|
||||
${makeExample(
|
||||
"Demo with multiple scope mode",
|
||||
`
|
||||
"Demo with multiple scope mode",
|
||||
`
|
||||
rhythm(.5, [4,5].dur(4*3, 4*1), 8)::sound('fhardkick').out()
|
||||
beat(0.25)::sound('square').freq([
|
||||
[250, 250/2, 250/4].pick(),
|
||||
@ -55,8 +56,8 @@ scope({enabled: true, thickness: 8,
|
||||
color: ['purple', 'green', 'random'].beat(),
|
||||
size: 0.5, fftSize: 2048})
|
||||
`,
|
||||
true,
|
||||
)}
|
||||
true,
|
||||
)}
|
||||
|
||||
Note that these values can be patterned as well! You can transform the oscilloscope into its own light show if you want. The picture is not stable anyway so you won't have much use of it for precision work :)
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ declare global {
|
||||
z15(): Player;
|
||||
z16(): Player;
|
||||
midi(): MidiEvent;
|
||||
sound(name: string): SoundEvent|SkipEvent;
|
||||
sound(name: string): SoundEvent | SkipEvent;
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ export const makeNumberExtensions = (api: UserAPI) => {
|
||||
return api.midi(this.valueOf(), ...kwargs);
|
||||
};
|
||||
|
||||
Number.prototype.sound = function (name: string): SoundEvent|SkipEvent {
|
||||
Number.prototype.sound = function (name: string): SoundEvent | SkipEvent {
|
||||
if (Number.isInteger(this.valueOf())) {
|
||||
return (api.sound(name) as SoundEvent).note(this.valueOf());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user