Adding bry shortcut for binrhythm
This commit is contained in:
@ -1650,6 +1650,7 @@ export class UserAPI {
|
|||||||
let tobin: boolean[] = convert.split("").map((x: string) => x === "1");
|
let tobin: boolean[] = convert.split("").map((x: string) => x === "1");
|
||||||
return this.beat(div) && tobin.beat(div);
|
return this.beat(div) && tobin.beat(div);
|
||||||
};
|
};
|
||||||
|
bry = this.binrhythm;
|
||||||
|
|
||||||
// =============================================================
|
// =============================================================
|
||||||
// Low Frequency Oscillators
|
// Low Frequency Oscillators
|
||||||
@ -1775,7 +1776,7 @@ export class UserAPI {
|
|||||||
* @see noise
|
* @see noise
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2659,4 +2660,5 @@ export class UserAPI {
|
|||||||
public getThemes = (): string[] => {
|
public getThemes = (): string[] => {
|
||||||
return Object.keys(colorschemes);
|
return Object.keys(colorschemes);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ async function bufferToDataUrl(buf: Buffer) {
|
|||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
var blob = new Blob([buf], { type: 'application/octet-binary' });
|
var blob = new Blob([buf], { type: 'application/octet-binary' });
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function (event: Event) {
|
reader.onload = function(event: Event) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
resolve(event.target.result);
|
resolve(event.target.result);
|
||||||
};
|
};
|
||||||
@ -65,7 +65,7 @@ const processFilesForIDB = async (files: FileList) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const registerSamplesFromDB = (config: samplesDBConfig, onComplete = () => {}) => {
|
export const registerSamplesFromDB = (config: samplesDBConfig, onComplete = () => { }) => {
|
||||||
openDB(config, (objectStore: IDBObjectStore) => {
|
openDB(config, (objectStore: IDBObjectStore) => {
|
||||||
let query = objectStore.getAll();
|
let query = objectStore.getAll();
|
||||||
query.onsuccess = (event: Event) => {
|
query.onsuccess = (event: Event) => {
|
||||||
@ -123,10 +123,10 @@ export const openDB = (config: samplesDBConfig, onOpened: Function) => {
|
|||||||
objectStore.createIndex(c, c, { unique: false });
|
objectStore.createIndex(c, c, { unique: false });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
dbOpen.onerror = function (err: Event) {
|
dbOpen.onerror = function(err: Event) {
|
||||||
console.log('Error opening DB: ', (err.target as IDBOpenDBRequest).error);
|
console.log('Error opening DB: ', (err.target as IDBOpenDBRequest).error);
|
||||||
}
|
}
|
||||||
dbOpen.onsuccess = function (_event: Event) {
|
dbOpen.onsuccess = function(_event: Event) {
|
||||||
const db = dbOpen.result;
|
const db = dbOpen.result;
|
||||||
db.onversionchange = function() {
|
db.onversionchange = function() {
|
||||||
db.close();
|
db.close();
|
||||||
|
|||||||
@ -788,7 +788,7 @@ const completionDatabase: CompletionDatabase = {
|
|||||||
name: "counter",
|
name: "counter",
|
||||||
category: "patterns",
|
category: "patterns",
|
||||||
description: "Counter/iterator",
|
description: "Counter/iterator",
|
||||||
example: "counter('my_counter_, 20, 1)",
|
example: "counter('my_counter', 20, 1)",
|
||||||
},
|
},
|
||||||
drunk: {
|
drunk: {
|
||||||
name: "drunk",
|
name: "drunk",
|
||||||
|
|||||||
@ -578,12 +578,11 @@ export class Editor {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.hydra_backend = new Hydra({
|
this.hydra_backend = new Hydra({
|
||||||
canvas: this.interface.hydra_canvas as HTMLCanvasElement,
|
canvas: this.interface.hydra_canvas as HTMLCanvasElement,
|
||||||
width: 1280,
|
|
||||||
height: 768,
|
|
||||||
detectAudio: false,
|
detectAudio: false,
|
||||||
enableStreamCapture: false,
|
enableStreamCapture: false,
|
||||||
});
|
});
|
||||||
this.hydra = this.hydra_backend.synth;
|
this.hydra = this.hydra_backend.synth;
|
||||||
|
this.hydra.setResolution(1280, 768);
|
||||||
(globalThis as any).hydra = this.hydra;
|
(globalThis as any).hydra = this.hydra;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user