Continue refactoring

This commit is contained in:
2024-04-14 22:23:11 +02:00
parent 0a6d779867
commit 358195bf97
12 changed files with 147 additions and 152 deletions

View File

@ -40,9 +40,7 @@ import {
soundMap, soundMap,
// @ts-ignore // @ts-ignore
} from "superdough"; } from "superdough";
import { Speaker } from "../Extensions/StringExtensions";
import { getScaleNotes } from "zifferjs"; import { getScaleNotes } from "zifferjs";
import { AbstractEvent, EventOperation } from "../Classes/AbstractEvents";
import drums from "../tidal-drum-machines.json"; import drums from "../tidal-drum-machines.json";
export async function loadSamples() { export async function loadSamples() {
@ -85,7 +83,9 @@ export class UserAPI {
*/ */
public codeExamples: { [key: string]: string } = {}; public codeExamples: { [key: string]: string } = {};
//@ts-ignore
private counters: { [key: string]: any } = {}; private counters: { [key: string]: any } = {};
//@ts-ignore
private _drunk: DrunkWalk = new DrunkWalk(-100, 100, false); private _drunk: DrunkWalk = new DrunkWalk(-100, 100, false);
public randomGen = Math.random; public randomGen = Math.random;
public currentSeed: string | undefined = undefined; public currentSeed: string | undefined = undefined;
@ -241,6 +241,34 @@ export class UserAPI {
snd: any; snd: any;
log: (message: any) => void; log: (message: any) => void;
logOnce: (message: any) => void; logOnce: (message: any) => void;
speak: (text: string, lang?: string, voiceIndex?: number, rate?: number, pitch?: number) => void;
cbar: () => number;
ctick: () => number;
cpulse: () => number;
cbeat: () => number;
ebeat: () => number;
epulse: () => number;
nominator: () => number;
meter: () => number;
denominator: () => number;
pulsesForBar: () => number;
z0!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z1!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z2!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z3!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z4!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z5!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z6!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z7!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z8!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z9!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z10!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z11!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z12!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z13!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z14!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z15!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
z16!: (input: string | Generator<number>, options: InputOptions, id: number | string) => Player;
constructor(public app: Editor) { constructor(public app: Editor) {
this.MidiConnection = new MidiConnection(this, app.settings); this.MidiConnection = new MidiConnection(this, app.settings);
@ -295,7 +323,7 @@ export class UserAPI {
this.food = Canvas.food(); this.food = Canvas.food();
this.animals = Canvas.animals(); this.animals = Canvas.animals();
this.expressions = Canvas.expressions(); this.expressions = Canvas.expressions();
this.generateCacheKey = Cache.generateCacheKey(this.app); this.generateCacheKey = Cache.generateCacheKey();
this.resetAllFromCache = Cache.resetAllFromCache(this.app); this.resetAllFromCache = Cache.resetAllFromCache(this.app);
this.clearPatternCache = Cache.clearPatternCache(this.app); this.clearPatternCache = Cache.clearPatternCache(this.app);
this.removePatternFromCache = Cache.removePatternFromCache(this.app); this.removePatternFromCache = Cache.removePatternFromCache(this.app);
@ -314,11 +342,11 @@ export class UserAPI {
this.drunk_wrap = Drunk.drunk_wrap(this.app); this.drunk_wrap = Drunk.drunk_wrap(this.app);
this.warp = Warp.warp(this.app); this.warp = Warp.warp(this.app);
this.beat_warp = Warp.beat_warp(this.app); this.beat_warp = Warp.beat_warp(this.app);
this.min = Mathematics.min(this.app); this.min = Mathematics.min();
this.max = Mathematics.max(this.app); this.max = Mathematics.max();
this.mean = Mathematics.mean(this.app); this.mean = Mathematics.mean();
this.limit = Mathematics.limit(this.app); this.limit = Mathematics.limit();
this.abs = Mathematics.abs(this.app); this.abs = Mathematics.abs();
this.z = Ziffers.z(this.app); this.z = Ziffers.z(this.app);
Object.assign(this, Ziffers.generateZFunctions(this.app)); Object.assign(this, Ziffers.generateZFunctions(this.app));
this.fullseq = Filters.fullseq(); this.fullseq = Filters.fullseq();
@ -334,7 +362,7 @@ export class UserAPI {
this.onbeat = Filters.onbeat(this.app); this.onbeat = Filters.onbeat(this.app);
this.oncount = Filters.oncount(this.app); this.oncount = Filters.oncount(this.app);
this.oneuclid = Filters.oneuclid(this.app); this.oneuclid = Filters.oneuclid(this.app);
this.euclid = Filters.euclid(this.app); this.euclid = Filters.euclid();
this.ec = this.euclid; this.ec = this.euclid;
this.rhythm = Filters.rhythm(this.app); this.rhythm = Filters.rhythm(this.app);
this.ry = this.rhythm; this.ry = this.rhythm;
@ -343,21 +371,21 @@ export class UserAPI {
this.bin = Filters.bin(); this.bin = Filters.bin();
this.binrhythm = Filters.binrhythm(this.app); this.binrhythm = Filters.binrhythm(this.app);
this.bry = this.binrhythm; this.bry = this.binrhythm;
this.line = LFO.line(this.app); this.line = LFO.line();
this.sine = LFO.sine(this.app); this.sine = LFO.sine(this.app);
this.usine = LFO.usine(this.app); this.usine = LFO.usine(this.app);
this.saw = LFO.saw(this.app); this.saw = LFO.saw(this.app);
this.usaw = LFO.usaw(this.app); this.usaw = LFO.usaw(this.app);
this.triangle = LFO.triangle(this.app); this.triangle = LFO.triangle(this.app);
this.utriangle = LFO.utriangle(this.app); this.utriangle = LFO.utriangle(this.app);
this.square = LFO.square(this.app); this.square = LFO.square();
this.usquare = LFO.usquare(this.app); this.usquare = LFO.usquare();
this.noise = LFO.noise(this.app); this.noise = LFO.noise(this.app);
this.unoise = LFO.unoise(this.app); this.unoise = LFO.unoise(this.app);
this.prob = Probability.prob(this.app); this.prob = Probability.prob(this.app);
this.toss = Probability.toss(this.app); this.toss = Probability.toss(this.app);
this.odds = Probability.odds(this.app); this.odds = Probability.odds(this.app);
this.never = Probability.never(this.app); this.never = Probability.never();
this.almostNever = Probability.almostNever(this.app); this.almostNever = Probability.almostNever(this.app);
this.rarely = Probability.rarely(this.app); this.rarely = Probability.rarely(this.app);
this.scarcely = Probability.scarcely(this.app); this.scarcely = Probability.scarcely(this.app);
@ -365,7 +393,7 @@ export class UserAPI {
this.often = Probability.often(this.app); this.often = Probability.often(this.app);
this.frequently = Probability.frequently(this.app); this.frequently = Probability.frequently(this.app);
this.almostAlways = Probability.almostAlways(this.app); this.almostAlways = Probability.almostAlways(this.app);
this.always = Probability.always(this.app); this.always = Probability.always();
this.dice = Probability.dice(this.app); this.dice = Probability.dice(this.app);
this.osc = OSC.osc(this.app); this.osc = OSC.osc(this.app);
this.getOSC = OSC.getOSC(this.app); this.getOSC = OSC.getOSC(this.app);
@ -382,10 +410,20 @@ export class UserAPI {
this.count = this.counter; this.count = this.counter;
this.i = Counter.i(this.app); this.i = Counter.i(this.app);
this.sound = Sound.sound(this.app); this.sound = Sound.sound(this.app);
this.snd = this.sound; // Alias this.snd = this.sound;
this.speak = Sound.speak(this.app); this.speak = Sound.speak();
this.log = Console.log(this.app); this.log = Console.log(this.app);
this.logOnce = Console.logOnce(this.app); this.logOnce = Console.logOnce(this.app);
this.cbar = Transport.cbar(this.app);
this.ctick = Transport.ctick(this.app);
this.cpulse = Transport.cpulse(this.app);
this.cbeat = Transport.cbeat(this.app);
this.ebeat = Transport.ebeat(this.app);
this.epulse = Transport.epulse(this.app);
this.nominator = Transport.nominator(this.app);
this.meter = Transport.meter(this.app);
this.denominator = Transport.denominator(this.app); // Alias for meter
this.pulsesForBar = Transport.pulsesForBar(this.app);
} }
@ -519,8 +557,6 @@ export class UserAPI {
); );
}; };
// ============================================================= // =============================================================
// Quantification functions // Quantification functions
// ============================================================= // =============================================================
@ -563,79 +599,6 @@ export class UserAPI {
// Time markers // Time markers
// ============================================================= // =============================================================
cbar = (): number => {
/**
* Returns the current bar number
*
* @returns The current bar number
*/
return this.app.clock.time_position.bar + 1;
};
ctick = (): number => {
/**
* Returns the current tick number
*
* @returns The current tick number
*/
return this.app.clock.tick + 1;
};
cpulse = (): number => {
/**
* Returns the current pulse number
*
* @returns The current pulse number
*/
return this.app.clock.time_position.pulse + 1;
};
cbeat = (): number => {
/**
* Returns the current beat number
*
* @returns The current beat number
*/
return this.app.clock.time_position.beat + 1;
};
ebeat = (): number => {
/**
* Returns the current beat number since the origin of time
*/
return this.app.clock.beats_since_origin + 1;
};
epulse = (): number => {
/**
* Returns the current number of pulses elapsed since origin of time
*/
return this.app.clock.pulses_since_origin + 1;
};
nominator = (): number => {
/**
* Returns the current nominator of the time signature
*/
return this.app.clock.time_signature[0];
};
meter = (): number => {
/**
* Returns the current meter (denominator of the time signature)
*/
return this.app.clock.time_signature[1];
};
denominator = this.meter;
pulsesForBar = (): number => {
/**
* Returns the number of pulses in a given bar
*/
return (this.tempo() * this.ppqn() * this.nominator()) / 60;
}
// ============================================================= // =============================================================
// Fill // Fill
// ============================================================= // =============================================================

View File

@ -2,7 +2,7 @@ import { isGenerator, isGeneratorFunction, maybeToNumber } from "../Utils/Generi
import { type Player } from "../Classes/ZPlayer"; import { type Player } from "../Classes/ZPlayer";
export const generateCacheKey = (app: any) => (...args: any[]): string => { export const generateCacheKey = () => (...args: any[]): string => {
return args.map((arg) => JSON.stringify(arg)).join(","); return args.map((arg) => JSON.stringify(arg)).join(",");
}; };

View File

@ -146,7 +146,7 @@ export const oncount = (app: any) => (beats: number[] | number, count: number):
}; };
export const oneuclid = (app: any) => (pulses: number, length: number, rotate: number = 0): boolean => { export const oneuclid = (app: any) => (pulses: number, length: number, rotate: number = 0): boolean => {
const cycle = app._euclidean_cycle(pulses, length, rotate); const cycle = _euclidean_cycle(pulses, length, rotate);
const beats = cycle.reduce((acc: number[], x: boolean, i: number) => { const beats = cycle.reduce((acc: number[], x: boolean, i: number) => {
if (x) acc.push(i + 1); if (x) acc.push(i + 1);
return acc; return acc;
@ -154,11 +154,11 @@ export const oneuclid = (app: any) => (pulses: number, length: number, rotate: n
return oncount(app)(beats, length); return oncount(app)(beats, length);
}; };
export const euclid = (app: any) => (iterator: number, pulses: number, length: number, rotate: number = 0): boolean => { export const euclid = () => (iterator: number, pulses: number, length: number, rotate: number = 0): boolean => {
/** /**
* Returns a Euclidean cycle of size length, with n pulses, rotated or not. * Returns a Euclidean cycle of size length, with n pulses, rotated or not.
*/ */
return app._euclidean_cycle(pulses, length, rotate)[iterator % length]; return _euclidean_cycle(pulses, length, rotate)[iterator % length];
}; };
export const ec = euclid; export const ec = euclid;
@ -167,7 +167,7 @@ export const rhythm = (app: any) => (div: number, pulses: number, length: number
* Returns a rhythm based on Euclidean cycle. * Returns a rhythm based on Euclidean cycle.
*/ */
return ( return (
app.beat(div) && app._euclidean_cycle(pulses, length, rotate).beat(div) app.beat(div) && _euclidean_cycle(pulses, length, rotate).beat(div)
); );
}; };
export const ry = rhythm; export const ry = rhythm;
@ -176,7 +176,7 @@ export const nrhythm = (app: any) => (div: number, pulses: number, length: numbe
/** /**
* Returns a negated rhythm based on Euclidean cycle. * Returns a negated rhythm based on Euclidean cycle.
*/ */
let rhythm = app._euclidean_cycle(pulses, length, rotate).map((n: any) => !n); let rhythm = _euclidean_cycle(pulses, length, rotate).map((n: any) => !n);
return ( return (
app.beat(div) && rhythm.beat(div) app.beat(div) && rhythm.beat(div)
); );

View File

@ -1,4 +1,4 @@
export const line = (app: any) => (start: number, end: number, step: number = 1): number[] => { export const line = () => (start: number, end: number, step: number = 1): number[] => {
const countPlaces = (num: number) => { const countPlaces = (num: number) => {
var text = num.toString(); var text = num.toString();
var index = text.indexOf("."); var index = text.indexOf(".");
@ -46,14 +46,14 @@ export const utriangle = (app: any) => (freq: number = 1, phase: number = 0): nu
return ((triangle(app)(freq, phase) + 1) / 2); return ((triangle(app)(freq, phase) + 1) / 2);
}; };
export const square = (app: any) => (freq: number = 1, duty: number = 0.5): number => { export const square = () => (freq: number = 1, duty: number = 0.5): number => {
const period = 1 / freq; const period = 1 / freq;
const t = (Date.now() / 1000) % period; const t = (Date.now() / 1000) % period;
return (t / period < duty ? 1 : -1); return (t / period < duty ? 1 : -1);
}; };
export const usquare = (app: any) => (freq: number = 1, duty: number = 0.5): number => { export const usquare = () => (freq: number = 1, duty: number = 0.5): number => {
return ((square(app)(freq, duty) + 1) / 2); return ((square()(freq, duty) + 1) / 2);
}; };
export const noise = (app: any) => (): number => { export const noise = (app: any) => (): number => {

View File

@ -161,7 +161,7 @@ export const show_scale = (app: any) => (
soundOff: boolean = false, soundOff: boolean = false,
): void => { ): void => {
if (!app.scale_aid || scale !== app.scale_aid) { if (!app.scale_aid || scale !== app.scale_aid) {
hide_scale(app)(root, scale, channel, port); hide_scale(app)(channel, port);
const scaleNotes = getAllScaleNotes(scale, root); const scaleNotes = getAllScaleNotes(scale, root);
scaleNotes.forEach((note) => { scaleNotes.forEach((note) => {
app.MidiConnection.sendMidiOn(note, channel, 1, port); app.MidiConnection.sendMidiOn(note, channel, 1, port);
@ -172,8 +172,6 @@ export const show_scale = (app: any) => (
}; };
export const hide_scale = (app: any) => ( export const hide_scale = (app: any) => (
root: number | string = 0,
scale: number | string = 0,
channel: number = 0, channel: number = 0,
port: number | string = app.MidiConnection.currentOutputIndex || 0, port: number | string = app.MidiConnection.currentOutputIndex || 0,
): void => { ): void => {

View File

@ -1,19 +1,19 @@
// mathFunctions.ts // mathFunctions.ts
export const min = (app: any) => (...values: number[]): number => { export const min = () => (...values: number[]): number => {
/** /**
* Returns the minimum value of a list of numbers. * Returns the minimum value of a list of numbers.
*/ */
return Math.min(...values); return Math.min(...values);
}; };
export const max = (app: any) => (...values: number[]): number => { export const max = () => (...values: number[]): number => {
/** /**
* Returns the maximum value of a list of numbers. * Returns the maximum value of a list of numbers.
*/ */
return Math.max(...values); return Math.max(...values);
}; };
export const mean = (app: any) => (...values: number[]): number => { export const mean = () => (...values: number[]): number => {
/** /**
* Returns the mean of a list of numbers. * Returns the mean of a list of numbers.
*/ */
@ -21,14 +21,14 @@ export const mean = (app: any) => (...values: number[]): number => {
return values.length > 0 ? sum / values.length : 0; return values.length > 0 ? sum / values.length : 0;
}; };
export const limit = (app: any) => (value: number, min: number, max: number): number => { export const limit = () => (value: number, min: number, max: number): number => {
/** /**
* Limits a value between a minimum and a maximum. * Limits a value between a minimum and a maximum.
*/ */
return Math.min(Math.max(value, min), max); return Math.min(Math.max(value, min), max);
}; };
export const abs = (app: any) => (value: number): number => { export const abs = () => (value: number): number => {
/** /**
* Returns the absolute value of a number. * Returns the absolute value of a number.
*/ */

View File

@ -12,7 +12,7 @@ export const odds = (app: any) => (n: number, beats: number = 1): boolean => {
return app.randomGen() < (n * app.ppqn()) / (app.ppqn() * beats); return app.randomGen() < (n * app.ppqn()) / (app.ppqn() * beats);
}; };
export const never = (app: any) => (beats: number = 1): boolean => { export const never = () => (): boolean => {
return false; return false;
}; };
@ -44,7 +44,7 @@ export const almostAlways = (app: any) => (beats: number = 1): boolean => {
return app.randomGen() < (0.985 * app.ppqn()) / (app.ppqn() * beats); return app.randomGen() < (0.985 * app.ppqn()) / (app.ppqn() * beats);
}; };
export const always = (app: any) => (beats: number = 1): boolean => { export const always = () => (): boolean => {
return true; return true;
}; };

View File

@ -13,7 +13,7 @@ export const sound = (app: any) => (sound: string | string[] | null | undefined)
export const snd = sound; export const snd = sound;
export const speak = (app: any) => (text: string, lang: string = "en-US", voiceIndex: number = 0, rate: number = 1, pitch: number = 1): void => { export const speak = () => (text: string, lang: string = "en-US", voiceIndex: number = 0, rate: number = 1, pitch: number = 1): void => {
/** /**
* Speaks the given text using the browser's speech synthesis API. * Speaks the given text using the browser's speech synthesis API.
* @param text - The text to speak. * @param text - The text to speak.

View File

@ -74,3 +74,41 @@ export const time_signature = (app: any) => (numerator: number, denominator: num
app.clock.time_signature = [numerator, denominator]; app.clock.time_signature = [numerator, denominator];
} }
}; };
export const cbar = (app: any) => (): number => {
return app.clock.time_position.bar + 1;
};
export const ctick = (app: any) => (): number => {
return app.clock.tick + 1;
};
export const cpulse = (app: any) => (): number => {
return app.clock.time_position.pulse + 1;
};
export const cbeat = (app: any) => (): number => {
return app.clock.time_position.beat + 1;
};
export const ebeat = (app: any) => (): number => {
return app.clock.beats_since_origin + 1;
};
export const epulse = (app: any) => (): number => {
return app.clock.pulses_since_origin + 1;
};
export const nominator = (app: any) => (): number => {
return app.clock.time_signature[0];
};
export const meter = (app: any) => (): number => {
return app.clock.time_signature[1];
};
export const denominator = meter; // Alias for meter
export const pulsesForBar = (app: any) => (): number => {
return (app.clock.bpm * app.clock.ppqn * nominator(app)()) / 60;
};

View File

@ -5,7 +5,7 @@ import { generateCacheKey, removePatternFromCache } from "./Cache"
// ziffersFunctions.ts // ziffersFunctions.ts
export const z = (app: any) => (input: string | Generator<number>, options: InputOptions = {}, id: number | string = ""): Player => { export const z = (app: any) => (input: string | Generator<number>, options: InputOptions = {}, id: number | string = ""): Player => {
const zid = "z" + id.toString(); const zid = "z" + id.toString();
const key = id === "" ? generateCacheKey(app)(input, options) : zid; const key = id === "" ? generateCacheKey()(input, options) : zid;
const validSyntax = typeof input === "string" && !app.invalidPatterns[input] const validSyntax = typeof input === "string" && !app.invalidPatterns[input]

View File

@ -80,75 +80,71 @@ export const makeNumberExtensions = (api: UserAPI) => {
}; };
Number.prototype.z0 = function(options: { [key: string]: any } = {}) { Number.prototype.z0 = function(options: { [key: string]: any } = {}) {
return api.z0(this.valueOf().toString().split("").join(" "), options); return api.z0(this.valueOf().toString().split("").join(" "), options, "z0");
}; };
Number.prototype.z1 = function(options: { [key: string]: any } = {}) { Number.prototype.z1 = function(options: { [key: string]: any } = {}) {
return api.z1(this.valueOf().toString().split("").join(" "), options); return api.z1(this.valueOf().toString().split("").join(" "), options, "z1");
}; };
Number.prototype.z2 = function(options: { [key: string]: any } = {}) { Number.prototype.z2 = function(options: { [key: string]: any } = {}) {
return api.z2(this.valueOf().toString().split("").join(" "), options); return api.z2(this.valueOf().toString().split("").join(" "), options, "z2");
}; };
Number.prototype.z3 = function(options: { [key: string]: any } = {}) { Number.prototype.z3 = function(options: { [key: string]: any } = {}) {
return api.z3(this.valueOf().toString().split("").join(" "), options); return api.z3(this.valueOf().toString().split("").join(" "), options, "z3");
}; };
Number.prototype.z4 = function(options: { [key: string]: any } = {}) { Number.prototype.z4 = function(options: { [key: string]: any } = {}) {
return api.z4(this.valueOf().toString().split("").join(" "), options); return api.z4(this.valueOf().toString().split("").join(" "), options, "z4");
}; };
Number.prototype.z5 = function(options: { [key: string]: any } = {}) { Number.prototype.z5 = function(options: { [key: string]: any } = {}) {
return api.z5(this.valueOf().toString().split("").join(" "), options); return api.z5(this.valueOf().toString().split("").join(" "), options, "z5");
}; };
Number.prototype.z6 = function(options: { [key: string]: any } = {}) { Number.prototype.z6 = function(options: { [key: string]: any } = {}) {
return api.z6(this.valueOf().toString().split("").join(" "), options); return api.z6(this.valueOf().toString().split("").join(" "), options, "z6");
}; };
Number.prototype.z7 = function(options: { [key: string]: any } = {}) { Number.prototype.z7 = function(options: { [key: string]: any } = {}) {
return api.z7(this.valueOf().toString().split("").join(" "), options); return api.z7(this.valueOf().toString().split("").join(" "), options, "z7");
}; };
Number.prototype.z8 = function(options: { [key: string]: any } = {}) { Number.prototype.z8 = function(options: { [key: string]: any } = {}) {
return api.z8(this.valueOf().toString().split("").join(" "), options); return api.z8(this.valueOf().toString().split("").join(" "), options, "z8");
}; };
Number.prototype.z9 = function(options: { [key: string]: any } = {}) { Number.prototype.z9 = function(options: { [key: string]: any } = {}) {
return api.z9(this.valueOf().toString().split("").join(" "), options); return api.z9(this.valueOf().toString().split("").join(" "), options, "z9");
}; };
Number.prototype.z10 = function(options: { [key: string]: any } = {}) { Number.prototype.z10 = function(options: { [key: string]: any } = {}) {
return api.z10(this.valueOf().toString().split("").join(" "), options); return api.z10(this.valueOf().toString().split("").join(" "), options, "z10");
}; };
Number.prototype.z11 = function(options: { [key: string]: any } = {}) { Number.prototype.z11 = function(options: { [key: string]: any } = {}) {
return api.z11(this.valueOf().toString().split("").join(" "), options); return api.z11(this.valueOf().toString().split("").join(" "), options, "z11");
}; };
Number.prototype.z12 = function(options: { [key: string]: any } = {}) { Number.prototype.z12 = function(options: { [key: string]: any } = {}) {
return api.z12(this.valueOf().toString().split("").join(" "), options); return api.z12(this.valueOf().toString().split("").join(" "), options, "z12");
}; };
Number.prototype.z13 = function(options: { [key: string]: any } = {}) { Number.prototype.z13 = function(options: { [key: string]: any } = {}) {
return api.z13(this.valueOf().toString().split("").join(" "), options); return api.z13(this.valueOf().toString().split("").join(" "), options, "z13");
}; };
Number.prototype.z14 = function(options: { [key: string]: any } = {}) { Number.prototype.z14 = function(options: { [key: string]: any } = {}) {
return api.z14(this.valueOf().toString().split("").join(" "), options); return api.z14(this.valueOf().toString().split("").join(" "), options, "z14");
}; };
Number.prototype.z15 = function(options: { [key: string]: any } = {}) { Number.prototype.z15 = function(options: { [key: string]: any } = {}) {
return api.z15(this.valueOf().toString().split("").join(" "), options); return api.z15(this.valueOf().toString().split("").join(" "), options, "z15");
}; };
Number.prototype.z16 = function(options: { [key: string]: any } = {}) { Number.prototype.z16 = function(options: { [key: string]: any } = {}) {
return api.z16(this.valueOf().toString().split("").join(" "), options); return api.z16(this.valueOf().toString().split("").join(" "), options, "z16");
};
Number.prototype.midi = function(...kwargs: any[]) {
return api.midi(this.valueOf(), ...kwargs);
}; };
Number.prototype.sound = function(name: string): SoundEvent | SkipEvent { Number.prototype.sound = function(name: string): SoundEvent | SkipEvent {

View File

@ -82,75 +82,75 @@ export const makeStringExtensions = (api: UserAPI) => {
}; };
String.prototype.z = function (options: { [key: string]: any } = {}) { String.prototype.z = function (options: { [key: string]: any } = {}) {
return api.z(this.valueOf(), options); return api.z(this.valueOf(), options, "x");
}; };
String.prototype.z0 = function (options: { [key: string]: any } = {}) { String.prototype.z0 = function (options: { [key: string]: any } = {}) {
return api.z0(this.valueOf(), options); return api.z0(this.valueOf(), options, "z0");
}; };
String.prototype.z1 = function (options: { [key: string]: any } = {}) { String.prototype.z1 = function (options: { [key: string]: any } = {}) {
return api.z1(this.valueOf(), options); return api.z1(this.valueOf(), options, "z1");
}; };
String.prototype.z2 = function (options: { [key: string]: any } = {}) { String.prototype.z2 = function (options: { [key: string]: any } = {}) {
return api.z2(this.valueOf(), options); return api.z2(this.valueOf(), options, "z2");
}; };
String.prototype.z3 = function (options: { [key: string]: any } = {}) { String.prototype.z3 = function (options: { [key: string]: any } = {}) {
return api.z3(this.valueOf(), options); return api.z3(this.valueOf(), options, "z3");
}; };
String.prototype.z4 = function (options: { [key: string]: any } = {}) { String.prototype.z4 = function (options: { [key: string]: any } = {}) {
return api.z4(this.valueOf(), options); return api.z4(this.valueOf(), options, "z4");
}; };
String.prototype.z5 = function (options: { [key: string]: any } = {}) { String.prototype.z5 = function (options: { [key: string]: any } = {}) {
return api.z5(this.valueOf(), options); return api.z5(this.valueOf(), options, "z5");
}; };
String.prototype.z6 = function (options: { [key: string]: any } = {}) { String.prototype.z6 = function (options: { [key: string]: any } = {}) {
return api.z6(this.valueOf(), options); return api.z6(this.valueOf(), options, "z6");
}; };
String.prototype.z7 = function (options: { [key: string]: any } = {}) { String.prototype.z7 = function (options: { [key: string]: any } = {}) {
return api.z7(this.valueOf(), options); return api.z7(this.valueOf(), options, "z7");
}; };
String.prototype.z8 = function (options: { [key: string]: any } = {}) { String.prototype.z8 = function (options: { [key: string]: any } = {}) {
return api.z8(this.valueOf(), options); return api.z8(this.valueOf(), options, "z8");
}; };
String.prototype.z9 = function (options: { [key: string]: any } = {}) { String.prototype.z9 = function (options: { [key: string]: any } = {}) {
return api.z9(this.valueOf(), options); return api.z9(this.valueOf(), options, "z9");
}; };
String.prototype.z10 = function (options: { [key: string]: any } = {}) { String.prototype.z10 = function (options: { [key: string]: any } = {}) {
return api.z10(this.valueOf(), options); return api.z10(this.valueOf(), options, "z10");
}; };
String.prototype.z11 = function (options: { [key: string]: any } = {}) { String.prototype.z11 = function (options: { [key: string]: any } = {}) {
return api.z11(this.valueOf(), options); return api.z11(this.valueOf(), options, "z11");
}; };
String.prototype.z12 = function (options: { [key: string]: any } = {}) { String.prototype.z12 = function (options: { [key: string]: any } = {}) {
return api.z12(this.valueOf(), options); return api.z12(this.valueOf(), options, "z12");
}; };
String.prototype.z13 = function (options: { [key: string]: any } = {}) { String.prototype.z13 = function (options: { [key: string]: any } = {}) {
return api.z13(this.valueOf(), options); return api.z13(this.valueOf(), options, "z13");
}; };
String.prototype.z14 = function (options: { [key: string]: any } = {}) { String.prototype.z14 = function (options: { [key: string]: any } = {}) {
return api.z14(this.valueOf(), options); return api.z14(this.valueOf(), options, "z14");
}; };
String.prototype.z15 = function (options: { [key: string]: any } = {}) { String.prototype.z15 = function (options: { [key: string]: any } = {}) {
return api.z15(this.valueOf(), options); return api.z15(this.valueOf(), options, "z15");
}; };
String.prototype.z16 = function (options: { [key: string]: any } = {}) { String.prototype.z16 = function (options: { [key: string]: any } = {}) {
return api.z16(this.valueOf(), options); return api.z16(this.valueOf(), options, "z16");
}; };
String.prototype.note = function () { String.prototype.note = function () {