diff --git a/src/DomElements.ts b/src/DomElements.ts index 6267e53..07c619e 100644 --- a/src/DomElements.ts +++ b/src/DomElements.ts @@ -2,14 +2,14 @@ import { type Editor } from "./main"; export type ElementMap = { [key: string]: - | HTMLElement - | HTMLButtonElement - | HTMLDivElement - | HTMLInputElement - | HTMLSelectElement - | HTMLCanvasElement - | HTMLFormElement - | HTMLInputElement; + | HTMLElement + | HTMLButtonElement + | HTMLDivElement + | HTMLInputElement + | HTMLSelectElement + | HTMLCanvasElement + | HTMLFormElement + | HTMLInputElement; }; export const singleElements = { @@ -57,7 +57,6 @@ export const singleElements = { hydra_canvas: "hydra-bg", feedback: "feedback", drawings: "drawings", - scope: "scope", }; export const buttonGroups = { diff --git a/src/EditorSetup.ts b/src/EditorSetup.ts index 9125458..3b0e927 100644 --- a/src/EditorSetup.ts +++ b/src/EditorSetup.ts @@ -321,7 +321,7 @@ export const installEditor = (app: Editor) => { ), editorSetup, app.themeCompartment.of( - getCodeMirrorTheme(app.getColorScheme("Tomorrow Night Burns")), + getCodeMirrorTheme(app.getColorScheme("Batman")), // debug ), app.chosenLanguage.of(javascript()), diff --git a/src/Evaluator.ts b/src/Evaluator.ts index f877a9b..07a5f3a 100644 --- a/src/Evaluator.ts +++ b/src/Evaluator.ts @@ -1,15 +1,12 @@ import type { Editor } from "./main"; import type { File } from "./FileManagement"; -const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); -const codeReplace = (code: string): string => { - return code.replace(/->|::/g, "&&"); -}; +const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); +const codeReplace = (code: string): string => code.replace(/->|::/g, "&&"); +const cache = new Map(); +const MAX_CACHE_SIZE = 40; -const tryCatchWrapper = async ( - application: Editor, - code: string, -): Promise => { +async function tryCatchWrapper(application: Editor, code: string): Promise { /** * Wraps the provided code in a try-catch block and executes it. * @@ -17,21 +14,15 @@ const tryCatchWrapper = async ( * @param code - The code to be executed. * @returns A promise that resolves to a boolean indicating whether the code executed successfully or not. */ - try { - await new Function(`"use strict"; ${codeReplace(code)}`).call( - application.api, - ); + await new Function(`"use strict"; ${codeReplace(code)}`).call(application.api); return true; } catch (error) { application.interface.error_line.innerHTML = error as string; application.api._reportError(error as string); return false; } -}; - -const cache = new Map(); -const MAX_CACHE_SIZE = 40; +} const addFunctionToCache = (code: string, fn: Function) => { /** @@ -45,11 +36,8 @@ const addFunctionToCache = (code: string, fn: Function) => { cache.set(code, fn); }; -export const tryEvaluate = async ( - application: Editor, - code: File, - timeout = 5000, -): Promise => { + +export async function tryEvaluate(application: Editor, code: File, timeout = 5000): Promise { /** * Tries to evaluate the provided code within a specified timeout period. * Increments the evaluation count of the code file. @@ -63,39 +51,30 @@ export const tryEvaluate = async ( code.evaluations!++; const candidateCode = code.candidate; - try { - const cachedFunction = cache.get(candidateCode); - if (cachedFunction) { - cachedFunction.call(application.api); - } else { - const wrappedCode = `let i = ${code.evaluations}; ${candidateCode}`; - const isCodeValid = await Promise.race([ - tryCatchWrapper(application, wrappedCode), - delay(timeout), - ]); - - if (isCodeValid) { - code.committed = code.candidate; - const newFunction = new Function( - `"use strict"; ${codeReplace(wrappedCode)}`, - ); - addFunctionToCache(candidateCode, newFunction); - } else { - application.api.logOnce("Compilation error!"); - await evaluate(application, code, timeout); - } - } - } catch (error) { - application.interface.error_line.innerHTML = error as string; - application.api._reportError(error as string); + const cachedFunction = cache.get(candidateCode); + if (cachedFunction) { + cachedFunction.call(application.api); + return; } -}; -export const evaluate = async ( - application: Editor, - code: File, - timeout = 1000, -): Promise => { + const wrappedCode = `let i = ${code.evaluations}; ${candidateCode}`; + const isCodeValid = await Promise.race([ + tryCatchWrapper(application, wrappedCode), + delay(timeout) + ]); + + if (isCodeValid) { + code.committed = candidateCode; + const newFunction = new Function(`"use strict"; ${codeReplace(wrappedCode)}`); + addFunctionToCache(candidateCode, newFunction); + } else { + application.api.logOnce("Compilation error!"); + await delay(100); + await tryEvaluate(application, code, timeout); + } +} + +export async function evaluate(application: Editor, code: File, timeout = 1000): Promise { /** * Evaluates the given code using the provided application and timeout. * @param application The editor application. @@ -103,18 +82,17 @@ export const evaluate = async ( * @param timeout The timeout value in milliseconds (default: 1000). * @returns A Promise that resolves when the evaluation is complete. */ - try { await Promise.race([ tryCatchWrapper(application, code.committed as string), - delay(timeout), + delay(timeout) ]); - if (code.evaluations) code.evaluations++; + code.evaluations!++; } catch (error) { application.interface.error_line.innerHTML = error as string; - console.log(error); + console.error(error); } -}; +} export const evaluateOnce = async ( application: Editor, diff --git a/src/FileManagement.ts b/src/FileManagement.ts index f2821a1..799cd46 100644 --- a/src/FileManagement.ts +++ b/src/FileManagement.ts @@ -1,6 +1,4 @@ -// import { tutorial_universe } from "./universes/tutorial"; import { gzipSync, decompressSync, strFromU8 } from "fflate"; -// import { examples } from "./examples/excerpts"; import { type Editor } from "./main"; import { uniqueNamesGenerator, colors, animals } from "unique-names-generator"; import { tryEvaluate } from "./Evaluator"; diff --git a/src/KeyActions.ts b/src/Keyboard.ts similarity index 98% rename from src/KeyActions.ts rename to src/Keyboard.ts index 73d4dce..ba78337 100644 --- a/src/KeyActions.ts +++ b/src/Keyboard.ts @@ -1,7 +1,7 @@ import { type Editor } from "./main"; import { vim } from "@replit/codemirror-vim"; import { tryEvaluate } from "./Evaluator"; -import { hideDocumentation, showDocumentation } from "./Documentation"; +import { hideDocumentation, showDocumentation } from "./documentation/Documentation"; import { openSettingsModal, openUniverseModal } from "./FileManagement"; export const registerFillKeys = (app: Editor) => { diff --git a/src/TransportProcessor.js b/src/TransportProcessor.js deleted file mode 100644 index 832eaed..0000000 --- a/src/TransportProcessor.js +++ /dev/null @@ -1,47 +0,0 @@ -class TransportProcessor extends AudioWorkletProcessor { - constructor(options) { - super(options); - this.port.addEventListener("message", this.handleMessage); - this.port.start(); - this.nudge = 0; - this.started = false; - this.bpm = 120; - this.ppqn = 48; - this.currentPulsePosition = 0; - } - - handleMessage = (message) => { - if (message.data && message.data.type === "ping") { - this.port.postMessage(message.data); - } else if (message.data.type === "start") { - this.started = true; - } else if (message.data.type === "pause") { - this.started = false; - } else if (message.data.type === "stop") { - this.started = false; - } else if (message.data.type === "bpm") { - this.bpm = message.data.value; - this.currentPulsePosition = currentTime; - } else if (message.data.type === "ppqn") { - this.ppqn = message.data.value; - this.currentPulsePosition = currentTime; - } else if (message.data.type === "nudge") { - this.nudge = message.data.value; - } - }; - - process(inputs, outputs, parameters) { - if (this.started) { - const adjustedCurrentTime = currentTime + this.nudge / 100; - const beatNumber = adjustedCurrentTime / (60 / this.bpm); - const currentPulsePosition = Math.ceil(beatNumber * this.ppqn); - if (currentPulsePosition > this.currentPulsePosition) { - this.currentPulsePosition = currentPulsePosition; - this.port.postMessage({ type: "bang", bpm: this.bpm }); - } - } - return true; - } - } - - registerProcessor("transport", TransportProcessor); \ No newline at end of file diff --git a/src/InterfaceLogic.ts b/src/UILogic.ts similarity index 98% rename from src/InterfaceLogic.ts rename to src/UILogic.ts index f9ad983..d54d8a3 100644 --- a/src/InterfaceLogic.ts +++ b/src/UILogic.ts @@ -8,7 +8,7 @@ import { hideDocumentation, showDocumentation, updateDocumentationContent, -} from "./Documentation"; +} from "./documentation/Documentation"; import { type Universe, template_universe, @@ -161,10 +161,10 @@ export const installInterfaceLogic = (app: Editor) => { app.interface.sample_indicator.innerText = "Loading..."; app.interface.sample_indicator.classList.add("animate-pulse"); await uploadSamplesToDB(samplesDBConfig, fileInput.files).then(() => { - registerSamplesFromDB(samplesDBConfig, () => { - app.interface.sample_indicator.innerText = "Import samples"; - app.interface.sample_indicator.classList.remove("animate-pulse"); - }); + registerSamplesFromDB(samplesDBConfig, () => { + app.interface.sample_indicator.innerText = "Import samples"; + app.interface.sample_indicator.classList.remove("animate-pulse"); + }); }); }); @@ -555,4 +555,4 @@ export const installInterfaceLogic = (app: Editor) => { console.log("Could not find element " + name); } }); -}; \ No newline at end of file +}; diff --git a/src/Clock.ts b/src/clock/Clock.ts similarity index 96% rename from src/Clock.ts rename to src/clock/Clock.ts index 5ab5f62..5159714 100644 --- a/src/Clock.ts +++ b/src/clock/Clock.ts @@ -1,7 +1,6 @@ -// @ts-ignore -import { TransportNode } from "./TransportNode"; -import TransportProcessor from "./TransportProcessor?worker&url"; -import { Editor } from "./main"; +import { TransportNode } from "./ClockNode"; +import TransportProcessor from "./ClockProcessor?worker&url"; +import { Editor } from "../main"; export interface TimePosition { /** @@ -57,7 +56,7 @@ export class Clock { this.logicalTime = 0; this.tick = 0; this._bpm = 120; - this._ppqn = 48; + this._ppqn = 48 * 2; this.transportNode = null; this.ctx = ctx; this.running = true; @@ -189,6 +188,11 @@ export class Clock { } public incrementTick(bpm: number) { + /** + * Increment the clock tick by 1. + * @param bpm - The current beats per minute value + * @returns void + */ this.tick++; this.logicalTime += this.pulse_duration_at_bpm(bpm); } @@ -256,4 +260,4 @@ export class Clock { this.app.api.MidiConnection.sendStopMessage(); this.transportNode?.stop(); } -} \ No newline at end of file +} diff --git a/src/clock/ClockNode.d.ts b/src/clock/ClockNode.d.ts new file mode 100644 index 0000000..50b97ac --- /dev/null +++ b/src/clock/ClockNode.d.ts @@ -0,0 +1,53 @@ +export class TransportNode { + constructor(context: AudioContext, something, app: Editor); + + /** + * Starts the clock. + */ + start(): void; + + /** + * Stops the clock. + */ + stop(): void; + + connect(destionation: AudioNode); + + setNudge(nudge: number): void; + + setPPQN(ppq: number): void; + + setBPM(bpm: number): void; + + pause(): void; + + + /** + * Resets the clock to its initial state. + */ + reset(): void; + + /** + * Sets the interval at which the clock updates. + * @param interval The interval in milliseconds. + */ + setInterval(interval: number): void; + + /** + * Gets the current time of the clock. + * @returns The current time as a number. + */ + getTime(): number; +} + +export interface ClockNodeConfig { + /** + * The initial time for the clock. + */ + startTime?: number; + + /** + * The interval in milliseconds at which the clock should update. + */ + updateInterval?: number; +} diff --git a/src/TransportNode.js b/src/clock/ClockNode.js similarity index 91% rename from src/TransportNode.js rename to src/clock/ClockNode.js index ecea9b0..5c413a2 100644 --- a/src/TransportNode.js +++ b/src/clock/ClockNode.js @@ -1,4 +1,4 @@ -import { tryEvaluate } from "./Evaluator"; +import { tryEvaluate } from "../Evaluator"; const zeroPad = (num, places) => String(num).padStart(places, "0"); export class TransportNode extends AudioWorkletNode { @@ -12,9 +12,9 @@ export class TransportNode extends AudioWorkletNode { /** @type {(this: MessagePort, ev: MessageEvent) => any} */ handleMessage = (message) => { - if(message.data) { + if (message.data) { if (message.data.type === "bang") { - if(this.app.clock.running) { + if (this.app.clock.running) { if (this.app.settings.send_clock) { this.app.api.MidiConnection.sendMidiClock(); } @@ -60,6 +60,6 @@ export class TransportNode extends AudioWorkletNode { } stop() { - this.port.postMessage({type: "stop" }); + this.port.postMessage({ type: "stop" }); } -} \ No newline at end of file +} diff --git a/src/clock/ClockProcessor.js b/src/clock/ClockProcessor.js new file mode 100644 index 0000000..c3505fd --- /dev/null +++ b/src/clock/ClockProcessor.js @@ -0,0 +1,47 @@ +class TransportProcessor extends AudioWorkletProcessor { + constructor(options) { + super(options); + this.port.addEventListener("message", this.handleMessage); + this.port.start(); + this.nudge = 0; + this.started = false; + this.bpm = 120; + this.ppqn = 48 * 2; + this.currentPulsePosition = 0; + } + + handleMessage = (message) => { + if (message.data && message.data.type === "ping") { + this.port.postMessage(message.data); + } else if (message.data.type === "start") { + this.started = true; + } else if (message.data.type === "pause") { + this.started = false; + } else if (message.data.type === "stop") { + this.started = false; + } else if (message.data.type === "bpm") { + this.bpm = message.data.value; + this.currentPulsePosition = currentTime; + } else if (message.data.type === "ppqn") { + this.ppqn = message.data.value; + this.currentPulsePosition = currentTime; + } else if (message.data.type === "nudge") { + this.nudge = message.data.value; + } + }; + + process(inputs, outputs, parameters) { + if (this.started) { + const adjustedCurrentTime = currentTime + this.nudge / 100; + const beatNumber = adjustedCurrentTime / (60 / this.bpm); + const currentPulsePosition = Math.ceil(beatNumber * this.ppqn); + if (currentPulsePosition > this.currentPulsePosition) { + this.currentPulsePosition = currentPulsePosition; + this.port.postMessage({ type: "bang", bpm: this.bpm }); + } + } + return true; + } +} + +registerProcessor("transport", TransportProcessor); diff --git a/src/colors.json b/src/colors.json index 99e9492..083d2b3 100644 --- a/src/colors.json +++ b/src/colors.json @@ -45,29 +45,6 @@ "foreground": "#bdc3c2", "selection_background": "#FF3864" }, - "Tomorrow Night Burns": { - "black": "#252525", - "color1": "#832e31", - "green": "#a63c40", - "yellow": "#d3494e", - "blue": "#fc595f", - "magenta": "#df9395", - "cyan": "#ba8586", - "white": "#f5f5f5", - "brightblack": "#5d6f71", - "brightred": "#832e31", - "brightgreen": "#a63c40", - "brightyellow": "#d2494e", - "brightblue": "#fc595f", - "brightmagenta": "#df9395", - "brightcyan": "#ba8586", - "brightwhite": "#f5f5f5", - "background": "#151515", - "selection_foreground": "#151515", - "cursor": "#ff443e", - "foreground": "#a1b0b8", - "selection_background": "#a1b0b8" - }, "Floraverse": { "black": "#08002e", "color1": "#64002c", @@ -183,52 +160,6 @@ "foreground": "#d4d4d4", "selection_background": "#d4d4d4" }, - "3024 Day": { - "black": "#090300", - "color1": "#db2d20", - "green": "#01a252", - "yellow": "#fded02", - "blue": "#01a0e4", - "magenta": "#a16a94", - "cyan": "#b5e4f4", - "white": "#a5a2a2", - "brightblack": "#5c5855", - "brightred": "#e8bbd0", - "brightgreen": "#3a3432", - "brightyellow": "#4a4543", - "brightblue": "#807d7c", - "brightmagenta": "#d6d5d4", - "brightcyan": "#cdab53", - "brightwhite": "#f7f7f7", - "background": "#f7f7f7", - "selection_foreground": "#f7f7f7", - "cursor": "#4a4543", - "foreground": "#4a4543", - "selection_background": "#4a4543" - }, - "idea": { - "black": "#adadad", - "color1": "#fc5256", - "green": "#98b61c", - "yellow": "#ccb444", - "blue": "#437ee7", - "magenta": "#9d74b0", - "cyan": "#248887", - "white": "#181818", - "brightblack": "#ffffff", - "brightred": "#fc7072", - "brightgreen": "#98b61c", - "brightyellow": "#ffff0b", - "brightblue": "#6c9ced", - "brightmagenta": "#fc7eff", - "brightcyan": "#248887", - "brightwhite": "#181818", - "background": "#202020", - "selection_foreground": "#202020", - "cursor": "#bbbbbb", - "foreground": "#adadad", - "selection_background": "#adadad" - }, "Solarized Dark Higher Contrast": { "black": "#002831", "color1": "#d11c24", @@ -275,29 +206,6 @@ "foreground": "#ede0ce", "selection_background": "#ede0ce" }, - "UltraDark": { - "black": "#000000", - "color1": "#f07178", - "green": "#c3e88d", - "yellow": "#ffcb6b", - "blue": "#82aaff", - "magenta": "#c792ea", - "cyan": "#89ddff", - "white": "#cccccc", - "brightblack": "#333333", - "brightred": "#f6a9ae", - "brightgreen": "#dbf1ba", - "brightyellow": "#ffdfa6", - "brightblue": "#b4ccff", - "brightmagenta": "#ddbdf2", - "brightcyan": "#b8eaff", - "brightwhite": "#ffffff", - "background": "#000000", - "selection_foreground": "#000000", - "cursor": "#fefefe", - "foreground": "#ffffff", - "selection_background": "#ffffff" - }, "BlueDolphin": { "black": "#292d3e", "color1": "#ff8288", @@ -898,29 +806,6 @@ "foreground": "#ffcb83", "selection_background": "#ffcb83" }, - "Spring": { - "black": "#000000", - "color1": "#ff4d83", - "green": "#1f8c3b", - "yellow": "#1fc95b", - "blue": "#1dd3ee", - "magenta": "#8959a8", - "cyan": "#3e999f", - "white": "#ffffff", - "brightblack": "#000000", - "brightred": "#ff0021", - "brightgreen": "#1fc231", - "brightyellow": "#d5b807", - "brightblue": "#15a9fd", - "brightmagenta": "#8959a8", - "brightcyan": "#3e999f", - "brightwhite": "#ffffff", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#4d4d4c", - "foreground": "#4d4d4c", - "selection_background": "#4d4d4c" - }, "Lavandula": { "black": "#230046", "color1": "#7d1625", @@ -990,29 +875,6 @@ "foreground": "#ffffff", "selection_background": "#ffffff" }, - "iTerm2 Solarized Dark": { - "black": "#073642", - "color1": "#dc322f", - "green": "#859900", - "yellow": "#b58900", - "blue": "#268bd2", - "magenta": "#d33682", - "cyan": "#2aa198", - "white": "#eee8d5", - "brightblack": "#002b36", - "brightred": "#cb4b16", - "brightgreen": "#586e75", - "brightyellow": "#657b83", - "brightblue": "#839496", - "brightmagenta": "#6c71c4", - "brightcyan": "#93a1a1", - "brightwhite": "#fdf6e3", - "background": "#002b36", - "selection_foreground": "#002b36", - "cursor": "#839496", - "foreground": "#839496", - "selection_background": "#839496" - }, "Breeze": { "black": "#31363b", "color1": "#ed1515", @@ -1197,52 +1059,6 @@ "foreground": "#afdab6", "selection_background": "#afdab6" }, - "AtomOneLight": { - "black": "#000000", - "color1": "#de3e35", - "green": "#3f953a", - "yellow": "#d2b67c", - "blue": "#2f5af3", - "magenta": "#950095", - "cyan": "#3f953a", - "white": "#bbbbbb", - "brightblack": "#000000", - "brightred": "#de3e35", - "brightgreen": "#3f953a", - "brightyellow": "#d2b67c", - "brightblue": "#2f5af3", - "brightmagenta": "#a00095", - "brightcyan": "#3f953a", - "brightwhite": "#ffffff", - "background": "#f9f9f9", - "selection_foreground": "#f9f9f9", - "cursor": "#bbbbbb", - "foreground": "#2a2c33", - "selection_background": "#2a2c33" - }, - "PencilLight": { - "black": "#212121", - "color1": "#c30771", - "green": "#10a778", - "yellow": "#a89c14", - "blue": "#008ec4", - "magenta": "#523c79", - "cyan": "#20a5ba", - "white": "#d9d9d9", - "brightblack": "#424242", - "brightred": "#fb007a", - "brightgreen": "#5fd7af", - "brightyellow": "#f3e430", - "brightblue": "#20bbfc", - "brightmagenta": "#6855de", - "brightcyan": "#4fb8cc", - "brightwhite": "#f1f1f1", - "background": "#f1f1f1", - "selection_foreground": "#f1f1f1", - "cursor": "#20bbfc", - "foreground": "#424242", - "selection_background": "#424242" - }, "Hopscotch": { "black": "#322931", "color1": "#dd464c", @@ -1381,31 +1197,6 @@ "foreground": "#b3b8c3", "selection_background": "#b3b8c3" }, - "primary": { - "black": "#000000", - "color1": "#db4437", - "green": "#0f9d58", - "yellow": "#f4b400", - "blue": "#4285f4", - "magenta": "#db4437", - "cyan": "#4285f4", - "white": "#ffffff", - "brightblack": "#000000", - "brightred": "#db4437", - "brightgreen": "#0f9d58", - "brightyellow": "#f4b400", - "brightblue": "#4285f4", - "brightmagenta": "#4285f4", - "brightcyan": "#0f9d58", - "brightwhite": "#ffffff", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#000000", - "foreground": "#000000", - "selection_background": "#000000", - "underline_color": "#596181", - "url_color": "#596181" - }, "MaterialDark": { "black": "#212121", "color1": "#b7141f", @@ -1475,29 +1266,6 @@ "foreground": "#ddeeff", "selection_background": "#ddeeff" }, - "Tomorrow Night Blue": { - "black": "#000000", - "color1": "#ff9da4", - "green": "#d1f1a9", - "yellow": "#ffeead", - "blue": "#bbdaff", - "magenta": "#ebbbff", - "cyan": "#99ffff", - "white": "#ffffff", - "brightblack": "#000000", - "brightred": "#ff9da4", - "brightgreen": "#d1f1a9", - "brightyellow": "#ffeead", - "brightblue": "#bbdaff", - "brightmagenta": "#ebbbff", - "brightcyan": "#99ffff", - "brightwhite": "#ffffff", - "background": "#002451", - "selection_foreground": "#002451", - "cursor": "#ffffff", - "foreground": "#ffffff", - "selection_background": "#ffffff" - }, "HaX0R_GR33N": { "black": "#001f0b", "color1": "#15d00d", @@ -1613,29 +1381,6 @@ "foreground": "#575279", "selection_background": "#575279" }, - "PaleNightHC": { - "black": "#000000", - "color1": "#f07178", - "green": "#c3e88d", - "yellow": "#ffcb6b", - "blue": "#82aaff", - "magenta": "#c792ea", - "cyan": "#89ddff", - "white": "#ffffff", - "brightblack": "#666666", - "brightred": "#f6a9ae", - "brightgreen": "#dbf1ba", - "brightyellow": "#ffdfa6", - "brightblue": "#b4ccff", - "brightmagenta": "#ddbdf2", - "brightcyan": "#b8eaff", - "brightwhite": "#999999", - "background": "#3e4251", - "selection_foreground": "#3e4251", - "cursor": "#ffcb6b", - "foreground": "#cccccc", - "selection_background": "#cccccc" - }, "Neon": { "black": "#000000", "color1": "#ff3045", @@ -1728,29 +1473,6 @@ "foreground": "#ffffff", "selection_background": "#ffffff" }, - "Tango Half Adapted": { - "black": "#000000", - "color1": "#ff0000", - "green": "#4cc300", - "yellow": "#e2c000", - "blue": "#008ef6", - "magenta": "#a96cb3", - "cyan": "#00bdc3", - "white": "#e0e5db", - "brightblack": "#797d76", - "brightred": "#ff0013", - "brightgreen": "#8af600", - "brightyellow": "#ffec00", - "brightblue": "#76bfff", - "brightmagenta": "#d898d1", - "brightcyan": "#00f6fa", - "brightwhite": "#f4f4f2", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#000000", - "foreground": "#000000", - "selection_background": "#000000" - }, "Django": { "black": "#000000", "color1": "#fd6209", @@ -1797,52 +1519,6 @@ "foreground": "#f0e4cf", "selection_background": "#f0e4cf" }, - "LiquidCarbonTransparentInverse": { - "black": "#bccccd", - "color1": "#ff3030", - "green": "#559a70", - "yellow": "#ccac00", - "blue": "#0099cc", - "magenta": "#cc69c8", - "cyan": "#7ac4cc", - "white": "#000000", - "brightblack": "#ffffff", - "brightred": "#ff3030", - "brightgreen": "#559a70", - "brightyellow": "#ccac00", - "brightblue": "#0099cc", - "brightmagenta": "#cc69c8", - "brightcyan": "#7ac4cc", - "brightwhite": "#000000", - "background": "#000000", - "selection_foreground": "#000000", - "cursor": "#ffffff", - "foreground": "#afc2c2", - "selection_background": "#afc2c2" - }, - "Builtin Tango Light": { - "black": "#000000", - "color1": "#cc0000", - "green": "#4e9a06", - "yellow": "#c4a000", - "blue": "#3465a4", - "magenta": "#75507b", - "cyan": "#06989a", - "white": "#d3d7cf", - "brightblack": "#555753", - "brightred": "#ef2929", - "brightgreen": "#8ae234", - "brightyellow": "#fce94f", - "brightblue": "#729fcf", - "brightmagenta": "#ad7fa8", - "brightcyan": "#34e2e2", - "brightwhite": "#eeeeec", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#000000", - "foreground": "#000000", - "selection_background": "#000000" - }, "Rapture": { "black": "#000000", "color1": "#fc644d", @@ -1960,31 +1636,6 @@ "foreground": "#d9d9d9", "selection_background": "#d9d9d9" }, - "BlueBerryPie": { - "black": "#0a4c62", - "color1": "#99246e", - "green": "#5cb1b3", - "yellow": "#eab9a8", - "blue": "#90a5bd", - "magenta": "#9d54a7", - "cyan": "#7e83cc", - "white": "#f0e8d6", - "brightblack": "#201637", - "brightred": "#c87272", - "brightgreen": "#0a6c7e", - "brightyellow": "#7a3188", - "brightblue": "#39173d", - "brightmagenta": "#bc94b7", - "brightcyan": "#5e6071", - "brightwhite": "#0a6c7e", - "background": "#1c0c28", - "selection_foreground": "#1c0c28", - "cursor": "#fcfad6", - "foreground": "#babab9", - "selection_background": "#babab9", - "underline_color": "#59175a", - "url_color": "#59175a" - }, "GitHub Dark": { "black": "#000000", "color1": "#f78166", @@ -2100,29 +1751,6 @@ "foreground": "#b9bcba", "selection_background": "#b9bcba" }, - "Piatto Light": { - "black": "#414141", - "color1": "#b23771", - "green": "#66781e", - "yellow": "#cd6f34", - "blue": "#3c5ea8", - "magenta": "#a454b2", - "cyan": "#66781e", - "white": "#ffffff", - "brightblack": "#3f3f3f", - "brightred": "#db3365", - "brightgreen": "#829429", - "brightyellow": "#cd6f34", - "brightblue": "#3c5ea8", - "brightmagenta": "#a454b2", - "brightcyan": "#829429", - "brightwhite": "#f2f2f2", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#5e77c8", - "foreground": "#414141", - "selection_background": "#414141" - }, "Builtin Dark": { "black": "#000000", "color1": "#bb0000", @@ -2376,29 +2004,6 @@ "foreground": "#839496", "selection_background": "#839496" }, - "Raycast_Light": { - "black": "#000000", - "color1": "#b12424", - "green": "#006b4f", - "yellow": "#f8a300", - "blue": "#138af2", - "magenta": "#9a1b6e", - "cyan": "#3eb8bf", - "white": "#ffffff", - "brightblack": "#000000", - "brightred": "#b12424", - "brightgreen": "#006b4f", - "brightyellow": "#f8a300", - "brightblue": "#138af2", - "brightmagenta": "#9a1b6e", - "brightcyan": "#3eb8bf", - "brightwhite": "#ffffff", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#000000", - "foreground": "#000000", - "selection_background": "#000000" - }, "Galaxy": { "black": "#000000", "color1": "#f9555f", @@ -2514,29 +2119,6 @@ "foreground": "#ced2d6", "selection_background": "#ced2d6" }, - "Tinacious Design (Dark)": { - "black": "#1d1d26", - "color1": "#ff3399", - "green": "#00d364", - "yellow": "#ffcc66", - "blue": "#00cbff", - "magenta": "#cc66ff", - "cyan": "#00ceca", - "white": "#cbcbf0", - "brightblack": "#636667", - "brightred": "#ff2f92", - "brightgreen": "#00d364", - "brightyellow": "#ffd479", - "brightblue": "#00cbff", - "brightmagenta": "#d783ff", - "brightcyan": "#00d5d4", - "brightwhite": "#d5d6f3", - "background": "#1d1d26", - "selection_foreground": "#1d1d26", - "cursor": "#cbcbf0", - "foreground": "#cbcbf0", - "selection_background": "#cbcbf0" - }, "tokyonight-day": { "black": "#e9e9ed", "color1": "#f52a65", @@ -2583,29 +2165,6 @@ "foreground": "#ffffff", "selection_background": "#ffffff" }, - "Man Page": { - "black": "#000000", - "color1": "#cc0000", - "green": "#00a600", - "yellow": "#999900", - "blue": "#0000b2", - "magenta": "#b200b2", - "cyan": "#00a6b2", - "white": "#cccccc", - "brightblack": "#666666", - "brightred": "#e50000", - "brightgreen": "#00d900", - "brightyellow": "#e5e500", - "brightblue": "#0000ff", - "brightmagenta": "#e500e5", - "brightcyan": "#00e5e5", - "brightwhite": "#e5e5e5", - "background": "#fef49c", - "selection_foreground": "#fef49c", - "cursor": "#7f7f7f", - "foreground": "#000000", - "selection_background": "#000000" - }, "GruvboxDark": { "black": "#282828", "color1": "#cc241d", @@ -2652,29 +2211,6 @@ "foreground": "#fff0a5", "selection_background": "#fff0a5" }, - "coffee_theme": { - "black": "#000000", - "color1": "#c91b00", - "green": "#00c200", - "yellow": "#c7c400", - "blue": "#0225c7", - "magenta": "#ca30c7", - "cyan": "#00c5c7", - "white": "#c7c7c7", - "brightblack": "#686868", - "brightred": "#ff6e67", - "brightgreen": "#5ffa68", - "brightyellow": "#fffc67", - "brightblue": "#6871ff", - "brightmagenta": "#ff77ff", - "brightcyan": "#60fdff", - "brightwhite": "#ffffff", - "background": "#f5deb3", - "selection_foreground": "#f5deb3", - "cursor": "#c7c7c7", - "foreground": "#000000", - "selection_background": "#000000" - }, "catppuccin-mocha": { "black": "#45475a", "color1": "#f38ba8", @@ -2721,29 +2257,6 @@ "foreground": "#a0a0a0", "selection_background": "#a0a0a0" }, - "Pro Light": { - "black": "#000000", - "color1": "#e5492b", - "green": "#50d148", - "yellow": "#c6c440", - "blue": "#3b75ff", - "magenta": "#ed66e8", - "cyan": "#4ed2de", - "white": "#dcdcdc", - "brightblack": "#9f9f9f", - "brightred": "#ff6640", - "brightgreen": "#61ef57", - "brightyellow": "#f2f156", - "brightblue": "#0082ff", - "brightmagenta": "#ff7eff", - "brightcyan": "#61f7f8", - "brightwhite": "#f2f2f2", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#4d4d4d", - "foreground": "#191919", - "selection_background": "#191919" - }, "BirdsOfParadise": { "black": "#573d26", "color1": "#be2d26", @@ -3043,29 +2556,6 @@ "foreground": "#acacab", "selection_background": "#acacab" }, - "Retro": { - "black": "#13a10e", - "color1": "#13a10e", - "green": "#13a10e", - "yellow": "#13a10e", - "blue": "#13a10e", - "magenta": "#13a10e", - "cyan": "#13a10e", - "white": "#13a10e", - "brightblack": "#16ba10", - "brightred": "#16ba10", - "brightgreen": "#16ba10", - "brightyellow": "#16ba10", - "brightblue": "#16ba10", - "brightmagenta": "#16ba10", - "brightcyan": "#16ba10", - "brightwhite": "#16ba10", - "background": "#000000", - "selection_foreground": "#000000", - "cursor": "#13a10e", - "foreground": "#13a10e", - "selection_background": "#13a10e" - }, "Pandora": { "black": "#000000", "color1": "#ff4242", @@ -3112,29 +2602,6 @@ "foreground": "#8ff586", "selection_background": "#8ff586" }, - "nord-light": { - "black": "#3b4252", - "color1": "#bf616a", - "green": "#a3be8c", - "yellow": "#ebcb8b", - "blue": "#81a1c1", - "magenta": "#b48ead", - "cyan": "#88c0d0", - "white": "#d8dee9", - "brightblack": "#4c566a", - "brightred": "#bf616a", - "brightgreen": "#a3be8c", - "brightyellow": "#ebcb8b", - "brightblue": "#81a1c1", - "brightmagenta": "#b48ead", - "brightcyan": "#8fbcbb", - "brightwhite": "#eceff4", - "background": "#e5e9f0", - "selection_foreground": "#e5e9f0", - "cursor": "#88c0d0", - "foreground": "#414858", - "selection_background": "#414858" - }, "Whimsy": { "black": "#535178", "color1": "#ef6487", @@ -3227,29 +2694,6 @@ "foreground": "#bbbbbb", "selection_background": "#bbbbbb" }, - "Alabaster": { - "black": "#000000", - "color1": "#aa3731", - "green": "#448c27", - "yellow": "#cb9000", - "blue": "#325cc0", - "magenta": "#7a3e9d", - "cyan": "#0083b2", - "white": "#f7f7f7", - "brightblack": "#777777", - "brightred": "#f05050", - "brightgreen": "#60cb00", - "brightyellow": "#ffbc5d", - "brightblue": "#007acc", - "brightmagenta": "#e64ce6", - "brightcyan": "#00aacb", - "brightwhite": "#f7f7f7", - "background": "#f7f7f7", - "selection_foreground": "#f7f7f7", - "cursor": "#007acc", - "foreground": "#000000", - "selection_background": "#000000" - }, "ayu": { "black": "#000000", "color1": "#ff3333", @@ -3503,29 +2947,6 @@ "foreground": "#dcdcdc", "selection_background": "#dcdcdc" }, - "OneHalfLight": { - "black": "#383a42", - "color1": "#e45649", - "green": "#50a14f", - "yellow": "#c18401", - "blue": "#0184bc", - "magenta": "#a626a4", - "cyan": "#0997b3", - "white": "#fafafa", - "brightblack": "#4f525e", - "brightred": "#e06c75", - "brightgreen": "#98c379", - "brightyellow": "#e5c07b", - "brightblue": "#61afef", - "brightmagenta": "#c678dd", - "brightcyan": "#56b6c2", - "brightwhite": "#ffffff", - "background": "#fafafa", - "selection_foreground": "#fafafa", - "cursor": "#bfceff", - "foreground": "#383a42", - "selection_background": "#383a42" - }, "Earthsong": { "black": "#121418", "color1": "#c94234", @@ -3641,29 +3062,6 @@ "foreground": "#ffffff", "selection_background": "#ffffff" }, - "Night Owlish Light": { - "black": "#011627", - "color1": "#d3423e", - "green": "#2aa298", - "yellow": "#daaa01", - "blue": "#4876d6", - "magenta": "#403f53", - "cyan": "#08916a", - "white": "#7a8181", - "brightblack": "#7a8181", - "brightred": "#f76e6e", - "brightgreen": "#49d0c5", - "brightyellow": "#dac26b", - "brightblue": "#5ca7e4", - "brightmagenta": "#697098", - "brightcyan": "#00c990", - "brightwhite": "#989fb1", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#403f53", - "foreground": "#403f53", - "selection_background": "#403f53" - }, "Hipster Green": { "black": "#000000", "color1": "#b6214a", @@ -3687,29 +3085,6 @@ "foreground": "#84c138", "selection_background": "#84c138" }, - "Royal": { - "black": "#241f2b", - "color1": "#91284c", - "green": "#23801c", - "yellow": "#b49d27", - "blue": "#6580b0", - "magenta": "#674d96", - "cyan": "#8aaabe", - "white": "#524966", - "brightblack": "#312d3d", - "brightred": "#d5356c", - "brightgreen": "#2cd946", - "brightyellow": "#fde83b", - "brightblue": "#90baf9", - "brightmagenta": "#a479e3", - "brightcyan": "#acd4eb", - "brightwhite": "#9e8cbd", - "background": "#100815", - "selection_foreground": "#100815", - "cursor": "#524966", - "foreground": "#514968", - "selection_background": "#514968" - }, "MaterialDarker": { "black": "#000000", "color1": "#ff5370", @@ -4103,29 +3478,6 @@ "foreground": "#b7bcba", "selection_background": "#b7bcba" }, - "Tomorrow Night Eighties": { - "black": "#000000", - "color1": "#f2777a", - "green": "#99cc99", - "yellow": "#ffcc66", - "blue": "#6699cc", - "magenta": "#cc99cc", - "cyan": "#66cccc", - "white": "#ffffff", - "brightblack": "#000000", - "brightred": "#f2777a", - "brightgreen": "#99cc99", - "brightyellow": "#ffcc66", - "brightblue": "#6699cc", - "brightmagenta": "#cc99cc", - "brightcyan": "#66cccc", - "brightwhite": "#ffffff", - "background": "#2d2d2d", - "selection_foreground": "#2d2d2d", - "cursor": "#cccccc", - "foreground": "#cccccc", - "selection_background": "#cccccc" - }, "Builtin Solarized Light": { "black": "#073642", "color1": "#dc322f", @@ -4335,29 +3687,6 @@ "underline_color": "#596181", "url_color": "#596181" }, - "Novel": { - "black": "#000000", - "color1": "#cc0000", - "green": "#009600", - "yellow": "#d06b00", - "blue": "#0000cc", - "magenta": "#cc00cc", - "cyan": "#0087cc", - "white": "#cccccc", - "brightblack": "#808080", - "brightred": "#cc0000", - "brightgreen": "#009600", - "brightyellow": "#d06b00", - "brightblue": "#0000cc", - "brightmagenta": "#cc00cc", - "brightcyan": "#0087cc", - "brightwhite": "#ffffff", - "background": "#dfdbc3", - "selection_foreground": "#dfdbc3", - "cursor": "#73635a", - "foreground": "#3b2322", - "selection_background": "#3b2322" - }, "Purple Rain": { "black": "#000000", "color1": "#ff260e", @@ -4565,52 +3894,6 @@ "foreground": "#c9c9c9", "selection_background": "#c9c9c9" }, - "Github": { - "black": "#3e3e3e", - "color1": "#970b16", - "green": "#07962a", - "yellow": "#f8eec7", - "blue": "#003e8a", - "magenta": "#e94691", - "cyan": "#89d1ec", - "white": "#ffffff", - "brightblack": "#666666", - "brightred": "#de0000", - "brightgreen": "#87d5a2", - "brightyellow": "#f1d007", - "brightblue": "#2e6cba", - "brightmagenta": "#ffa29f", - "brightcyan": "#1cfafe", - "brightwhite": "#ffffff", - "background": "#f4f4f4", - "selection_foreground": "#f4f4f4", - "cursor": "#3f3f3f", - "foreground": "#3e3e3e", - "selection_background": "#3e3e3e" - }, - "Material": { - "black": "#212121", - "color1": "#b7141f", - "green": "#457b24", - "yellow": "#f6981e", - "blue": "#134eb2", - "magenta": "#560088", - "cyan": "#0e717c", - "white": "#efefef", - "brightblack": "#424242", - "brightred": "#e83b3f", - "brightgreen": "#7aba3a", - "brightyellow": "#ffea2e", - "brightblue": "#54a4f3", - "brightmagenta": "#aa4dbc", - "brightcyan": "#26bbd1", - "brightwhite": "#d9d9d9", - "background": "#eaeaea", - "selection_foreground": "#eaeaea", - "cursor": "#16afca", - "foreground": "#232322", - "selection_background": "#232322" - }, "Bright Lights": { "black": "#191919", "color1": "#ff355b", @@ -4634,31 +3917,6 @@ "foreground": "#b3c9d7", "selection_background": "#b3c9d7" }, - "Unikitty": { - "black": "#0c0c0c", - "color1": "#a80f20", - "green": "#bafc8b", - "yellow": "#eedf4b", - "blue": "#145fcd", - "magenta": "#ff36a2", - "cyan": "#6bd1bc", - "white": "#e2d7e1", - "brightblack": "#434343", - "brightred": "#d91329", - "brightgreen": "#d3ffaf", - "brightyellow": "#ffef50", - "brightblue": "#0075ea", - "brightmagenta": "#fdd5e5", - "brightcyan": "#79ecd5", - "brightwhite": "#fff3fe", - "background": "#ff8cd9", - "selection_foreground": "#ff8cd9", - "cursor": "#bafc8b", - "foreground": "#0b0b0b", - "selection_background": "#0b0b0b", - "underline_color": "#38a276", - "url_color": "#38a276" - }, "UltraViolent": { "black": "#242728", "color1": "#ff0090", @@ -4728,29 +3986,6 @@ "foreground": "#c6c6c6", "selection_background": "#c6c6c6" }, - "Red Sands": { - "black": "#000000", - "color1": "#ff3f00", - "green": "#00bb00", - "yellow": "#e7b000", - "blue": "#0072ff", - "magenta": "#bb00bb", - "cyan": "#00bbbb", - "white": "#bbbbbb", - "brightblack": "#555555", - "brightred": "#bb0000", - "brightgreen": "#00bb00", - "brightyellow": "#e7b000", - "brightblue": "#0072ae", - "brightmagenta": "#ff55ff", - "brightcyan": "#55ffff", - "brightwhite": "#ffffff", - "background": "#7a251e", - "selection_foreground": "#7a251e", - "cursor": "#ffffff", - "foreground": "#d7c9a7", - "selection_background": "#d7c9a7" - }, "Lab Fox": { "black": "#2e2e2e", "color1": "#fc6d26", @@ -4820,29 +4055,6 @@ "foreground": "#cbccc6", "selection_background": "#cbccc6" }, - "ayu_light": { - "black": "#000000", - "color1": "#ff3333", - "green": "#86b300", - "yellow": "#f29718", - "blue": "#41a6d9", - "magenta": "#f07178", - "cyan": "#4dbf99", - "white": "#ffffff", - "brightblack": "#323232", - "brightred": "#ff6565", - "brightgreen": "#b8e532", - "brightyellow": "#ffc94a", - "brightblue": "#73d8ff", - "brightmagenta": "#ffa3aa", - "brightcyan": "#7ff1cb", - "brightwhite": "#ffffff", - "background": "#fafafa", - "selection_foreground": "#fafafa", - "cursor": "#ff6a00", - "foreground": "#5c6773", - "selection_background": "#5c6773" - }, "arcoiris": { "black": "#333333", "color1": "#da2700", @@ -4960,29 +4172,6 @@ "foreground": "#555555", "selection_background": "#555555" }, - "flexoki-light": { - "black": "#100f0f", - "color1": "#af3029", - "green": "#66800b", - "yellow": "#ad8301", - "blue": "#205ea6", - "magenta": "#a02f6f", - "cyan": "#24837b", - "white": "#f2f0e5", - "brightblack": "#575653", - "brightred": "#d14d41", - "brightgreen": "#879a39", - "brightyellow": "#d0a215", - "brightblue": "#4385be", - "brightmagenta": "#ce5d97", - "brightcyan": "#3aa99f", - "brightwhite": "#fffcf0", - "background": "#fffcf0", - "selection_foreground": "#fffcf0", - "cursor": "#100f0f", - "foreground": "#100f0f", - "selection_background": "#100f0f" - }, "Espresso": { "black": "#353535", "color1": "#d25252", @@ -5029,52 +4218,6 @@ "foreground": "#bababa", "selection_background": "#bababa" }, - "Tango Adapted": { - "black": "#000000", - "color1": "#ff0000", - "green": "#59d600", - "yellow": "#f0cb00", - "blue": "#00a2ff", - "magenta": "#c17ecc", - "cyan": "#00d0d6", - "white": "#e6ebe1", - "brightblack": "#8f928b", - "brightred": "#ff0013", - "brightgreen": "#93ff00", - "brightyellow": "#fff121", - "brightblue": "#88c9ff", - "brightmagenta": "#e9a7e1", - "brightcyan": "#00feff", - "brightwhite": "#f6f6f4", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#000000", - "foreground": "#000000", - "selection_background": "#000000" - }, - "CLRS": { - "black": "#000000", - "color1": "#f8282a", - "green": "#328a5d", - "yellow": "#fa701d", - "blue": "#135cd0", - "magenta": "#9f00bd", - "cyan": "#33c3c1", - "white": "#b3b3b3", - "brightblack": "#555753", - "brightred": "#fb0416", - "brightgreen": "#2cc631", - "brightyellow": "#fdd727", - "brightblue": "#1670ff", - "brightmagenta": "#e900b0", - "brightcyan": "#3ad5ce", - "brightwhite": "#eeeeec", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#6fd3fc", - "foreground": "#262626", - "selection_background": "#262626" - }, "Batman": { "black": "#1b1d1e", "color1": "#e6dc44", @@ -5213,29 +4356,6 @@ "foreground": "#45373c", "selection_background": "#45373c" }, - "Terminal Basic": { - "black": "#000000", - "color1": "#990000", - "green": "#00a600", - "yellow": "#999900", - "blue": "#0000b2", - "magenta": "#b200b2", - "cyan": "#00a6b2", - "white": "#bfbfbf", - "brightblack": "#666666", - "brightred": "#e50000", - "brightgreen": "#00d900", - "brightyellow": "#e5e500", - "brightblue": "#0000ff", - "brightmagenta": "#e500e5", - "brightcyan": "#00e5e5", - "brightwhite": "#e5e5e5", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#7f7f7f", - "foreground": "#000000", - "selection_background": "#000000" - }, "Chester": { "black": "#080200", "color1": "#fa5e5b", @@ -5259,29 +4379,6 @@ "foreground": "#ffffff", "selection_background": "#ffffff" }, - "Ollie": { - "black": "#000000", - "color1": "#ac2e31", - "green": "#31ac61", - "yellow": "#ac4300", - "blue": "#2d57ac", - "magenta": "#b08528", - "cyan": "#1fa6ac", - "white": "#8a8eac", - "brightblack": "#5b3725", - "brightred": "#ff3d48", - "brightgreen": "#3bff99", - "brightyellow": "#ff5e1e", - "brightblue": "#4488ff", - "brightmagenta": "#ffc21d", - "brightcyan": "#1ffaff", - "brightwhite": "#5b6ea7", - "background": "#222125", - "selection_foreground": "#222125", - "cursor": "#5b6ea7", - "foreground": "#8a8dae", - "selection_background": "#8a8dae" - }, "Apple Classic": { "black": "#000000", "color1": "#c91b00", @@ -5328,52 +4425,6 @@ "foreground": "#afc2c2", "selection_background": "#afc2c2" }, - "Shaman": { - "black": "#012026", - "color1": "#b2302d", - "green": "#00a941", - "yellow": "#5e8baa", - "blue": "#449a86", - "magenta": "#00599d", - "cyan": "#5d7e19", - "white": "#405555", - "brightblack": "#384451", - "brightred": "#ff4242", - "brightgreen": "#2aea5e", - "brightyellow": "#8ed4fd", - "brightblue": "#61d5ba", - "brightmagenta": "#1298ff", - "brightcyan": "#98d028", - "brightwhite": "#58fbd6", - "background": "#001015", - "selection_foreground": "#001015", - "cursor": "#4afcd6", - "foreground": "#405555", - "selection_background": "#405555" - }, - "Violet Dark": { - "black": "#56595c", - "color1": "#c94c22", - "green": "#85981c", - "yellow": "#b4881d", - "blue": "#2e8bce", - "magenta": "#d13a82", - "cyan": "#32a198", - "white": "#c9c6bd", - "brightblack": "#45484b", - "brightred": "#bd3613", - "brightgreen": "#738a04", - "brightyellow": "#a57705", - "brightblue": "#2176c7", - "brightmagenta": "#c61c6f", - "brightcyan": "#259286", - "brightwhite": "#c9c6bd", - "background": "#1c1d1f", - "selection_foreground": "#1c1d1f", - "cursor": "#708284", - "foreground": "#708284", - "selection_background": "#708284" - }, "Kolorit": { "black": "#1d1a1e", "color1": "#ff5b82", @@ -5489,52 +4540,6 @@ "foreground": "#999993", "selection_background": "#999993" }, - "Tomorrow": { - "black": "#000000", - "color1": "#c82829", - "green": "#718c00", - "yellow": "#eab700", - "blue": "#4271ae", - "magenta": "#8959a8", - "cyan": "#3e999f", - "white": "#ffffff", - "brightblack": "#000000", - "brightred": "#c82829", - "brightgreen": "#718c00", - "brightyellow": "#eab700", - "brightblue": "#4271ae", - "brightmagenta": "#8959a8", - "brightcyan": "#3e999f", - "brightwhite": "#ffffff", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#4d4d4c", - "foreground": "#4d4d4c", - "selection_background": "#4d4d4c" - }, - "Tinacious Design (Light)": { - "black": "#1d1d26", - "color1": "#ff3399", - "green": "#00d364", - "yellow": "#ffcc66", - "blue": "#00cbff", - "magenta": "#cc66ff", - "cyan": "#00ceca", - "white": "#cbcbf0", - "brightblack": "#636667", - "brightred": "#ff2f92", - "brightgreen": "#00d364", - "brightyellow": "#ffd479", - "brightblue": "#00cbff", - "brightmagenta": "#d783ff", - "brightcyan": "#00d5d4", - "brightwhite": "#d5d6f3", - "background": "#f8f8ff", - "selection_foreground": "#f8f8ff", - "cursor": "#cbcbf0", - "foreground": "#1d1d26", - "selection_background": "#1d1d26" - }, "Aardvark Blue": { "black": "#191919", "color1": "#aa342e", @@ -5560,29 +4565,6 @@ "underline_color": "#38a276", "url_color": "#38a276" }, - "iceberg-light": { - "black": "#dcdfe7", - "color1": "#cc517a", - "green": "#668e3d", - "yellow": "#c57339", - "blue": "#2d539e", - "magenta": "#7759b4", - "cyan": "#3f83a6", - "white": "#33374c", - "brightblack": "#8389a3", - "brightred": "#cc3768", - "brightgreen": "#598030", - "brightyellow": "#b6662d", - "brightblue": "#22478e", - "brightmagenta": "#6845ad", - "brightcyan": "#327698", - "brightwhite": "#262a3f", - "background": "#e8e9ec", - "selection_foreground": "#e8e9ec", - "cursor": "#33374c", - "foreground": "#33374c", - "selection_background": "#33374c" - }, "SleepyHollow": { "black": "#572100", "color1": "#ba3934", @@ -5744,29 +4726,6 @@ "foreground": "#c0caf5", "selection_background": "#c0caf5" }, - "iTerm2 Light Background": { - "black": "#000000", - "color1": "#c91b00", - "green": "#00c200", - "yellow": "#c7c400", - "blue": "#0225c7", - "magenta": "#ca30c7", - "cyan": "#00c5c7", - "white": "#c7c7c7", - "brightblack": "#686868", - "brightred": "#ff6e67", - "brightgreen": "#5ffa68", - "brightyellow": "#fffc67", - "brightblue": "#6871ff", - "brightmagenta": "#ff77ff", - "brightcyan": "#60fdff", - "brightwhite": "#ffffff", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#000000", - "foreground": "#000000", - "selection_background": "#000000" - }, "iTerm2 Tango Light": { "black": "#000000", "color1": "#d81e00", @@ -5928,31 +4887,6 @@ "foreground": "#11b7ff", "selection_background": "#11b7ff" }, - "darkmatrix": { - "black": "#091013", - "color1": "#006536", - "green": "#6fa64c", - "yellow": "#7e8000", - "blue": "#2c9a84", - "magenta": "#452d53", - "cyan": "#114d53", - "white": "#006536", - "brightblack": "#333333", - "brightred": "#00733d", - "brightgreen": "#90d762", - "brightyellow": "#e2e500", - "brightblue": "#46d8b8", - "brightmagenta": "#4a3059", - "brightcyan": "#12545a", - "brightwhite": "#006536", - "background": "#070c0e", - "selection_foreground": "#070c0e", - "cursor": "#9fa86e", - "foreground": "#3e5715", - "selection_background": "#3e5715", - "underline_color": "#302c2c", - "url_color": "#302c2c" - }, "Fahrenheit": { "black": "#1d1d1d", "color1": "#cda074", @@ -6367,54 +5301,6 @@ "foreground": "#f1f1f1", "selection_background": "#f1f1f1" }, - "Tomorrow Night": { - "black": "#000000", - "color1": "#cc6666", - "green": "#b5bd68", - "yellow": "#f0c674", - "blue": "#81a2be", - "magenta": "#b294bb", - "cyan": "#8abeb7", - "white": "#ffffff", - "brightblack": "#000000", - "brightred": "#cc6666", - "brightgreen": "#b5bd68", - "brightyellow": "#f0c674", - "brightblue": "#81a2be", - "brightmagenta": "#b294bb", - "brightcyan": "#8abeb7", - "brightwhite": "#ffffff", - "background": "#1d1f21", - "selection_foreground": "#1d1f21", - "cursor": "#c5c8c6", - "foreground": "#c5c8c6", - "selection_background": "#c5c8c6" - }, - "darkermatrix": { - "black": "#091013", - "color1": "#002e18", - "green": "#6fa64c", - "yellow": "#595900", - "blue": "#00cb6b", - "magenta": "#412a4d", - "cyan": "#125459", - "white": "#002e19", - "brightblack": "#333333", - "brightred": "#00381d", - "brightgreen": "#90d762", - "brightyellow": "#e2e500", - "brightblue": "#00ff87", - "brightmagenta": "#412a4d", - "brightcyan": "#176c73", - "brightwhite": "#00381e", - "background": "#070c0e", - "selection_foreground": "#070c0e", - "cursor": "#373a26", - "foreground": "#28380d", - "selection_background": "#28380d", - "underline_color": "#302c2c", - "url_color": "#302c2c" - }, "Wez": { "black": "#000000", "color1": "#cc5555", @@ -6647,29 +5533,6 @@ "foreground": "#efefef", "selection_background": "#efefef" }, - "CrayonPonyFish": { - "black": "#2b1b1d", - "color1": "#91002b", - "green": "#579524", - "yellow": "#ab311b", - "blue": "#8c87b0", - "magenta": "#692f50", - "cyan": "#e8a866", - "white": "#68525a", - "brightblack": "#3d2b2e", - "brightred": "#c5255d", - "brightgreen": "#8dff57", - "brightyellow": "#c8381d", - "brightblue": "#cfc9ff", - "brightmagenta": "#fc6cba", - "brightcyan": "#ffceaf", - "brightwhite": "#b0949d", - "background": "#150707", - "selection_foreground": "#150707", - "cursor": "#68525a", - "foreground": "#68525a", - "selection_background": "#68525a" - }, "iTerm2 Default": { "black": "#000000", "color1": "#c91b00", @@ -6693,29 +5556,6 @@ "foreground": "#ffffff", "selection_background": "#ffffff" }, - "BlulocoLight": { - "black": "#373a41", - "color1": "#d52753", - "green": "#23974a", - "yellow": "#df631c", - "blue": "#275fe4", - "magenta": "#823ff1", - "cyan": "#27618d", - "white": "#babbc2", - "brightblack": "#676a77", - "brightred": "#ff6480", - "brightgreen": "#3cbc66", - "brightyellow": "#c5a332", - "brightblue": "#0099e1", - "brightmagenta": "#ce33c0", - "brightcyan": "#6d93bb", - "brightwhite": "#d3d3d3", - "background": "#f9f9f9", - "selection_foreground": "#f9f9f9", - "cursor": "#f32759", - "foreground": "#373a41", - "selection_background": "#373a41" - }, "Blazer": { "black": "#000000", "color1": "#b87a7a", @@ -6785,29 +5625,6 @@ "foreground": "#ffffff", "selection_background": "#ffffff" }, - "Builtin Light": { - "black": "#000000", - "color1": "#bb0000", - "green": "#00bb00", - "yellow": "#bbbb00", - "blue": "#0000bb", - "magenta": "#bb00bb", - "cyan": "#00bbbb", - "white": "#bbbbbb", - "brightblack": "#555555", - "brightred": "#ff5555", - "brightgreen": "#55ff55", - "brightyellow": "#ffff55", - "brightblue": "#5555ff", - "brightmagenta": "#ff55ff", - "brightcyan": "#55ffff", - "brightwhite": "#ffffff", - "background": "#ffffff", - "selection_foreground": "#ffffff", - "cursor": "#000000", - "foreground": "#000000", - "selection_background": "#000000" - }, "Highway": { "black": "#000000", "color1": "#d00e18", @@ -6854,29 +5671,6 @@ "foreground": "#9f9fa1", "selection_background": "#9f9fa1" }, - "iTerm2 Solarized Light": { - "black": "#073642", - "color1": "#dc322f", - "green": "#859900", - "yellow": "#b58900", - "blue": "#268bd2", - "magenta": "#d33682", - "cyan": "#2aa198", - "white": "#eee8d5", - "brightblack": "#002b36", - "brightred": "#cb4b16", - "brightgreen": "#586e75", - "brightyellow": "#657b83", - "brightblue": "#839496", - "brightmagenta": "#6c71c4", - "brightcyan": "#93a1a1", - "brightwhite": "#fdf6e3", - "background": "#fdf6e3", - "selection_foreground": "#fdf6e3", - "cursor": "#657b83", - "foreground": "#657b83", - "selection_background": "#657b83" - }, "Neutron": { "black": "#23252b", "color1": "#b54036", @@ -7017,29 +5811,6 @@ "foreground": "#f2f2f2", "selection_background": "#f2f2f2" }, - "Tomorrow Night Bright": { - "black": "#000000", - "color1": "#d54e53", - "green": "#b9ca4a", - "yellow": "#e7c547", - "blue": "#7aa6da", - "magenta": "#c397d8", - "cyan": "#70c0b1", - "white": "#ffffff", - "brightblack": "#000000", - "brightred": "#d54e53", - "brightgreen": "#b9ca4a", - "brightyellow": "#e7c547", - "brightblue": "#7aa6da", - "brightmagenta": "#c397d8", - "brightcyan": "#70c0b1", - "brightwhite": "#ffffff", - "background": "#000000", - "selection_foreground": "#000000", - "cursor": "#eaeaea", - "foreground": "#eaeaea", - "selection_background": "#eaeaea" - }, "Red Planet": { "black": "#202020", "color1": "#8c3432", diff --git a/src/Documentation.ts b/src/documentation/Documentation.ts similarity index 74% rename from src/Documentation.ts rename to src/documentation/Documentation.ts index df9356d..a7ab313 100644 --- a/src/Documentation.ts +++ b/src/documentation/Documentation.ts @@ -1,51 +1,29 @@ -import { Editor } from "./main"; -// Basics -import { introduction } from "./documentation/basics/welcome"; -import { atelier } from "./documentation/basics/atelier"; -import { loading_samples } from "./documentation/learning/samples/loading_samples"; -import { amplitude } from "./documentation/learning/audio_engine/amplitude"; -import { effects } from "./documentation/learning/audio_engine/effects"; -import { sampler } from "./documentation/learning/audio_engine/sampler"; -import { sample_banks } from "./documentation/learning/samples/sample_banks"; -import { audio_basics } from "./documentation/learning/audio_engine/audio_basics"; -import { sample_list } from "./documentation/learning/samples/sample_list"; -import { software_interface } from "./documentation/basics/interface"; -import { shortcuts } from "./documentation/basics/keyboard"; -import { code } from "./documentation/basics/code"; -import { mouse } from "./documentation/basics/mouse"; -// More -import { oscilloscope } from "./documentation/more/oscilloscope"; -import { synchronisation } from "./documentation/more/synchronisation"; -import { about } from "./documentation/more/about"; -import { bonus } from "./documentation/more/bonus"; -import { visualization } from "./documentation/more/visualization"; -import { chaining } from "./documentation/patterns/chaining"; -import { interaction } from "./documentation/basics/interaction"; -import { time } from "./documentation/learning/time/time"; -import { linear_time } from "./documentation/learning/time/linear_time"; -import { cyclical_time } from "./documentation/learning/time/cyclical_time"; -import { long_forms } from "./documentation/learning/time/long_forms"; -import { midi } from "./documentation/learning/midi"; -import { osc } from "./documentation/learning/osc"; -import { patterns } from "./documentation/patterns/patterns"; -import { functions } from "./documentation/patterns/functions"; -import { generators } from "./documentation/patterns/generators"; -import { variables } from "./documentation/patterns/variables"; -import { probabilities } from "./documentation/patterns/probabilities"; -import { lfos } from "./documentation/patterns/lfos"; -import { ziffers_basics } from "./documentation/patterns/ziffers/ziffers_basics"; -import { ziffers_scales } from "./documentation/patterns/ziffers/ziffers_scales"; -import { ziffers_rhythm } from "./documentation/patterns/ziffers/ziffers_rhythm"; -import { ziffers_algorithmic } from "./documentation/patterns/ziffers/ziffers_algorithmic"; -import { ziffers_tonnetz } from "./documentation/patterns/ziffers/ziffers_tonnetz"; -import { ziffers_syncing } from "./documentation/patterns/ziffers/ziffers_syncing"; -import { synths } from "./documentation/learning/audio_engine/synths"; +import { Editor } from "../main"; +import { introduction, atelier, software_interface, shortcuts, code, mouse, interaction } from "./basics"; +import { amplitude, effects, sampler, synths, filters, audio_basics } from "./learning/audio_engine"; +import { lfos, functions, generators, variables, probabilities } from './patterns'; +import { ziffers_basics, ziffers_scales, ziffers_rhythm, ziffers_algorithmic, ziffers_tonnetz, ziffers_syncing } from "./patterns/ziffers"; +import { loading_samples } from "./learning/samples/loading_samples"; +import { sample_banks } from "./learning/samples/sample_banks"; +import { sample_list } from "./learning/samples/sample_list"; +import { oscilloscope } from "./more/oscilloscope"; +import { synchronisation } from "./more/synchronisation"; +import { about } from "./more/about"; +import { bonus } from "./more/bonus"; +import { visualization } from "./more/visualization"; +import { chaining } from "./patterns/chaining"; +import { time } from "./learning/time/time"; +import { linear_time } from "./learning/time/linear_time"; +import { cyclical_time } from "./learning/time/cyclical_time"; +import { long_forms } from "./learning/time/long_forms"; +import { midi } from "./learning/midi"; +import { osc } from "./learning/osc"; +import { patterns } from "./patterns/patterns"; // Setting up the Markdown converter with syntax highlighting import showdown from "showdown"; import showdownHighlight from "showdown-highlight"; import "highlight.js/styles/atom-one-dark-reasonable.min.css"; -import { createDocumentationStyle } from "./DomElements"; -import { filters } from "./documentation/learning/audio_engine/filters"; +import { createDocumentationStyle } from "../DomElements"; showdown.setFlavor("github"); type StyleBinding = { diff --git a/src/documentation/basics/atelier.ts b/src/documentation/basics/atelier.ts index 1b3e45c..7c14279 100644 --- a/src/documentation/basics/atelier.ts +++ b/src/documentation/basics/atelier.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const atelier = (application: Editor): string => { const makeExample = makeExampleFactory(application); diff --git a/src/documentation/basics/code.ts b/src/documentation/basics/code.ts index b830cd8..2908042 100644 --- a/src/documentation/basics/code.ts +++ b/src/documentation/basics/code.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory, key_shortcut } from "../../Documentation"; +import { makeExampleFactory, key_shortcut } from "../Documentation"; export const code = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -31,8 +31,8 @@ The code you enter in any of the scripts is evaluated in strict mode. This tells There are some techniques to keep code short and tidy. Don't try to write the shortest possible code! Use shortcuts when it makes sense. Take a look at the following examples: ${makeExample( - "Shortening your if conditions", - ` + "Shortening your if conditions", + ` // The && symbol (overriden by :: in Topos) is very often used for conditions! beat(.75) :: snd('linnhats').n([1,4,5].beat()).out() beat(1) :: snd('bd').out() @@ -42,42 +42,42 @@ beat(1) :: snd('bd').out() //// beat(1) :: snd('bd').out() `, - true, -)} + true, + )} ${makeExample( - "More complex conditions using ?", - ` + "More complex conditions using ?", + ` // The ? symbol can be used to write a if/true/false condition beat(4) ? snd('kick').out() : beat(2) :: snd('snare').out() // (true) ? log('very true') : log('very false') `, - false, -)} + false, + )} ${makeExample( - "Using not and other short symbols", - ` + "Using not and other short symbols", + ` // The ! symbol can be used to reverse a condition beat(4) ? snd('kick').out() : beat(2) :: snd('snare').out() !beat(2) :: beat(0.5) :: snd('clap').out() `, - false, -)} + false, + )} # About crashes and bugs Things will crash! It's part of the show! You will learn progressively to avoid mistakes and to write safer code. Do not hesitate to kill the page or to stop the transport if you feel overwhelmed by an algorithm blowing up. There is no safeguard to stop you from doing most things. This is to ensure that you have all the available possible room to write bespoke code and experiment with your ideas through code. ${makeExample( - "This example will crash! Who cares?", - ` + "This example will crash! Who cares?", + ` // This is crashing. See? No harm! qjldfqsdklqsjdlkqjsdlqkjdlksjd `, - true, -)} + true, + )} `; }; diff --git a/src/documentation/basics/index.ts b/src/documentation/basics/index.ts new file mode 100644 index 0000000..0cb9975 --- /dev/null +++ b/src/documentation/basics/index.ts @@ -0,0 +1,7 @@ +export { introduction } from './welcome'; +export { atelier } from './atelier'; +export { software_interface } from './interface'; +export { shortcuts } from './keyboard'; +export { code } from './code'; +export { mouse } from './mouse'; +export { interaction } from './interaction'; diff --git a/src/documentation/basics/interaction.ts b/src/documentation/basics/interaction.ts index 983950b..dcc4f6d 100644 --- a/src/documentation/basics/interaction.ts +++ b/src/documentation/basics/interaction.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; // @ts-ignore export const interaction = (application: Editor): string => { diff --git a/src/documentation/basics/interface.ts b/src/documentation/basics/interface.ts index f6978a4..32688ec 100644 --- a/src/documentation/basics/interface.ts +++ b/src/documentation/basics/interface.ts @@ -1,4 +1,4 @@ -import { key_shortcut, makeExampleFactory } from "../../Documentation"; +import { key_shortcut, makeExampleFactory } from "../Documentation"; import { type Editor } from "../../main"; import topos_arch from "./topos_arch.svg"; import many_universes from "./many_universes.svg"; @@ -38,24 +38,24 @@ Every Topos session is composed of **local**, **global** and **init** scripts. T ${makeExample( - "Calling scripts to form a musical piece", - ` + "Calling scripts to form a musical piece", + ` beat(1) :: script(1) // Calling local script n°1 flip(4) :: beat(.5) :: script(2) // Calling script n°2 `, - true, -)} + true, + )} ${makeExample( - "Script execution can become musical too!", - ` + "Script execution can become musical too!", + ` // Use algorithms to pick a script. beat(1) :: script([1, 3, 5].pick()) flip(4) :: beat([.5, .25].beat(16)) :: script( [5, 6, 7, 8].beat()) `, - false, -)} + false, + )} ### Navigating the interface diff --git a/src/documentation/basics/keyboard.ts b/src/documentation/basics/keyboard.ts index 675b3e9..1a336fe 100644 --- a/src/documentation/basics/keyboard.ts +++ b/src/documentation/basics/keyboard.ts @@ -1,6 +1,6 @@ -import { key_shortcut } from "../../Documentation"; +import { key_shortcut } from "../Documentation"; import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const shortcuts = (app: Editor): string => { let makeExample = makeExampleFactory(app); @@ -69,12 +69,12 @@ By pressing the ${key_shortcut( )} when playing this example: ${makeExample( - "Claping twice as fast with fill", - ` + "Claping twice as fast with fill", + ` beat(fill() ? 1/4 : 1/2)::sound('cp').out() `, - true, -)} + true, + )} `; }; diff --git a/src/documentation/basics/mouse.ts b/src/documentation/basics/mouse.ts index 36b5a9c..5d0e0ad 100644 --- a/src/documentation/basics/mouse.ts +++ b/src/documentation/basics/mouse.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const mouse = (app: Editor): string => { let makeExample = makeExampleFactory(app); @@ -16,8 +16,8 @@ You can get the current position of the mouse on the screen by using the followi - mouseY(): the vertical position of the mouse on the screen (as a floating point number). ${makeExample( - "Vibrato controlled by mouse", - ` + "Vibrato controlled by mouse", + ` beat(.25) :: sound('sine') .note([0,4,5,10,11,15,16] .palindrome() @@ -27,8 +27,8 @@ beat(.25) :: sound('sine') .pan(r(0, 1)) .room(0.35).size(4).out() `, - true, -)} + true, + )}
@@ -39,15 +39,15 @@ Current mouse position can also be used to generate notes: ${makeExample( - "Using the mouse to output a note!", - ` + "Using the mouse to output a note!", + ` beat(.25) :: sound('sine') .lpf(7000) .delay(0.5).delayt(1/6).delayfb(0.2) .note(noteX()) .room(0.35).size(4).out()`, - true, -)} + true, + )} ## Mouse and Arrays @@ -58,14 +58,14 @@ You can use the mouse to explore the valuesq contained in an Array: ${makeExample( - "Taking values out of an Array with the mouse", - ` + "Taking values out of an Array with the mouse", + ` log([1,2,3,4].mouseX()) log([4,5,6,7].mouseY()) `, - true, -)} + true, + )} diff --git a/src/documentation/basics/welcome.ts b/src/documentation/basics/welcome.ts index 85e352f..82c545b 100644 --- a/src/documentation/basics/welcome.ts +++ b/src/documentation/basics/welcome.ts @@ -1,6 +1,6 @@ -import { makeExampleFactory, key_shortcut } from "../../Documentation"; +import { makeExampleFactory, key_shortcut } from "../Documentation"; import { type Editor } from "../../main"; -import { examples } from "../../examples/excerpts"; +import { examples } from "../excerpts"; export const introduction = (application: Editor): string => { const makeExample = makeExampleFactory(application); diff --git a/src/examples/excerpts.ts b/src/documentation/excerpts.ts similarity index 100% rename from src/examples/excerpts.ts rename to src/documentation/excerpts.ts diff --git a/src/documentation/learning/audio_engine/amplitude.ts b/src/documentation/learning/audio_engine/amplitude.ts index e59109e..6ca03de 100644 --- a/src/documentation/learning/audio_engine/amplitude.ts +++ b/src/documentation/learning/audio_engine/amplitude.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const amplitude = (application: Editor): string => { // @ts-ignore @@ -17,11 +17,11 @@ Controlling the volume is probably the most important concept you need to know a | dbgain | db | Attenuation in dB from -inf to +10 (acts as a sound mixer fader).| ${makeExample( - "Velocity manipulated by a counter", - ` + "Velocity manipulated by a counter", + ` beat(.5)::snd('cp').vel($(1)%10 / 10).out()`, - true, -)} + true, + )} ## Amplitude Enveloppe @@ -38,8 +38,8 @@ beat(.5)::snd('cp').vel($(1)%10 / 10).out()`, Note that the **sustain** value is not a duration but an amplitude value (how loud). The other values are the time for each stage to take place. Here is a fairly complete example using the sawtooth basic waveform. ${makeExample( - "Simple synthesizer", - ` + "Simple synthesizer", + ` register("smooth", x => x.cutoff(r(100,500)) .lpadsr(usaw(1/8) * 8, 0.05, .125, 0, 0) .gain(r(0.25, 0.4)).adsr(0, r(.2,.4), r(0,0.5), 0) @@ -51,15 +51,15 @@ beat(.25)::sound('sawtooth') .note([50,57,55,60].add(12).beat(1.5)) .smooth().out(); `, - true, -)}; + true, + )}; Sometimes, using a full ADSR envelope is a bit overkill. There are other simpler controls to manipulate the envelope like the .ad method: ${makeExample( - "Replacing .adsr by .ad", - ` + "Replacing .adsr by .ad", + ` register("smooth", x => x.cutoff(r(100,500)) .lpadsr(usaw(1/8) * 8, 0.05, .125, 0, 0) .gain(r(0.25, 0.4)).ad(0, 0.25) @@ -71,8 +71,8 @@ beat(.25)::sound('sawtooth') .note([50,57,55,60].add(12).beat(1.5)) .smooth().out(); `, - true, -)}; + true, + )}; `; }; diff --git a/src/documentation/learning/audio_engine/audio_basics.ts b/src/documentation/learning/audio_engine/audio_basics.ts index f38d5d9..2b1266f 100644 --- a/src/documentation/learning/audio_engine/audio_basics.ts +++ b/src/documentation/learning/audio_engine/audio_basics.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const audio_basics = (application: Editor): string => { // @ts-ignore @@ -17,13 +17,13 @@ Use the sound(name: string) function to play a sound. You can also writ Whatever you choose, the syntax stays the same. See the following example: ${makeExample( - "Playing sounds is easy", - ` + "Playing sounds is easy", + ` beat(1) && sound('bd').out() beat(0.5) && sound('hh').out() `, - true, -)} + true, + )} These commands, in plain english, can be translated to: @@ -33,13 +33,13 @@ These commands, in plain english, can be translated to: Let's make this example a bit more complex: ${makeExample( - "Adding some effects", - ` + "Adding some effects", + ` beat(1) && sound('bd').coarse(0.25).room(0.5).orbit(2).out(); beat(0.5) && sound('hh').delay(0.25).delaytime(0.125).out(); `, - true, -)} + true, + )} Now, it translates as follows: @@ -54,13 +54,13 @@ If you remove beat instruction, you will end up with a deluge of kick d To play a sound, you always need the .out() method at the end of your chain. THis method tells **Topos** to send the chain to the audio engine. The .out method can take an optional argument to send the sound to a numbered effect bus, from 0 to n : ${makeExample( - "Using the .out method", - ` + "Using the .out method", + ` // Playing a clap on the third bus (0-indexed) beat(1)::sound('cp').out(2) `, - true, -)} + true, + )} Try to remove .out. You will see that no sound is playing at all! @@ -69,16 +69,16 @@ Try to remove .out. You will see that no sound is playing at all! - Sounds are **composed** by adding qualifiers/parameters that modify the sound or synthesizer you have picked (_e.g_ sound('...').blabla(...)..something(...).out(). Think of it as _audio chains_. ${makeExample( - "Complex sonic object", - ` + "Complex sonic object", + ` beat(1) :: sound('pad').n(1) .begin(rand(0, 0.4)) .freq([50,52].beat()) .size(0.9).room(0.9) .velocity(0.25) .pan(usine()).release(2).out()`, - true, -)} + true, + )} ## Picking a specific sound @@ -102,12 +102,12 @@ If you choose the sound kick, you are asking for the first sample in th The .n(number) method can be used to pick a sample from the currently selected sample folder. For instance, the following script will play a random sample from the _kick_ folder: ${makeExample( - "Picking a sample", - ` + "Picking a sample", + ` beat(1) && sound('kick').n([1,2,3,4,5,6,7,8].pick()).out() `, - true, -)} + true, + )} You can also use the : to pick a sample number directly from the sound function: @@ -122,12 +122,12 @@ beat(1) && sound('kick:3').out() You can use any number to pick a sound. Don't be afraid of using a number too big. If the number exceeds the number of available samples, it will simply wrap around and loop infinitely over the folder. Let's demonstrate this by using the mouse over a very large sample folder: ${makeExample( - "Picking a sample... with the mouse!", - ` + "Picking a sample... with the mouse!", + ` // Move your mouse to change the sample being used! beat(.25) && sound('ST09').n(Math.floor(mouseX())).out()`, - true, -)} + true, + )} The .n method is also used for synthesizers but it behaves differently. When using a synthesizer, this method can help you determine the number of harmonics in your waveform. See the **Synthesizers** section to learn more about this. @@ -150,8 +150,8 @@ There is a special method to choose the _orbit_ that your sound is going to use: You can play a sound _dry_ and another sound _wet_. Take a look at this example where the reverb is only affecting one of the sounds: ${makeExample( - "Dry and wet", - ` + "Dry and wet", + ` // This sound is dry beat(1)::sound('hh').out() @@ -159,23 +159,23 @@ beat(1)::sound('hh').out() // This sound is wet (reverb) beat(2)::sound('cp').orbit(2).room(0.5).size(8).out() `, - true, -)} + true, + )} ## The art of chaining Learning to create complex chains is very important when using **Topos**. It can take some time to learn all the possible parameters. Don't worry, it's actually rather easy to learn. ${makeExample( - "Complex chain", - ` + "Complex chain", + ` beat(0.25) && sound('fhh') .sometimes(s=>s.speed([2, 0.5].pick())) .room(0.9).size(0.9).gain(1) .cutoff(usine(1/2) * 5000) .out()`, - true, -)} + true, + )} Most audio parameters can be used both for samples and synthesizers. This is quite unconventional if you are familiar with a more traditional music software. `; diff --git a/src/documentation/learning/audio_engine/distortion.ts b/src/documentation/learning/audio_engine/distortion.ts index c6f8d36..5922e58 100644 --- a/src/documentation/learning/audio_engine/distortion.ts +++ b/src/documentation/learning/audio_engine/distortion.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const distortion = (application: Editor): string => { // @ts-ignore @@ -18,13 +18,13 @@ Three additional effects that are easy enough to understand. These effects are d ${makeExample( - "Crunch... crunch... crunch!", - ` + "Crunch... crunch... crunch!", + ` beat(.5)::snd('pad').coarse($(1) % 16).clip(.5).out(); // Comment me beat(.5)::snd('pad').crush([16, 8, 4].beat(2)).clip(.5).out() `, - true, -)}; + true, + )}; `; }; diff --git a/src/documentation/learning/audio_engine/effects.ts b/src/documentation/learning/audio_engine/effects.ts index 658bf58..4de1acc 100644 --- a/src/documentation/learning/audio_engine/effects.ts +++ b/src/documentation/learning/audio_engine/effects.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const effects = (application: Editor): string => { // @ts-ignore @@ -24,12 +24,12 @@ For that reason, it is often a good idea to set fixed reverb values per orbit. D | roomdim | | Reverb lowpass frequency at -60db (in hertz) | ${makeExample( - "Clapping in the cavern", - ` + "Clapping in the cavern", + ` beat(2)::snd('cp').room(0.5).size(4).out() `, - true, -)}; + true, + )}; ## Delay @@ -42,13 +42,13 @@ A good sounding delay unit that can go into feedback territory. Use it without m | delayfeedback | delayfb | Delay feedback (between 0 and 1) | ${makeExample( - "Who doesn't like delay?", - ` + "Who doesn't like delay?", + ` beat(2)::snd('cp').delay(0.5).delaytime(0.75).delayfb(0.8).out() beat(4)::snd('snare').out() beat(1)::snd('kick').out()`, - true, -)} + true, + )} ## Phaser @@ -60,16 +60,16 @@ beat(1)::snd('kick').out()`, | phaserCenter | phascenter | Phaser center frequency (default to 1000) | ${makeExample( - "Super cool phaser lick", - ` + "Super cool phaser lick", + ` rhythm(.5, 7, 8)::sound('wt_stereo') .phaser(0.75).phaserSweep(3000) .phaserCenter(1500).phaserDepth(1) .note([0, 1, 2, 3, 4, 5, 6].scale('pentatonic', 50).beat(0.25)) .room(0.5).size(4).out() `, - true, -)} + true, + )} ## Distorsion, saturation, destruction @@ -83,29 +83,29 @@ Three additional effects that are easy enough to understand. These effects are d ${makeExample( - "Crunch... crunch... crunch!", - ` + "Crunch... crunch... crunch!", + ` beat(.5)::snd('pad').coarse($(1) % 16).clip(.5).out(); // Comment me beat(.5)::snd('pad').crush([16, 8, 4].beat(2)).clip(.5).out() `, - true, -)}; + true, + )}; ## Vibrato You can also add some amount of vibrato to the sound using the vib and vibmod methods. These can turn any oscillator into something more lively and/or into a sound effect when used with a high amount of modulation. ${makeExample( - "Different vibrato settings", - ` + "Different vibrato settings", + ` tempo(140); beat(1) :: sound('triangle') .freq(400).release(0.2) .vib([1/2, 1, 2, 4].beat()) .vibmod([1,2,4,8].beat(2)) .out()`, - true, -)} + true, + )} ## Compression diff --git a/src/documentation/learning/audio_engine/filters.ts b/src/documentation/learning/audio_engine/filters.ts index 5c8988e..dfce5f2 100644 --- a/src/documentation/learning/audio_engine/filters.ts +++ b/src/documentation/learning/audio_engine/filters.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const filters = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -13,10 +13,10 @@ Filters can be applied to both synthesizers and samples. They are used to shape - **bandpass filter**: filters the low and high frequencies around a frequency band, keeping what's in the middle. ${makeExample( - "Filtering the high frequencies of an oscillator", - `beat(.5) :: sound('sawtooth').cutoff(50 + usine(1/8) * 2000).out()`, - true, -)} + "Filtering the high frequencies of an oscillator", + `beat(.5) :: sound('sawtooth').cutoff(50 + usine(1/8) * 2000).out()`, + true, + )} These filters all come with their own set of parameters. Note that we are describing the parameters of the three different filter types here. Choose the right parameters depending on the filter type you are using: @@ -29,10 +29,10 @@ These filters all come with their own set of parameters. Note that we are descri | resonance | lpq | resonance of the lowpass filter (0-1) | ${makeExample( - "Filtering a bass", - `beat(.5) :: sound('jvbass').lpf([250,1000,8000].beat()).out()`, - true, -)} + "Filtering a bass", + `beat(.5) :: sound('jvbass').lpf([250,1000,8000].beat()).out()`, + true, + )} ### Highpass filter @@ -42,10 +42,10 @@ ${makeExample( | hresonance | hpq | resonance of the highpass filter (0-1) | ${makeExample( - "Filtering a noise source", - `beat(.5) :: sound('gtr').hpf([250,1000, 2000, 3000, 4000].beat()).end(0.5).out()`, - true, -)} + "Filtering a noise source", + `beat(.5) :: sound('gtr').hpf([250,1000, 2000, 3000, 4000].beat()).end(0.5).out()`, + true, + )} ### Bandpass filter @@ -55,10 +55,10 @@ ${makeExample( | bandq | bpq | resonance of the bandpass filter (0-1) | ${makeExample( - "Sweeping the filter on the same guitar sample", - `beat(.5) :: sound('gtr').bandf(100 + usine(1/8) * 4000).end(0.5).out()`, - true, -)} + "Sweeping the filter on the same guitar sample", + `beat(.5) :: sound('gtr').bandf(100 + usine(1/8) * 4000).end(0.5).out()`, + true, + )} Alternatively, lpf, hpf and bpf can take a second argument, the **resonance**. @@ -69,10 +69,10 @@ You can also use the ftype method to change the filter type (order). Th - ftype(type: string): sets the filter type (order), either 12db or 24db. ${makeExample( - "Filtering a bass", - `beat(.5) :: sound('jvbass').ftype(['12db', '24db'].beat(4)).lpf([250,1000,8000].beat()).out()`, - true, -)} + "Filtering a bass", + `beat(.5) :: sound('jvbass').ftype(['12db', '24db'].beat(4)).lpf([250,1000,8000].beat()).out()`, + true, + )} ## Filter envelopes @@ -91,12 +91,12 @@ The examples we have studied so far are static. They filter the sound around a f ${makeExample( - "Filtering a sawtooth wave dynamically", - `beat(.5) :: sound('sawtooth').note([48,60].beat()) + "Filtering a sawtooth wave dynamically", + `beat(.5) :: sound('sawtooth').note([48,60].beat()) .cutoff(5000).lpa([0.05, 0.25, 0.5].beat(2)) .lpenv(-8).lpq(10).out()`, - true, -)} + true, + )} ### Highpass envelope @@ -111,12 +111,12 @@ ${makeExample( ${makeExample( - "Let's use another filter using the same example", - `beat(.5) :: sound('sawtooth').note([48,60].beat()) + "Let's use another filter using the same example", + `beat(.5) :: sound('sawtooth').note([48,60].beat()) .hcutoff(1000).hpa([0.05, 0.25, 0.5].beat(2)) .hpenv(8).hpq(10).out()`, - true, -)} + true, + )} ### Bandpass envelope @@ -131,14 +131,14 @@ ${makeExample( ${makeExample( - "And the bandpass filter, just for fun", - `beat(.5) :: sound('sawtooth').note([48,60].beat()) + "And the bandpass filter, just for fun", + `beat(.5) :: sound('sawtooth').note([48,60].beat()) .bandf([500,1000,2000].beat(2)) .bpa([0.25, 0.125, 0.5].beat(2) * 4) .bpenv(-4).release(2).out() `, - true, -)} + true, + )} `; diff --git a/src/documentation/learning/audio_engine/index.ts b/src/documentation/learning/audio_engine/index.ts new file mode 100644 index 0000000..f11dd62 --- /dev/null +++ b/src/documentation/learning/audio_engine/index.ts @@ -0,0 +1,6 @@ +export { amplitude } from './amplitude'; +export { effects } from './effects'; +export { sampler } from './sampler'; +export { synths } from './synths'; +export { filters } from './filters'; +export { audio_basics } from './audio_basics'; diff --git a/src/documentation/learning/audio_engine/sampler.ts b/src/documentation/learning/audio_engine/sampler.ts index ad79f85..dd88cf8 100644 --- a/src/documentation/learning/audio_engine/sampler.ts +++ b/src/documentation/learning/audio_engine/sampler.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const sampler = (application: Editor): string => { // @ts-ignore @@ -28,8 +28,8 @@ The sampler is a rather complex beast. There is a lot you can do by manipulating Let's apply some of these methods naïvely. We will then break everything using simpler examples. ${makeExample( - "Complex sampling duties", - ` + "Complex sampling duties", + ` // Using some of the modifiers described above :) beat(.5)::snd('pad').begin(0.2) .speed([1, 0.9, 0.8].beat(4)) @@ -38,8 +38,8 @@ beat(.5)::snd('pad').begin(0.2) .room(0.8).size(0.5) .clip(1).out() `, - true, -)}; + true, + )}; ## Playback speed / pitching samples @@ -47,37 +47,37 @@ beat(.5)::snd('pad').begin(0.2) Let's play with the speed parameter to control the pitch of sample playback: ${makeExample( - "Controlling the playback speed", - ` + "Controlling the playback speed", + ` beat(0.5)::sound('notes') .speed([1,2,3,4].palindrome().beat(0.5)).out() `, - true, -)} + true, + )} It also works by using negative values. It reverses the playback: ${makeExample( - "Playing samples backwards", - ` + "Playing samples backwards", + ` beat(0.5)::sound('notes') .speed(-[1,2,3,4].palindrome().beat(0.5)).out() `, - true, -)} + true, + )} Of course you can play melodies using samples: ${makeExample( - "Playing melodies using samples", - ` + "Playing melodies using samples", + ` beat(0.5)::sound('notes') .room(0.5).size(4) .note([0, 2, 3, 4, 5].scale('minor', 50).beat(0.5)).out() `, - true, -)} + true, + )} ## Panning @@ -85,14 +85,14 @@ To pan samples, use the .pan method with a number between 0 an ${makeExample( - "Playing melodies using samples", - ` + "Playing melodies using samples", + ` beat(0.25)::sound('notes') .room(0.5).size(4).pan(r(0, 1)) .note([0, 2, 3, 4, 5].scale('minor', 50).beat(0.25)).out() `, - true, -)} + true, + )} ## Looping over a sample @@ -101,29 +101,29 @@ Using loop (1 for looping), loopBegin and loopEnd ${makeExample( - "Granulation using loop", - ` + "Granulation using loop", + ` beat(0.25)::sound('fikea').loop(1) .lpf(ir(2000, 5000)) .loopBegin(0).loopEnd(r(0, 1)) .room(0.5).size(4).pan(r(0, 1)) .note([0, 2, 3, 4, 5].scale('minor', 50).beat(0.25)).out() `, - true, -)} + true, + )} ## Stretching a sample The stretch parameter can help you to stretch long samples like amen breaks: ${makeExample( - "Playing an amen break", - ` + "Playing an amen break", + ` // Note that stretch has the same value as beat beat(4) :: sound('amen1').n(11).stretch(4).out() beat(1) :: sound('kick').shape(0.35).out()`, - true, -)}; + true, + )}; ## Cutting samples @@ -132,43 +132,43 @@ Sometimes, you will find it necessary to cut a sample. It can be because the sam Know about the begin and end parameters. They are not related to the sampler itself, but to the length of the event you are playing. Let's cut the granular example: ${makeExample( - "Cutting a sample using end", - ` + "Cutting a sample using end", + ` beat(0.25)::sound('notes') .end(usine(1/2)/0.5) .room(0.5).size(4).pan(r(0, 1)) .note([0, 2, 3, 4, 5].scale('minor', 50).beat(0.25)).out() `, - true, -)} + true, + )} You can also use clip to cut the sample everytime a new sample comes in: ${makeExample( - "Cutting a sample using end", - ` + "Cutting a sample using end", + ` beat(0.125)::sound('notes') .cut(1) .room(0.5).size(4).pan(r(0, 1)) .note([0, 2, 3, 4, 5].scale('minor', 50).beat(0.125) + [-12,12].beat()).out() `, - true, -)} + true, + )} ## Adding vibrato to samples You can add vibrato to any sample using vib and vibmod: ${makeExample( - "Adding vibrato to a sample", - ` + "Adding vibrato to a sample", + ` beat(1)::sound('fhang').vib([1, 2, 4].bar()).vibmod([0.5, 2].beat()).out() `, - true, -)} + true, + )} `; diff --git a/src/documentation/learning/audio_engine/synths.ts b/src/documentation/learning/audio_engine/synths.ts index a089ecf..89c832e 100644 --- a/src/documentation/learning/audio_engine/synths.ts +++ b/src/documentation/learning/audio_engine/synths.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const synths = (application: Editor): string => { const makeExample = makeExampleFactory(application); diff --git a/src/documentation/learning/midi.ts b/src/documentation/learning/midi.ts index ebfde28..d96f4f2 100644 --- a/src/documentation/learning/midi.ts +++ b/src/documentation/learning/midi.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory, key_shortcut } from "../../Documentation"; +import { makeExampleFactory, key_shortcut } from "../Documentation"; export const midi = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -22,22 +22,22 @@ Your web browser is capable of sending and receiving MIDI information through th ${makeExample( - "Listing MIDI outputs", - ` + "Listing MIDI outputs", + ` midi_outputs() `, - true, -)} + true, + )} - midi_output(output_name: string): enter your desired output to connect to it. ${makeExample( - "Changing MIDI output", - ` + "Changing MIDI output", + ` midi_output("MIDI Rocket-Trumpet") `, - true, -)} + true, + )} That's it! You are now ready to play with MIDI. @@ -48,69 +48,69 @@ The most basic MIDI event is the note. MIDI notes traditionally take three param - midi(note: number|object): send a MIDI Note. This function is quite bizarre. It can be written and used in many different ways. You can pass form one up to three arguments in different forms. ${makeExample( - "MIDI note using one parameter: note", - ` + "MIDI note using one parameter: note", + ` // Configure your MIDI first! // => midi_output("MIDI Bus 1") rhythm(.5, 5, 8) :: midi(50).out() `, - true, -)} + true, + )} ${makeExample( - "MIDI note using three parameters: note, velocity, channel", - ` + "MIDI note using three parameters: note, velocity, channel", + ` // MIDI Note 50, Velocity 50 + LFO, Channel 0 rhythm(.5, 5, 8) :: midi(50, 50 + usine(.5) * 20, 0).out() `, - false, -)} + false, + )} ${makeExample( - "MIDI note by passing an object", - ` + "MIDI note by passing an object", + ` // MIDI Note 50, Velocity 50 + LFO, Channel 0 rhythm(.5, 5, 8) :: midi({note: 50, velocity: 50 + usine(.5) * 20, channel: 0}).out() `, - false, -)} + false, + )} We can now have some fun and starting playing a small piano piece: ${makeExample( - "Playing some piano", - ` + "Playing some piano", + ` tempo(80) // Setting a default BPM beat(.5) && midi(36 + [0,12].beat()).sustain(0.02).out() beat(.25) && midi([64, 76].pick()).sustain(0.05).out() beat(.75) && midi([64, 67, 69].beat()).sustain(0.05).out() beat(.25) && midi([64, 67, 69].beat() + 24).sustain(0.05).out() `, - true, -)} + true, + )} ## Control and Program Changes - control_change({control: number, value: number, channel: number}): send a MIDI Control Change. This function takes a single object argument to specify the control message (_e.g._ control_change({control: 1, value: 127, channel: 1})). ${makeExample( - "Imagine that I am tweaking an hardware synthesizer!", - ` + "Imagine that I am tweaking an hardware synthesizer!", + ` control_change({control: [24,25].pick(), value: irand(1,120), channel: 1}) control_change({control: [30,35].pick(), value: irand(1,120) / 2, channel: 1}) `, - true, -)} + true, + )} - program_change(program: number, channel: number): send a MIDI Program Change. This function takes two arguments to specify the program and the channel (_e.g._ program_change(1, 1)). ${makeExample( - "Crashing old synthesizers: a hobby", - ` + "Crashing old synthesizers: a hobby", + ` program_change([1,2,3,4,5,6,7,8].pick(), 1) `, - true, -)} + true, + )} ## System Exclusive Messages @@ -119,44 +119,44 @@ program_change([1,2,3,4,5,6,7,8].pick(), 1) ${makeExample( - "Nobody can say that we don't support Sysex messages!", - ` + "Nobody can say that we don't support Sysex messages!", + ` sysex(0x90, 0x40, 0x7f) `, - true, -)} + true, + )} ## Clock - midi_clock(): send a MIDI Clock message. This function is used to synchronize Topos with other MIDI devices or DAWs. ${makeExample( - "Tic, tac, tic, tac...", - ` + "Tic, tac, tic, tac...", + ` beat(.25) && midi_clock() // Sending clock to MIDI device from the global buffer `, - true, -)} + true, + )} ## Using midi with ziffers Ziffers offers some shorthands for defining channels within the patterns. See Ziffers for more information. ${makeExample( - "Using midi with ziffers", - ` + "Using midi with ziffers", + ` z1('0 2 e 5 2 q 4 2').midi().port(2).channel(4).out() `, - true, -)} + true, + )} ${makeExample( - "Setting the channel within the pattern", - ` + "Setting the channel within the pattern", + ` z1('(0 2 e 5 2):0 (4 2):1').midi().out() `, - true, -)} + true, + )} `; }; diff --git a/src/documentation/learning/osc.ts b/src/documentation/learning/osc.ts index af56bc7..5dada8d 100644 --- a/src/documentation/learning/osc.ts +++ b/src/documentation/learning/osc.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const osc = (application: Editor): string => { // @ts-ignore @@ -24,52 +24,52 @@ Send an **OSC** message to the server from another application or device at the You can access the last 1000 messages using the getOsc() function without any argument. This is raw data, you will need to parse it yourself: ${makeExample( - "Reading the last OSC messages", - ` + "Reading the last OSC messages", + ` beat(1)::getOsc() // 0 : {data: Array(2), address: '/lala'} // 1 : {data: Array(2), address: '/lala'} // 2 : {data: Array(2), address: '/lala'}`, - true, -)} + true, + )} ### Filtered messages The getOsc() can receive an address filter as an argument. This will return only the messages that match the filter: ${makeExample( - "Reading the last OSC messages (filtered)", - ` + "Reading the last OSC messages (filtered)", + ` beat(1)::getOsc("/lala") // 0 : (2) [89, 'bob'] // 1 : (2) [84, 'bob'] // 2 : (2) [82, 'bob'] `, - true, -)} + true, + )} ## Output Once the server is loaded, you are ready to send an **OSC** message: ${makeExample( - "Sending a simple OSC message", - ` + "Sending a simple OSC message", + ` beat(1)::sound('cp').speed(2).vel(0.5).osc() `, - true, -)} + true, + )} This is a simple **OSC** message that will inherit all the properties of the sound. You can also send customized OSC messages using the osc() function: ${makeExample( - "Sending a customized OSC message", - ` + "Sending a customized OSC message", + ` // osc(address, port, ...message) osc('/my/osc/address', 5000, 1, 2, 3) `, - true, -)} + true, + )} `; }; diff --git a/src/documentation/learning/samples/index.ts b/src/documentation/learning/samples/index.ts new file mode 100644 index 0000000..207891a --- /dev/null +++ b/src/documentation/learning/samples/index.ts @@ -0,0 +1,3 @@ +export { loading_samples } from './loading_samples'; +export { sample_banks } from './sample_banks'; +export { sample_list } from './sample_list'; diff --git a/src/documentation/learning/samples/loading_samples.ts b/src/documentation/learning/samples/loading_samples.ts index 404da7a..2e87c9d 100644 --- a/src/documentation/learning/samples/loading_samples.ts +++ b/src/documentation/learning/samples/loading_samples.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const loading_samples = (application: Editor): string => { // @ts-ignore @@ -12,36 +12,36 @@ Topos is exposing the samples function that you can use to load your ow Samples are loaded on-the-fly from the web. Topos is a web application living in the browser. It is running in a sandboxed environment. Thus, it cannot have access to the files stored on your local system. Loading samples requires building a _map_ of the audio files, where a name is associated to a specific file: ${makeExample( - "Loading samples from a map", - `samples({ + "Loading samples from a map", + `samples({ bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav'], sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'], hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'], }, 'github:tidalcycles/Dirt-Samples/master/');`, - true, -)} + true, + )} This example is loading two samples from each folder declared in the original repository (in the strudel.json file). You can then play with them using the syntax you are already used to: ${makeExample( - "Playing with the loaded samples", - `rhythm(.5, 5, 8)::sound('bd').n(ir(1,2)).end(1).out() + "Playing with the loaded samples", + `rhythm(.5, 5, 8)::sound('bd').n(ir(1,2)).end(1).out() `, - true, -)} + true, + )} Internally, Topos is loading samples using a different technique where sample maps are directly taken from the previously mentioned strudel.json file that lives in each repository: ${makeExample( - "This is how Topos is loading its own samples", - ` + "This is how Topos is loading its own samples", + ` // Visit the concerned repos and search for 'strudel.json' samples("github:tidalcycles/Dirt-Samples/master"); samples("github:Bubobubobubobubo/Dough-Samples/main"); samples("github:Bubobubobubobubo/Dough-Amiga/main"); `, - true, -)} + true, + )} To learn more about the audio sample loading mechanism, please refer to [this page](https://strudel.tidalcycles.org/learn/samples) written by Felix Roos who has implemented the sample loading mechanism. The API is absolutely identic in Topos! @@ -50,16 +50,16 @@ To learn more about the audio sample loading mechanism, please refer to [this pa You can load samples coming from [Freesound](https://freesound.org/) using the [Shabda](https://shabda.ndre.gr/) API. To do so, study the following example: ${makeExample( - "Loading samples from shabda", - ` + "Loading samples from shabda", + ` // Prepend the sample you want with 'shabda:' samples("shabda:ocean") // Use the sound without 'shabda:' beat(1)::sound('ocean').clip(1).out() `, - true, -)} + true, + )} You can also use the .n attribute like usual to load a different sample. `; diff --git a/src/documentation/learning/samples/sample_banks.ts b/src/documentation/learning/samples/sample_banks.ts index 2e7701d..4f13c9f 100644 --- a/src/documentation/learning/samples/sample_banks.ts +++ b/src/documentation/learning/samples/sample_banks.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const sample_banks = (application: Editor): string => { // @ts-ignore diff --git a/src/documentation/learning/samples/sample_list.ts b/src/documentation/learning/samples/sample_list.ts index f51820d..e68ba17 100644 --- a/src/documentation/learning/samples/sample_list.ts +++ b/src/documentation/learning/samples/sample_list.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const samples_to_markdown = ( application: Editor, diff --git a/src/documentation/learning/time/cyclical_time.ts b/src/documentation/learning/time/cyclical_time.ts index 16adc34..aa4d4ca 100644 --- a/src/documentation/learning/time/cyclical_time.ts +++ b/src/documentation/learning/time/cyclical_time.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const cyclical_time = (app: Editor): string => { // @ts-ignore @@ -16,17 +16,17 @@ Time as a cycle. A cycle can be quite long (a few bars) or very short (a few pul - offset: offset (in beats) to apply. An offset of 0.5 will return true against the beat. ${makeExample( - "Using different mod values", - ` + "Using different mod values", + ` // This code is alternating between different mod values beat([1,1/2,1/4,1/8].beat(2)) :: sound('hat').n(0).out() `, - true, -)} + true, + )} ${makeExample( - "Some sort of ringtone", - ` + "Some sort of ringtone", + ` // Blip generator :) let blip = (freq) => { return sound('wt_piano') @@ -41,16 +41,16 @@ beat(1/3) :: blip(400).pan(r(0,1)).out(); flip(3) :: beat(1/6) :: blip(800).pan(r(0,1)).out(); beat([1,0.75].beat(2)) :: blip([50, 100].beat(2)).pan(r(0,1)).out(); `, - false, -)} + false, + )} ${makeExample( - "Beat can match multiple values", - ` + "Beat can match multiple values", + ` beat([.5, 1.25])::sound('hat').out() `, - false, -)} + false, + )} - pulse(n: number | number[] = 1, offset: number = 1): return true every _n_ pulses. A pulse is the tiniest possible rhythmic value. - number: if number = 1, the function will return true every pulse. Lists can be used too. @@ -58,21 +58,21 @@ beat([.5, 1.25])::sound('hat').out() ${makeExample( - "Intriguing rhythms", - ` + "Intriguing rhythms", + ` pulse([24, 16])::sound('hat').ad(0, .02).out() pulse([48, [36,24].dur(4, 1)])::sound('fhardkick').ad(0, .1).out() `, - true, -)} + true, + )} ${makeExample( - "pulse is the OG rhythmic function in Topos", - ` + "pulse is the OG rhythmic function in Topos", + ` pulse([48, 24, 16].beat(4)) :: sound('linnhats').out() beat(1)::snd(['bd', '808oh'].beat(1)).out() `, - false, -)} + false, + )} - bar(n: number | number[] = 1, offset: number = 1): return true every _n_ bars. @@ -80,37 +80,37 @@ beat(1)::snd(['bd', '808oh'].beat(1)).out() - offset: offset (in bars) to apply. ${makeExample( - "Four beats per bar: proof", - ` + "Four beats per bar: proof", + ` bar(1)::sound('kick').out() beat(1)::sound('hat').speed(2).out() `, - true, -)} + true, + )} ${makeExample( - "Offsetting beat and bar", - ` + "Offsetting beat and bar", + ` bar(1)::sound('kick').out() beat(1)::sound('hat').speed(2).out() beat(1, 0.5)::sound('hat').speed(4).out() bar(1, 0.5)::sound('sn').out() `, - false, -)} + false, + )} - onbeat(...n: number[]): The onbeat function allows you to lock on to a specific beat from the clock to execute code. It can accept multiple arguments. It's usage is very straightforward and not hard to understand. You can pass either integers or floating point numbers. By default, topos is using a 4/4 bar meaning that you can target any of these beats (or in-between) with this function. ${makeExample( - "Some simple yet detailed rhythms", - ` + "Some simple yet detailed rhythms", + ` onbeat(1,2,3,4)::snd('kick').out() // Bassdrum on each beat onbeat(2,4)::snd('snare').n([8,4].beat(4)).out() // Snare on acccentuated beats onbeat(1.5,2.5,3.5, 3.75)::snd('hat').gain(r(0.9,1.1)).out() // Cool high-hats `, - true, -)} + true, + )} ## XOX Style sequencers @@ -119,32 +119,32 @@ onbeat(1.5,2.5,3.5, 3.75)::snd('hat').gain(r(0.9,1.1)).out() // Cool high-hats - duration: number: an optional duration (in beats) like 1 or 4. It can be patterned. ${makeExample( - "Sequence built using a classic XOX sequencer style", - ` + "Sequence built using a classic XOX sequencer style", + ` seq('xoxo')::sound('fhardkick').out() seq('ooxo')::sound('fsoftsnare').out() seq('xoxo', 0.25)::sound('fhh').out() `, - true, -)} + true, + )} ${makeExample( - "Another sequence using more complex parameters", - ` + "Another sequence using more complex parameters", + ` seq('xoxooxxoo', [0.5, 0.25].dur(2, 1))::sound('fhardkick').out() seq('ooxo', [1, 2].bar())::sound('fsoftsnare').speed(0.5).out() seq(['xoxoxoxx', 'xxoo'].bar())::sound('fhh').out() `, - true, -)} + true, + )} - fullseq(expr: string, duration: number = 0.5): boolean : a variant. Will return true or false for a whole period, depending on the symbol. Useful for long structure patterns. - expr: string: any string composed of x or o like so: "xooxoxxoxoo". - duration: number: an optional duration (in beats) like 1 or 4. It can be patterned. ${makeExample( - "Long structured patterns", - ` + "Long structured patterns", + ` function simplePat() { log('Simple pattern playing!') seq('xoxooxxoo', [0.5, 0.25].dur(2, 1))::sound('fhardkick').out() @@ -159,8 +159,8 @@ function complexPat() { } fullseq('xooxooxx', 4) ? simplePat() : complexPat() `, - true, -)} + true, + )} @@ -171,8 +171,8 @@ We included a bunch of popular rhythm generators in Topos such as the euclidian - rhythm(divisor: number, pulses: number, length: number, rotate: number): boolean: generates true or false values from an euclidian rhythm sequence. This is another version of euclid that does not take an iterator. ${makeExample( - "rhythm is a beginner friendly rhythmic function!", - ` + "rhythm is a beginner friendly rhythmic function!", + ` rhythm(.5, 4, 8)::sound('sine') .fmi(2) .room(0.5).size(8) @@ -181,38 +181,38 @@ rhythm(.5, 7, 8)::sound('sine') .freq(125).ad(0, .2).out() rhythm(.5, 3, 8)::sound('sine').freq(500).ad(0, .5).out() `, - true, -)} + true, + )} - oneuclid(pulses: number, length: number, rotate: number): boolean: generates true or false values from an euclidian rhythm sequence. This is another version of euclid that does not take an iterator. ${makeExample( - "Using oneuclid to create a rhythm without iterators", - ` + "Using oneuclid to create a rhythm without iterators", + ` // Change speed using bpm bpm(250) oneuclid(5, 9) :: snd('kick').out() oneuclid(7,16) :: snd('east').end(0.5).n(irand(3,5)).out() `, - true, -)} + true, + )} - bin(iterator: number, n: number): boolean: a binary rhythm generator. It transforms the given number into its binary representation (_e.g_ 34 becomes 100010). It then returns a boolean value based on the iterator in order to generate a rhythm. - binrhythm(divisor: number, n: number): boolean: boolean: iterator-less version of the binary rhythm generator. ${makeExample( - "Change the integers for a surprise rhythm!", - ` + "Change the integers for a surprise rhythm!", + ` bpm(135); beat(.5) && bin($(1), 12) && snd('kick').n([4,9].beat(1.5)).out() beat(.5) && bin($(2), 34) && snd('snare').n([3,5].beat(1)).out() `, - true, -)} + true, + )} ${makeExample( - "binrhythm for fast cool binary rhythms!", - ` + "binrhythm for fast cool binary rhythms!", + ` let a = 0; a = beat(4) ? irand(1,20) : a; binrhythm(.5, 6) && snd(['kick', 'snare'].beat(0.5)).n(11).out() @@ -221,34 +221,34 @@ binrhythm([.5, .25].beat(1), 30) && snd('wt_granular').n(a) .adsr(0, r(.1, .4), 0, 0).freq([50, 60, 72].beat(4)) .room(1).size(1).out() `, - true, -)} + true, + )} ${makeExample( - "Submarine jungle music", - ` + "Submarine jungle music", + ` bpm(145); beat(.5) && bin($(1), 911) && snd('ST69').n([2,3,4].beat()) .delay(0.125).delayt(0.25).end(0.25).speed(1/3) .room(1).size(1).out() beat(.5) && sound('amencutup').n(irand(2,7)).shape(0.3).out() `, - false, -)} + false, + )} If you don't find it spicy enough, you can add some more probabilities to your rhythms by taking advantage of the probability functions. See the functions documentation page to learn more about them. ${makeExample( - "Probablistic drums in one line!", - ` + "Probablistic drums in one line!", + ` prob(60)::beat(.5) && euclid($(1), 5, 8) && snd('kick').out() prob(60)::beat(.5) && euclid($(2), 3, 8) && snd('mash') .n([1,2,3].beat(1)) .pan(usine(1/4)).out() prob(80)::beat(.5) && sound(['hh', 'hat'].pick()).out() `, - true, -)} + true, + )} diff --git a/src/documentation/learning/time/linear_time.ts b/src/documentation/learning/time/linear_time.ts index 771813f..51efaf4 100644 --- a/src/documentation/learning/time/linear_time.ts +++ b/src/documentation/learning/time/linear_time.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; import pulses from "./pulses.svg"; export const linear_time = (app: Editor): string => { @@ -22,12 +22,12 @@ export const linear_time = (app: Editor): string => { There is a tiny widget at the bottom right of the screen showing you the current BPM and the status of the transport. You can turn it on or off in the settings menu. ${makeExample( - "Printing the transport", - ` + "Printing the transport", + ` log(\`\$\{cbar()}\, \$\{cbeat()\}, \$\{cpulse()\}\`) `, - true, -)} + true, + )} ### BPM and PPQN @@ -64,8 +64,8 @@ These values are **extremely useful** to craft more complex syntax or to write m You can use time primitives as conditionals. The following example will play a pattern A for 2 bars and a pattern B for 2 bars: ${makeExample( - "Manual mode: using time primitives!", - ` + "Manual mode: using time primitives!", + ` // Manual time condition if((cbar() % 4) > 1) { beat(2) && sound('kick').out() @@ -83,8 +83,8 @@ if((cbar() % 4) > 1) { // This is always playing no matter what happens beat([.5, .5, 1, .25].beat(0.5)) :: sound('shaker').out() `, - true, -)} + true, + )} ## Time Warping @@ -94,8 +94,8 @@ Time generally flows from the past to the future. However, you can manipulate it ${makeExample( - "Time is now super elastic!", - ` + "Time is now super elastic!", + ` // Obscure Shenanigans - Bubobubobubo beat([1/4,1/8,1/16].beat(8)):: sound('sine') .freq([100,50].beat(16) + 50 * ($(1)%10)) @@ -108,14 +108,14 @@ flip(3) :: beat([.25,.5].beat(.5)) :: sound('dr') // Jumping back and forth in time beat(.25) :: warp([12, 48, 24, 1, 120, 30].pick()) `, - true, -)} + true, + )} - beat_warp(beat: number): this function jumps to the _n_ beat of the clock. The first beat is 1. ${makeExample( - "Jumping back and forth with beats", - ` + "Jumping back and forth with beats", + ` // Resonance bliss - Bubobubobubo beat(.25)::snd('arpy') .note(30 + [0,3,7,10].beat()) @@ -130,40 +130,40 @@ beat(.5) :: snd('arpy').note( // Comment me to stop warping! beat(1) :: beat_warp([2,4,5,10,11].pick()) `, - true, -)} + true, + )} ## Transport-based rhythm generators - onbeat(...n: number[]): The onbeat function allows you to lock on to a specific beat from the clock to execute code. It can accept multiple arguments. It's usage is very straightforward and not hard to understand. You can pass either integers or floating point numbers. By default, topos is using a 4/4 bar meaning that you can target any of these beats (or in-between) with this function. ${makeExample( - "Some simple yet detailed rhythms", - ` + "Some simple yet detailed rhythms", + ` onbeat(1,2,3,4)::snd('kick').out() // Bassdrum on each beat onbeat(2,4)::snd('snare').n([8,4].beat(4)).out() // Snare on acccentuated beats onbeat(1.5,2.5,3.5, 3.75)::snd('hat').gain(r(0.9,1.1)).out() // Cool high-hats `, - true, -)} + true, + )} ${makeExample( - "Let's do something more complex", - ` + "Let's do something more complex", + ` onbeat(0.5, 2, 3, 3.75)::snd('kick').n(2).out() onbeat(2, [1.5, 3, 4].pick(), 4)::snd('snare').n(8).out() beat([.25, 1/8].beat(1.5))::snd('hat').n(2) .gain(rand(0.4, 0.7)).end(0.05) .pan(usine()).out() `, - false, -)} + false, + )} - oncount(beats: number[], meter: number): This function is similar to onbeat but it allows you to specify a custom number of beats as the last argument. ${makeExample( - "Using oncount to create more variation in the rhythm", - ` + "Using oncount to create more variation in the rhythm", + ` z1('1/16 (0 2 3 4)+(0 2 4 6)').scale('pentatonic').sound('sawtooth') .cutoff([400,500,1000,2000].beat(1)) .lpadsr(2, 0, .2, 0, 0) @@ -171,20 +171,20 @@ z1('1/16 (0 2 3 4)+(0 2 4 6)').scale('pentatonic').sound('sawtooth') onbeat(1,1.5,2,3,4) :: sound('bd').gain(2.0).out() oncount([1,3,5.5,7,7.5,8],8) :: sound('hh').gain(irand(1.0,4.0)).out() `, - true, -)} + true, + )} ${makeExample( - "Using oncount to create rhythms with a custom meter", - ` + "Using oncount to create rhythms with a custom meter", + ` bpm(200) oncount([1, 5, 9, 13],16) :: sound('808bd').n(4).shape(0.5).gain(1.0).out() oncount([5, 6, 13],16) :: sound('shaker').room(0.25).gain(0.9).out() oncount([2, 3, 3.5, 6, 7, 10, 15],16) :: sound('hh').n(8).gain(0.8).out() oncount([1, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16],16) :: sound('hh').out() `, - true, -)} + true, + )} diff --git a/src/documentation/learning/time/long_forms.ts b/src/documentation/learning/time/long_forms.ts index cd46bc9..0bc82c1 100644 --- a/src/documentation/learning/time/long_forms.ts +++ b/src/documentation/learning/time/long_forms.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const long_forms = (app: Editor): string => { // @ts-ignore @@ -14,23 +14,23 @@ Now you know how to play some basic rhythms but in any case, you are stuck in a - **Use the nine local scripts as containers** for sections of your composition. When you start playing with **Topos**, it's easy to forget that there are multiple scripts you can play with. Each script can store a different section or part from your composition. Here is a simple example: ${makeExample( - "Eight bars per section", - ` + "Eight bars per section", + ` // Playing each script for 8 bars in succession script([1,2,3,4].bar(8)) `, - true, -)} + true, + )} You can also give a specific duration to each section using .dur: ${makeExample( - "N beats per section", - ` + "N beats per section", + ` script([1,2,3,4].dur(8, 2, 16, 4)) `, - true, -)} + true, + )} - **Use universes as well**. Transitions between universes are _seamless_, instantaneous. Just switch to different content if you ever hit the limitations of the current _universe_. @@ -40,42 +40,42 @@ script([1,2,3,4].dur(8, 2, 16, 4)) - ratio: number = 50: this argument is ratio expressed in %. It determines how much of the period should be true or false. A ratio of 75 means that 75% of the period will be true. A ratio of 25 means that 25% of the period will be true. ${makeExample( - "Two beats of silence, two beats of playing", - ` + "Two beats of silence, two beats of playing", + ` flip(4) :: beat(1) :: snd('kick').out() `, - true, -)} + true, + )} ${makeExample( - "Clapping on the edge", - ` + "Clapping on the edge", + ` flip(2.5, 10) :: beat(.25) :: snd('cp').out() flip(2.5, 75) :: beat(.25) :: snd('click') .speed(2).end(0.2).out() flip(2.5) :: beat(.5) :: snd('bd').out() beat(.25) :: sound('hat').end(0.1).cutoff(1200).pan(usine(1/4)).out() `, - false, -)} + false, + )} ${makeExample( - "Good old true and false", - ` + "Good old true and false", + ` if (flip(4, 75)) { beat(1) :: snd('kick').out() } else { beat(.5) :: snd('snare').out() } `, - true, -)} + true, + )} flip is extremely powerful and is used internally for a lot of other Topos functions. You can also use it to think about **longer durations** spanning over multiple bars. Here is a silly composition that is using flip to generate a 4 bars long pattern. ${makeExample( - "Clunky algorithmic rap music", - ` + "Clunky algorithmic rap music", + ` // Rap God VS Lil Wild -- Adel Faure if (flip(8)) { // Playing this part for two bars @@ -93,24 +93,24 @@ if (flip(8)) { beat(.5)::snd('diphone').end(0.5).n([1,2,3,4].pick()).out() } `, - true, -)} + true, + )} You can use it everywhere to spice things up, including as a method parameter picker: ${makeExample( - "flip is great for parameter variation", - ` + "flip is great for parameter variation", + ` beat(.5)::snd(flip(2) ? 'kick' : 'hat').out() `, - true, -)} + true, + )} - flipbar(n: number = 1): this method works just like flip but counts in bars instead of beats. It allows you to think about even larger time cycles. You can also pair it with regular flip for writing complex and long-spanning algorithmic beats. ${makeExample( - "Thinking music over bars", - ` + "Thinking music over bars", + ` let roomy = (n) => n.room(1).size(1).cutoff(500 + usaw(1/8) * 5000); function a() { beat(1) && roomy(sound('kick')).out() @@ -122,24 +122,24 @@ function b() { flipbar(2) && a() flipbar(3) && b() `, - true, -)} + true, + )} ${makeExample( - "Alternating over four bars", - ` + "Alternating over four bars", + ` flipbar(2) ? beat(.5) && snd(['kick', 'hh'].beat(1)).out() : beat(.5) && snd(['east', 'east:2'].beat(1)).out() `, - false, -)}; + false, + )}; - onbar(bars: number | number[], n: number): The second argument, n, is used to divide the time in a period of n consecutive bars. The first argument should be a bar number or a list of bar numbers to play on. For example, onbar([1, 4], 5) will return true on bar 1 and 4 but return false the rest of the time. You can easily divide time that way. ${makeExample( - "Using onbar for filler drums", - ` + "Using onbar for filler drums", + ` tempo(150); // Only play on the third and fourth bar of the cycle. onbar([3,4], 4)::beat(.25)::snd('hh').out(); @@ -155,8 +155,8 @@ if (onbar([1,2], 4)) { rhythm(.5, 1, 7) :: snd('jvbass').n(2).out(); rhythm(.5, 2, 7) :: snd('snare').n(3).out(); }`, - true, -)} + true, + )} `; }; diff --git a/src/documentation/learning/time/time.ts b/src/documentation/learning/time/time.ts index 43454da..9f0571f 100644 --- a/src/documentation/learning/time/time.ts +++ b/src/documentation/learning/time/time.ts @@ -1,4 +1,4 @@ -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; import { type Editor } from "../../../main"; import times from "./times.svg"; diff --git a/src/documentation/more/bonus.ts b/src/documentation/more/bonus.ts index f78a709..fa4f8fe 100644 --- a/src/documentation/more/bonus.ts +++ b/src/documentation/more/bonus.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { key_shortcut, makeExampleFactory } from "../../Documentation"; +import { key_shortcut, makeExampleFactory } from "../Documentation"; export const bonus = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -14,16 +14,16 @@ Some features have been included as a bonus. These features are often about patt The editor theme can be changed using the theme and randomTheme functions. The following example will use a random color scheme for every beat: ${makeExample( - "Random theme on each beat", - ` + "Random theme on each beat", + ` beat(1)::randomTheme() `, true)} You can also pick a theme using the theme function with a string as only argument: ${makeExample( - "Picking a theme", - ` + "Picking a theme", + ` beat(1)::theme("Batman") `, true)} @@ -36,27 +36,27 @@ beat(1)::theme("Batman") [Hydra](https://hydra.ojack.xyz/?sketch_id=mahalia_1) is a popular live-codable video synthesizer developed by [Olivia Jack](https://ojack.xyz/) and other contributors. It follows an analog synthesizer patching metaphor to encourage live coding complex shaders. Being very easy to use, extremely powerful and also very rewarding to use, Hydra has become a popular choice for adding visuals into a live code performance. ${makeExample( - "Hydra integration", - `beat(4) :: hydra.osc(3, 0.5, 2).out()`, - true, -)} + "Hydra integration", + `beat(4) :: hydra.osc(3, 0.5, 2).out()`, + true, + )} Close the documentation to see the effect: ${key_shortcut( - "Ctrl+D", - )}! **Boom, all shiny!** + "Ctrl+D", + )}! **Boom, all shiny!** Be careful not to call hydra too often as it can impact performances. You can use any rhythmical function like beat() function to limit the number of function calls. You can write any Topos code like [1,2,3].beat() to bring some life and movement in your Hydra sketches. Stopping **Hydra** is simple: ${makeExample( - "Stopping Hydra", - ` + "Stopping Hydra", + ` beat(4) :: stop_hydra() // this one beat(4) :: hydra.hush() // or this one `, - true, -)} + true, + )} ### Changing the resolution @@ -64,10 +64,10 @@ beat(4) :: hydra.hush() // or this one You can change Hydra resolution using this simple method: ${makeExample( - "Changing Hydra resolution", - `hydra.setResolution(1024, 768)`, - true, -)} + "Changing Hydra resolution", + `hydra.setResolution(1024, 768)`, + true, + )} ### Documentation @@ -87,8 +87,8 @@ ${makeExample("Hydra namespace", `hydra.voronoi(20).out()`, true)} Topos embeds a small .gif picture player with a small API. GIFs are automatically fading out after the given duration. Look at the following example: ${makeExample( - "Playing many gifs", - ` + "Playing many gifs", + ` beat(0.25)::gif({ url:v('gif')[$(1)%6], // Any URL will do! opacity: r(0.5, 1), // Opacity (0-1) @@ -100,7 +100,7 @@ beat(0.25)::gif({ posX: ir(1,1200), // CSS Horizontal Position posY: ir(1, 800), // CSS Vertical Position `, - true, -)} + true, + )} `; }; diff --git a/src/documentation/more/index.ts b/src/documentation/more/index.ts new file mode 100644 index 0000000..13d0637 --- /dev/null +++ b/src/documentation/more/index.ts @@ -0,0 +1,5 @@ +export { about } from './about'; +export { bonus } from './bonus'; +export { oscilloscope } from './oscilloscope'; +export { synchronisation } from './synchronisation'; +export { visualization } from './visualization.ts'; diff --git a/src/documentation/more/oscilloscope.ts b/src/documentation/more/oscilloscope.ts index 7e43a23..33cccad 100644 --- a/src/documentation/more/oscilloscope.ts +++ b/src/documentation/more/oscilloscope.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const oscilloscope = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -10,18 +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" @@ -35,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(), @@ -56,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 :) diff --git a/src/documentation/more/synchronisation.ts b/src/documentation/more/synchronisation.ts index b2a7db8..569e589 100644 --- a/src/documentation/more/synchronisation.ts +++ b/src/documentation/more/synchronisation.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const synchronisation = (app: Editor): string => { // @ts-ignore diff --git a/src/documentation/more/visualization.ts b/src/documentation/more/visualization.ts index 3b3cd3e..ecd1148 100644 --- a/src/documentation/more/visualization.ts +++ b/src/documentation/more/visualization.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { key_shortcut, makeExampleFactory } from "../../Documentation"; +import { key_shortcut, makeExampleFactory } from "../Documentation"; export const visualization = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -18,10 +18,10 @@ While Topos is mainly being developed as a live coding environment for algorithm [Hydra](https://hydra.ojack.xyz/?sketch_id=mahalia_1) is a popular live-codable video synthesizer developed by [Olivia Jack](https://ojack.xyz/) and other contributors. It follows an analog synthesizer patching metaphor to encourage live coding complex shaders. Being very easy to use, extremely powerful and also very rewarding to use, Hydra has become a popular choice for adding visuals into a live code performance. ${makeExample( - "Hydra integration", - `beat(4) :: hydra.osc(3, 0.5, 2).out()`, - false, -)} + "Hydra integration", + `beat(4) :: hydra.osc(3, 0.5, 2).out()`, + false, + )} Close the documentation to see the effect: ${key_shortcut( "Ctrl+D", @@ -32,23 +32,23 @@ Be careful not to call hydra too often as it can impact performances. Y Stopping **Hydra** is simple: ${makeExample( - "Stopping Hydra", - ` + "Stopping Hydra", + ` beat(4) :: stop_hydra() // this one beat(4) :: hydra.hush() // or this one `, - false, -)} + false, + )} ### Changing the resolution You can change Hydra resolution using this simple method: ${makeExample( - "Changing Hydra resolution", - `hydra.setResolution(1024, 768)`, - false, -)} + "Changing Hydra resolution", + `hydra.setResolution(1024, 768)`, + false, + )} ### Hydra documentation @@ -68,8 +68,8 @@ ${makeExample("Hydra namespace", `hydra.voronoi(20).out()`, true)} Topos embeds a small .gif picture player with a small API. GIFs are automatically fading out after the given duration. Look at the following example: ${makeExample( - "Playing many gifs", - ` + "Playing many gifs", + ` beat(0.25)::gif({ url:v('gif')[$(1)%6], // Any URL will do! opacity: r(0.5, 1), // Opacity (0-1) @@ -81,8 +81,8 @@ beat(0.25)::gif({ posX: ir(1,1200), // CSS Horizontal Position posY: ir(1, 800), // CSS Vertical Position `, - false, -)} + false, + )} ## Canvas live coding @@ -95,8 +95,8 @@ In addition to the standard Canvas API, Topos also includes some pre-defined sha * draw(f: Function) - Draws to a canvas with the given function. ${makeExample( - "Drawing to canvas", - ` + "Drawing to canvas", + ` beat(0.5) && clear() && draw(context => { context.fillStyle = 'red'; @@ -117,30 +117,30 @@ beat(0.5) && clear() && draw(context => { context.fill(); }) `, - false, -)} + false, + )} ${makeExample( -"Using draw with events and shapes", -` + "Using draw with events and shapes", + ` beat(0.25) && sound("bass1:5").pitch(rI(1,6)).draw(x => { donut(x.pitch) }).out() `, -false, -)} + false, + )} ${makeExample( -"Using draw with ziffers and shapes", -` + "Using draw with ziffers and shapes", + ` z1("1/8 (0 2 1 4)+(2 1)").sound("sine").ad(0.05,.25).clear() .draw(x => { pie({slices:7,eaten:(7-x.pitch-1),fillStyle:"green", rotate: 250}) }).log("pitch").out() `, -false, -)} + false, + )} * - Draws an image to a canvas. @@ -150,7 +150,7 @@ ${makeExample( beat(0.5) && clear() && image("http://localhost:8000/topos_frog.svg",200,200+epulse()%15) `, false, - )} + )} * clear() - Clears the canvas. * background(fill: string) - Sets the background color, image or gradient. @@ -166,22 +166,22 @@ Text can be drawn to canvas using the drawText() function. The function * drawText(text, fontSize, rotation, font, x, y) - Draws text to a canvas. ${makeExample( -"Writing to canvas", -` + "Writing to canvas", + ` beat(0.5) && clear() && drawText("Hello world!", 100, 0, "Arial", 100, 100) `, -false, -)} + false, + )} * randomChar(number, min, max) - Returns a number of random characters from given unicode range. ${makeExample( -"Drawing random characters to canvas", -` + "Drawing random characters to canvas", + ` beat(0.5) && clear() && drawText(randomChar(10,1000,2000),30) `, -false, -)} + false, + )} * emoji(size) - Returns a random emojis as text. @@ -195,7 +195,7 @@ ${makeExample( beat(0.5) && clear() && drawText({x: 10, y: epulse()%700, text: food(50)}) `, false, - )} + )} * expression(size) - Returns a random expression emojis as text. diff --git a/src/documentation/patterns/chaining.ts b/src/documentation/patterns/chaining.ts index 963d845..3724750 100644 --- a/src/documentation/patterns/chaining.ts +++ b/src/documentation/patterns/chaining.ts @@ -1,4 +1,4 @@ -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; import { type Editor } from "../../main"; export const chaining = (application: Editor): string => { @@ -9,12 +9,12 @@ export const chaining = (application: Editor): string => { You might have noticed that **Topos** is using chains a lot. Chains are a very common pattern when programming, especially when you deal with objets that can be composed from many changing properties. Method chaining is used by many objects but mostly by sound() and midi(). It looks like this: ${makeExample( - "Method chaining", - ` + "Method chaining", + ` beat(1)::sound('bd').speed(2).lpf(500).out() `, - true, -)} + true, + )} Method chains become fun if you add just a little bit of complexity to them. You can start to add conditions, start to register complex chains to be re-used later on, etc.. We will not remind you how to write basic chains. The whole documentation is full of examples! Let's explore more delicate patterns! @@ -23,22 +23,22 @@ Method chains become fun if you add just a little bit of complexity to them. You You can use the register(...args) function to... register a chain that you would like to re-use later on. ${makeExample( - "Re-creating a classic Tidal function", - ` + "Re-creating a classic Tidal function", + ` // Playing with extreme panning and playback rate register('juxrev', n=>n.pan([0, 1]).speed([1, -1])) // Using our new abstraction beat(1)::sound('fhh').juxrev().out() `, - true, -)} + true, + )} This is an extremely powerful construct. For example, you can use it to create synthesizer presets and reuse them later on. You can also define parameters for your registered functions. For example: ${makeExample( - "Creating synth presets", - ` + "Creating synth presets", + ` // Registering a specific synth architecture register('sub', (n,x=4,y=80)=>n.ad(0, .25) .fmi(x).pan([0, 1]) @@ -51,16 +51,16 @@ register('sub', (n,x=4,y=80)=>n.ad(0, .25) rhythm(.25, [6, 8].beat(), 12)::sound('sine') .note([0, 2, 4, 5].scale('minor', 50).beat(0.5)) .sub(8).out()`, - true, -)} + true, + )} ## Registering chain for all events The chain can also be registered automatically for all events. This is useful if you want to add a specific effect to all your events. ${makeExample( -"Registering chain to all events at once", -` + "Registering chain to all events at once", + ` z0("h 9 ^ <7 5 3 1>") .sound("sine") .out() @@ -71,28 +71,28 @@ z1("0 4 3 2") all(x=>x.room(1).delay(rI(0,0.5))) `, -true, -)} + true, + )} ## Logging values from the chain You can use the log() function to print values from the current event. This can be useful to debug your code. Useful parameters to log could be **note**, **pitch**, **dur**, **octave** etc... ${makeExample( - "Logging values from the chain", - ` + "Logging values from the chain", + ` beat(1) :: sound("sine").pitch(rI(1,6)).log("note").out() `, - true, -)} + true, + )} ${makeExample( - "Logging values from ziffers pattern", - ` + "Logging values from ziffers pattern", + ` z1("0 3 2 5").scale("rocritonic").sound("sine").log("pitch","note","key").out() `, - true, -)} + true, + )} ## Conditional chaining @@ -101,17 +101,17 @@ There are cases when you don't always want to apply one or many elements that ar All functions from the sound object can be used to modify the event, for example: ${makeExample( - "Modifying sound events with probabilities", - ` + "Modifying sound events with probabilities", + ` beat(.5) && sound('fhh') .odds(1/4, s => s.speed(irand(1,4))) .rarely(s => s.room(0.5).size(8).speed(0.5)) .out()`, - true, -)} + true, + )} ${makeExample( - "Chance to play a random note", - ` + "Chance to play a random note", + ` rhythm(.5, 3, 8) && sound('pluck').note(38).out() beat(.5) && sound('pluck').note(60) .often(s => s.note(57)) @@ -119,8 +119,8 @@ beat(.5) && sound('pluck').note(60) .note(62) .room(0.5).size(3) .out()`, - false, -)} + false, + )} There is a growing collection of probability and chance methods you can use: @@ -145,14 +145,14 @@ There is a growing collection of probability and chance methods you can use: The conditional chaining also applies to MIDI. Values can also be incremented using += notation. ${makeExample( - "Modifying midi events with probabilities", - `beat(.5) && midi(60).channel(1) + "Modifying midi events with probabilities", + `beat(.5) && midi(60).channel(1) .odds(1/4, n => n.channel(2)) .often(n => n.note+=4) .sometimes(s => s.velocity(irand(50,100))) .out()`, - true, -)}; + true, + )}; ## Ziffers @@ -165,8 +165,8 @@ Ziffers patterns can be chained to sound() and midi() as well. * midi() - for outputting pattern as MIDI (See **MIDI**) ${makeExample( - "Ziffer player using a sound chain and probabilities!", - ` + "Ziffer player using a sound chain and probabilities!", + ` z1('s 0 5 7 0 3 7 0 2 7 0 1 7 0 1 6 5 4 3 2') .octave([0, 1].beat(2) - 1) .scale('pentatonic').sound('pluck') @@ -174,7 +174,7 @@ z1('s 0 5 7 0 3 7 0 2 7 0 1 7 0 1 6 5 4 3 2') .odds(1/2, n => n.speed(0.5)) .room(0.5).size(0.5).out() `, - true, -)}; + true, + )}; `; }; diff --git a/src/documentation/patterns/functions.ts b/src/documentation/patterns/functions.ts index 8f1c133..971fd90 100644 --- a/src/documentation/patterns/functions.ts +++ b/src/documentation/patterns/functions.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const functions = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -15,20 +15,20 @@ You can control scripts programatically. This is the core concept of Topos after - copy_script(from: number, to: number): copies a local script denoted by its number to another local script. **This is a destructive operation!** ${makeExample( - "Calling a script! The most important feature!", - ` + "Calling a script! The most important feature!", + ` beat(1) :: script(1) `, - true, -)} + true, + )} ${makeExample( - "Calling mutliple scripts at the same time.", - ` + "Calling mutliple scripts at the same time.", + ` beat(1) :: script(1, 3, 5) `, - false, -)} + false, + )} ## Math functions @@ -49,10 +49,10 @@ There are some very useful scaling methods taken from **SuperCollider**. You can - curve: number: 0 is linear, < 0 is concave, negatively curved, > 0 is convex, positively curved ${makeExample( - "Scaling an LFO", - `usine(1/2).linlin(0, 1, 0, 100)`, - true, -)} + "Scaling an LFO", + `usine(1/2).linlin(0, 1, 0, 100)`, + true, + )} @@ -61,24 +61,24 @@ ${makeExample( - delay(ms: number, func: Function): void: Delays the execution of a function by a given number of milliseconds. ${makeExample( - "Phased woodblocks", - ` + "Phased woodblocks", + ` // Some very low-budget version of phase music beat(.5) :: delay(usine(.125) * 80, () => sound('east').out()) beat(.5) :: delay(50, () => sound('east').out()) `, - true, -)} + true, + )} - delayr(ms: number, nb: number, func: Function): void: Delays the execution of a function by a given number of milliseconds, repeated a given number of times. ${makeExample( - "Another woodblock texture", - ` + "Another woodblock texture", + ` beat(1) :: delayr(50, 4, () => sound('east').speed([0.5,.25].beat()).out()) flip(2) :: beat(2) :: delayr(150, 4, () => sound('east').speed([0.5,.25].beat() * 4).out()) `, - true, -)}; + true, + )}; `; }; diff --git a/src/documentation/patterns/generators.ts b/src/documentation/patterns/generators.ts index 2447e5e..9ff61c5 100644 --- a/src/documentation/patterns/generators.ts +++ b/src/documentation/patterns/generators.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const generators = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -15,8 +15,8 @@ Once the generator is cached the values will be returned from the named cache ev The resulted values can be played using either pitch() or freq() or as Ziffers patterns. When playing the values using pitch() different scales and chained methods can be used to alter the result, for example mod(value: number) to limit the integer range or scale(name: string) etc. to change the resulting note. ${makeExample( -"Simple looping generator function", -` + "Simple looping generator function", + ` function* simple() { let x = 0; while (x < 12) { @@ -27,12 +27,12 @@ function* simple() { beat(.25) && sound("triangle").pitch(cache("simple",simple())).scale("minor").out() `, -true, -)}; + true, + )}; ${makeExample( -"Infinite frequency generator", -` + "Infinite frequency generator", + ` function* poly(x=0) { while (true) { const s = Math.tan(x/10)+Math.sin(x/20); @@ -43,14 +43,14 @@ ${makeExample( beat(.125) && sound("triangle").freq(cache("mathyshit",poly())).out() `, -true, -)}; + true, + )}; When you want to dance with a dynamical system in controlled musical chaos, Topos is waiting for you: ${makeExample( - "Truly scale free chaos inspired by Lorentz attractor", - ` + "Truly scale free chaos inspired by Lorentz attractor", + ` function* strange(x = 0.1, y = 0, z = 0, rho = 28, beta = 8 / 3, zeta = 10) { while (true) { const dx = 10 * (y - x); @@ -71,8 +71,8 @@ ${makeExample( .adsr(.15,.1,.1,.1) .log("freq").out() `, - true, -)}; + true, + )}; ${makeExample( "Henon and his discrete music", @@ -100,8 +100,8 @@ ${makeExample( )}; ${makeExample( - "1970s fractal dream", - ` + "1970s fractal dream", + ` function* rossler(x = 0.1, y = 0.1, z = 0.1, a = 0.2, b = 0.2, c = 5.7) { while (true) { const dx = - y - z; @@ -122,8 +122,8 @@ ${makeExample( .adsr(0,.1,.1,.1) .log("freq").out() `, - true, -)}; + true, + )}; ## OEIS integer sequences @@ -145,7 +145,7 @@ ${makeExample( .gain(1).out() `, true, - )}; + )}; ## Using generators with Ziffers @@ -153,7 +153,7 @@ Alternatively generators can be used with Ziffers to generate longer patterns. I ${makeExample( "Ziffers patterns using a generator functions", -` + ` function* poly(x) { while (true) { yield 64 * Math.pow(x, 6) - 480 * Math.pow(x, 4) + 720 * Math.pow(x, 2); diff --git a/src/documentation/patterns/index.ts b/src/documentation/patterns/index.ts new file mode 100644 index 0000000..9c2e95d --- /dev/null +++ b/src/documentation/patterns/index.ts @@ -0,0 +1,7 @@ +export { chaining } from './chaining'; +export { functions } from './functions'; +export { generators } from './generators'; +export { lfos } from './lfos'; +export { patterns } from './patterns'; +export { probabilities } from './probabilities'; +export { variables } from './variables'; diff --git a/src/documentation/patterns/lfos.ts b/src/documentation/patterns/lfos.ts index ab29bc7..55d8d1f 100644 --- a/src/documentation/patterns/lfos.ts +++ b/src/documentation/patterns/lfos.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const lfos = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -14,46 +14,46 @@ Low Frequency Oscillators (_LFOs_) are an important piece in any digital audio w - usine(freq: number = 1, phase: number = 0): number: returns a sinusoïdal oscillation between 0 and 1. The u stands for _unipolar_. ${makeExample( - "Modulating the speed of a sample player using a sine LFO", - `beat(.25) && snd('cp').speed(1 + usine(0.25) * 2).out()`, - true, -)}; + "Modulating the speed of a sample player using a sine LFO", + `beat(.25) && snd('cp').speed(1 + usine(0.25) * 2).out()`, + true, + )}; - triangle(freq: number = 1, phase: number = 0): number: returns a triangle oscillation between -1 and 1. - utriangle(freq: number = 1, phase: number = 0): number: returns a triangle oscillation between 0 and 1. The u stands for _unipolar_. ${makeExample( - "Modulating the speed of a sample player using a triangle LFO", - `beat(.25) && snd('cp').speed(1 + utriangle(0.25) * 2).out()`, - true, -)} + "Modulating the speed of a sample player using a triangle LFO", + `beat(.25) && snd('cp').speed(1 + utriangle(0.25) * 2).out()`, + true, + )} - saw(freq: number = 1, phase: number = 0): number: returns a sawtooth-like oscillation between -1 and 1. - usaw(freq: number = 1, phase: number = 0): number: returns a sawtooth-like oscillation between 0 and 1. The u stands for _unipolar_. ${makeExample( - "Modulating the speed of a sample player using a saw LFO", - `beat(.25) && snd('cp').speed(1 + usaw(0.25) * 2).out()`, - true, -)} + "Modulating the speed of a sample player using a saw LFO", + `beat(.25) && snd('cp').speed(1 + usaw(0.25) * 2).out()`, + true, + )} - square(freq: number = 1, duty: number = .5): number: returns a square wave oscillation between -1 and 1. You can also control the duty cycle using the duty parameter. - usquare(freq: number = 1, duty: number = .5): number: returns a square wave oscillation between 0 and 1. The u stands for _unipolar_. You can also control the duty cycle using the duty parameter. ${makeExample( - "Modulating the speed of a sample player using a square LFO", - `beat(.25) && snd('cp').speed(1 + usquare(0.25, 0, 0.25) * 2).out()`, - true, -)}; + "Modulating the speed of a sample player using a square LFO", + `beat(.25) && snd('cp').speed(1 + usquare(0.25, 0, 0.25) * 2).out()`, + true, + )}; - noise(times: number = 1): returns a random value between -1 and 1. - unoise(times: number = 1): returns a random value between 0 and 1. ${makeExample( - "Modulating the speed of a sample player using noise", - `beat(.25) && snd('cp').speed(1 + noise() * 2).out()`, - true, -)}; + "Modulating the speed of a sample player using noise", + `beat(.25) && snd('cp').speed(1 + noise() * 2).out()`, + true, + )}; `; }; diff --git a/src/documentation/patterns/patterns.ts b/src/documentation/patterns/patterns.ts index 35d0521..1b25690 100644 --- a/src/documentation/patterns/patterns.ts +++ b/src/documentation/patterns/patterns.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const patterns = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -10,24 +10,24 @@ export const patterns = (application: Editor): string => { It means that the following: ${makeExample( - "Boring kick", - ` + "Boring kick", + ` beat(1)::sound('kick').out() `, - true, -)} + true, + )} can be turned into something more interesting like this easily: ${makeExample( - "Less boring kick", - ` + "Less boring kick", + ` let c = [1,2].dur(3, 1) beat([1, 0.5, 0.25].dur(0.75, 0.25, 1) / c)::sound(['kick', 'fsoftsnare'].beat(0.75)) .ad(0, .25).shape(usine(1/2)*0.5).speed([1, 2, 4].beat(0.5)).out() `, - true, -)} + true, + )} **Topos** comes with a lot of array methods to deal with musical patterns of increasing complexity. Some knowledge of patterns and how to use them will help you to break out of simple loops and repeating structures. The most basic JavaScript data structure is the [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array). Topos is extending it with custom methods to describe patterns that evolve over time. These methods can often be chained to compose more complex expressions: [1, 2, 3].repeatOdd(5).palindrome().beat(). @@ -37,18 +37,18 @@ beat([1, 0.5, 0.25].dur(0.75, 0.25, 1) / c)::sound(['kick', 'fsoftsnare'].beat(0 - beat(division: number): this method will return the next value in the list every _n_ pulses. By default, 1 equals to one beat but integer and floating point number values are supported as well. This method is extremely powerful and can be used for many different purposes. Check out the examples. ${makeExample( - "Light drumming", - ` + "Light drumming", + ` // Every bar, use a different rhythm beat([1, 0.75].beat(4)) :: sound('cp').out() beat([0.5, 1].beat(4)) :: sound('kick').out() beat(2)::snd('snare').shape(.5).out() `, - true, -)} + true, + )} ${makeExample( - "Using beat to create arpeggios", - ` + "Using beat to create arpeggios", + ` // Arpeggio using pulse divisions beat([.5, .25].beat(0.5)) :: sound('sine') .lpf(100+usine(1/4)*400).lpad(2, 0, .25) @@ -62,25 +62,25 @@ beat([.5, .25].beat(0.5)) :: sound('sine') .delayfb(0.5) .out() `, - false, -)} + false, + )} ${makeExample( - "Cool ambiance", - ` + "Cool ambiance", + ` beat(.5) :: snd(['kick', 'hat'].beat(0.5)).out() beat([2,4].beat(2)) :: snd('shaker').delay(.5).delayfb(.75).delayt(0.125).out() flip(2)::beat(1)::snd('froomy').out() flip(4)::beat(2)::snd('pad').n(2).shape(.5) .orbit(2).room(0.9).size(0.9).release(0.5).out() `, - false, -)} + false, + )} - bar(value: number = 1): returns the next value every bar (if value = 1). Using a larger value will return the next value every n bars. ${makeExample( - "A simple drumbeat in no time!", - ` + "A simple drumbeat in no time!", + ` beat(1)::sound(['kick', 'hat', 'snare', 'hat'].beat()).out() beat([1/4, 1/2].dur(1.5, 0.5))::sound(['jvbass', 'fikea'].bar()) .ad(0, .25).room(0.5).size(2).resonance(0.15).lpf( @@ -88,12 +88,12 @@ beat([1/4, 1/2].dur(1.5, 0.5))::sound(['jvbass', 'fikea'].bar()) * [1, 2].bar()) .out() `, - true, -)} + true, + )} ${makeExample( - "Using beat and bar in the same example", - ` + "Using beat and bar in the same example", + ` beat(2)::snd('snare').out() beat([1, 0.5].beat()) :: sound(['bass3'].bar()) .freq(100).n([12, 14].bar()) @@ -102,13 +102,13 @@ beat([1, 0.5].beat()) :: sound(['bass3'].bar()) .speed([1,2,3].beat()) .out() `, -)} + )} - dur(...list: numbers[]) : keeps the same value for a duration of n beats corresponding to the nth number of the list you provide. ${makeExample( - "Holding a value for n beats", - ` + "Holding a value for n beats", + ` // The second note is kept for twice as long beat(0.5)::sound('notes').n([1,2].dur(1, 2)) .room(0.5).size(8).delay(0.125).delayt(1/8) @@ -117,12 +117,12 @@ beat(0.5)::sound('notes').n([1,2].dur(1, 2)) beat(1)::sound(['kick', 'fsnare'].dur(3, 1)) .n([0,3].dur(3, 1)).out() `, - true, -)} + true, + )} ${makeExample( - "Patterning with ternary statements", - ` + "Patterning with ternary statements", + ` const dada = flipbar(2) ? [0,[3,5,-1].bar(3),2,3] : [9,8,9,6] beat(0.5) :: sound('wt_hvoice:3') .pitch(dada.beat(0.5)) @@ -136,8 +136,8 @@ beat(1) :: sound('kick').n(4).out() onbeat([0.5,0.8].beat(1),2) :: sound('snare').out() onbeat(0.5,0.8,1,1.5,2,2.5,3,4) :: sound('hh').out() `, - true, -)} + true, + )} ## Iteration using a counter @@ -145,68 +145,68 @@ onbeat(0.5,0.8,1,1.5,2,2.5,3,4) :: sound('hh').out() - $(name,limit?,step?): shorter alias for the counter. ${makeExample( - "Using counter to iterate over a list", - ` + "Using counter to iterate over a list", + ` beat(0.5) :: sound("bd").gain(line(0,1,0.01).$("ramp")).out() `, - true, -)} + true, + )} ## Manipulating notes and scales - pitch(): convert a list of integers to pitch classes ${makeExample( - "Converting a list of integers to pitch classes using key and scale", - ` + "Converting a list of integers to pitch classes using key and scale", + ` beat(0.25) :: snd('sine') .pitch([0,1,2,3,4,6,7,8].beat(0.125)) .key(["F4","F3"].beat(2.0)) .scale("minor").ad(0, .25).out() `, - true, -)} + true, + )} - semitones(number[], ...args?): Create scale from semitone intervals. ${makeExample( - "Play pitches from scale created from semitone intervals", - ` + "Play pitches from scale created from semitone intervals", + ` beat(1) :: sound('gtr').pitch([0, 4, 3, 2].beat()).key(64) .semitones(1, 1, 3, 1, 1, 2, 3).out() `, - true, -)} + true, + )} - cents(number[], ...args?): Create scale from cent intervals. ${makeExample( - "Play pitches from scale created from cent intervals", - ` + "Play pitches from scale created from cent intervals", + ` rhythm([0.5,0.25].beat(1),14,16) :: sound('pluck') .stretch(iR(1,5)).pitch(iR(0,6)).key(57) .cents(120,270,540,670,785,950,1215).out() `, - true, -)} + true, + )} - ratios(number[], ...args?): Create scale from ratios. ${makeExample( - "Play pitches from scale created from ratios", - ` + "Play pitches from scale created from ratios", + ` rhythm([0.5,0.25].beat(0.25),5,7) :: sound('east:3') .pitch([0,1,2,3,4,5,6,7,8,9,10,11].beat(0.25)).key(67) .ratios(2/11,4/11,6/11,8/11,10/11,11/11).out() `, - true, -)} + true, + )} - edo(number, scale?: string|number[]): Create scale from equal divisions of the octave. Creates chromatic scale by default. ${makeExample( - "Play pitches from scale created from equal divisions of the octave", - ` + "Play pitches from scale created from equal divisions of the octave", + ` z0("e bd bd ").sound().out() flipbar(1) :: rhythm(.25,14,16) :: sound("ST10:30").stretch(3).gain(0.5) .pitch([0,10,r(20,40),r(100,200),r(-200,200),r(200,300),200,r(3,666)].beat([1.0,0.5,0.25].bar(6))) @@ -218,57 +218,57 @@ rhythm(2.0,26,32) :: sound("ST20").n([22,5,24,34,31,5,11,19].pick()).stretch(rI( .edo(666) .out() `, - true, -)} + true, + )} - scale(scale: string, base note: number): Map each element of the list to the closest note of the slected scale. [0, 2, 3, 5 ].scale("major", 50) returns [50, 52, 54, 55]. You can use western scale names like (Major, Minor, Minor pentatonic ...) or [zeitler](https://ianring.com/musictheory/scales/traditions/zeitler) scale names. Alternatively you can also use the integers as used by Ian Ring in his [study of scales](https://ianring.com/musictheory/scales/). ${makeExample( - "Mapping the note array to the E3 major scale", - ` + "Mapping the note array to the E3 major scale", + ` beat(1) :: snd('gtr') .note([0, 5, 2, 1, 7].scale("Major", 52).beat()) .out() `, - true, -)} + true, + )} - scaleArp(scale: string, mask: number): extrapolate a custom-masked scale from each list elements. [0].scale("major", 3) returns [0,2,4]. scaleArp supports the same scales as scale. ${makeExample( - "Extrapolate a 3-elements Mixolydian scale from 2 notes", - ` + "Extrapolate a 3-elements Mixolydian scale from 2 notes", + ` beat(1) :: snd('gtr') .note([0, 5].scaleArp("mixolydian", 3).beat() + 50) .out() `, - true, -)} + true, + )} ## Iteration using the mouse - mouseX() / mouseY(): divides the screen in n zones and returns the value corresponding to the mouse position on screen. ${makeExample( - "Controlling an arpeggio (octave and note) with mouse", - ` + "Controlling an arpeggio (octave and note) with mouse", + ` beat(0.25)::sound('wt_piano') .note([0,2,3,4,5,7,8,9,11,12].scale( 'minor', 30 + [0,12,24].mouseY()).mouseX()) .room(0.5).size(4).lpad(-2, .2).lpf(500, 0.3) .ad(0, .2).out() `, - true, -)} + true, + )} ## Simple data operations - palindrome(): Concatenates a list with the same list in reverse. ${makeExample( - "Palindrome filter sweep", - ` + "Palindrome filter sweep", + ` beat([1,.5,.25].beat()) :: snd('wt_stereo') .speed([1, 0.5, 0.25]) .pan(r(0, 1)).freq([100,200,300].beat(0.25)) @@ -277,15 +277,15 @@ beat([1,.5,.25].beat()) :: snd('wt_stereo') .lpf([500,1000,2000,4000].palindrome().beat()) .lpad(4, 0, .25).sustain(0.125).out() `, - true, -)} + true, + )} - random(index: number): pick a random element in the given list. - rand(index: number): shorter alias for the same method. ${makeExample( - "Sipping some gasoline at the robot bar", - ` + "Sipping some gasoline at the robot bar", + ` // rand, random and pick are doing the same thing! beat(1)::snd('fhardkick').shape(0.5) .ad(0, .1).lpf(500).db(-12).out() @@ -296,69 +296,69 @@ beat([.5, 1].rand() / 2) :: snd( .lpf([5000,3000,2000].pick()) .end(0.5).out() `, - true, -)} + true, + )} - pick(): pick a random element in the list. ${makeExample( - "Picking values in lists", - ` + "Picking values in lists", + ` beat(0.25)::sound(['ftabla', 'fwood'].pick()) .speed([1,2,3,4].pick()).ad(0, .125).n(ir(1,10)) .room(0.5).size(1).out() `, - true, -)} + true, + )} - degrade(amount: number): removes _n_% of the list elements. Lists can be degraded as long as one element remains. The amount of degradation is given as a percentage. ${makeExample( - "Amen break suffering from data loss", - ` + "Amen break suffering from data loss", + ` // Tweak the value to degrade this amen break even more! beat(.25)::snd('amencutup').n([1,2,3,4,5,6,7,8,9].degrade(20).loop($(1))).out() `, - true, -)} + true, + )} - repeat(amount: number): repeat every list elements _n_ times. - repeatEven(amount: number): repeat every pair element of the list _n_ times. - repeatOdd(amount: number): repeat every odd element of the list _n_ times. ${makeExample( - "Repeating samples a given number of times", - ` + "Repeating samples a given number of times", + ` beat(.25)::sound('amencutup').n([1,2,3,4,5,6,7,8].repeat(4).beat(.25)).out() `, - true, -)} + true, + )} - loop(index: number): loop takes one argument, the _index_. It allows you to iterate over a list using an iterator such as a counter. This is super useful to control how you are accessing values in a list without relying on a temporal method such as .beat() or .bar(). ${makeExample( - "Don't you know how to count up to 5?", - ` + "Don't you know how to count up to 5?", + ` beat(1) :: sound('numbers').n([1,2,3,4,5].loop($(3, 10, 2))).out() `, - true, -)} + true, + )} - shuffle(): this: shuffles a list! Simple enough! ${makeExample( - "Shuffling a list for extra randomness", - ` + "Shuffling a list for extra randomness", + ` beat(1) :: sound('numbers').n([1,2,3,4,5].shuffle().loop($(1)).out() `, - true, -)} + true, + )} - rotate(steps: number): rotate a list to the right _n_ times. The last value become the first, rinse and repeat. ${makeExample( - "To make things more complex... here you go", - ` + "To make things more complex... here you go", + ` beat(.25) :: snd('sine').fmi([1.99, 2]) .ad(0, .125).lpf(500+r(1,400)) .lpad(usine()*8, 0, .125) @@ -369,21 +369,21 @@ beat(.25) :: snd('sine').fmi([1.99, 2]) .beat(.25)) // while the index changes .out() `, - true, -)} + true, + )} ## Filtering - unique(): filter a list to remove repeated values. ${makeExample( - "Demonstrative filtering. Final list is [100, 200]", - ` + "Demonstrative filtering. Final list is [100, 200]", + ` // Remove unique and 100 will repeat four times! beat(1)::snd('sine').sustain(0.1).freq([100,100,100,100,200].unique().beat()).out() `, - true, -)} + true, + )} ## Simple math operations diff --git a/src/documentation/patterns/probabilities.ts b/src/documentation/patterns/probabilities.ts index 8cb5030..b836122 100644 --- a/src/documentation/patterns/probabilities.ts +++ b/src/documentation/patterns/probabilities.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const probabilities = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -13,12 +13,12 @@ There are some simple functions to play with probabilities. - irand(min: number, max:number): returns a random integer between min and max. Shorthands ir() or rI(). ${makeExample( - "Bleep bloop, what were you expecting?", - ` + "Bleep bloop, what were you expecting?", + ` rhythm(0.125, 10, 16) :: sound('sid').n(4).note(50 + irand(50, 62) % 8).out() `, - true, -)} + true, + )} - prob(p: number): return true _p_% of time, false in other cases. @@ -26,14 +26,14 @@ rhythm(0.125, 10, 16) :: sound('sid').n(4).note(50 + irand(50, 62) % 8).out() ${makeExample( - "The Teletype experience!", - ` + "The Teletype experience!", + ` prob(50) :: script(1); prob(60) :: script(2); prob(80) :: script(toss() ? script(3) : script(4)) `, - true, -)} + true, + )} - seed(val: number|string): sets the seed of the random number generator. You can use a number or a string. The same seed will always return the same sequence of random numbers. @@ -59,28 +59,28 @@ By default chance operators will be evaluated 48 times within a beat. You can ch Examples: ${makeExample( - "Using chance operators", - ` + "Using chance operators", + ` rarely() :: sound('hh').out(); // Rarely 48 times is still a lot rarely(4) :: sound('bd').out(); // Rarely in 4 beats is bit less rarely(8) :: sound('east').out(); // Rarely in 8 beats is even less `, - true, -)} + true, + )} ${makeExample( - "Using chance with other operators", - ` + "Using chance with other operators", + ` frequently() :: beat(1) :: sound('kick').out(); often() :: beat(0.5) :: sound('hh').out(); sometimes() :: onbeat(1,3) :: sound('snare').out(); `, - false, -)} + false, + )} ${makeExample( - "Using chance with chaining", - ` + "Using chance with chaining", + ` beat(0.5) && sound("bd") .freq(100) .sometimes(s=>s.crush(2.5)) @@ -92,7 +92,7 @@ ${makeExample( .almostNever(n=>n.freq(400)) .out() `, - false, -)} + false, + )} `; }; diff --git a/src/documentation/patterns/variables.ts b/src/documentation/patterns/variables.ts index 5c79b95..74cf843 100644 --- a/src/documentation/patterns/variables.ts +++ b/src/documentation/patterns/variables.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../main"; -import { makeExampleFactory } from "../../Documentation"; +import { makeExampleFactory } from "../Documentation"; export const variables = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -12,22 +12,22 @@ By default, each script is independant from each other. The variables defined in There is a global object that you can use to store and retrieve information. It is a simple key/value store. You can store any type of data in it: ${makeExample( - "Setting a global variable", - ` + "Setting a global variable", + ` // This is script n°3 global.my_variable = 2 `, - true, -)} + true, + )} ${makeExample( - "Getting that variable back and printing!", - ` + "Getting that variable back and printing!", + ` // This is script n°4 log(global.my_variable) `, - true, -)} + true, + )} Now your scripts can share information with each other! @@ -47,30 +47,30 @@ You will often need to use iterators and/or counters to index over data structur **Note:** Counters also come with a secret syntax. They can be called with the **$** symbol! ${makeExample( - "Iterating over a list of samples using a counter", - ` + "Iterating over a list of samples using a counter", + ` rhythm(.25, 6, 8) :: sound('dr').n($(1)).end(.25).out() `, - true, -)} + true, + )} ${makeExample( - "Using a more complex counter", - ` + "Using a more complex counter", + ` // Limit is 20, step is 5 rhythm(.25, 6, 8) :: sound('dr').n($(1, 20, 5)).end(.25).out() `, - false, -)} + false, + )} ${makeExample( - "Calling the drunk mechanism", - ` + "Calling the drunk mechanism", + ` // Limit is 20, step is 5 rhythm(.25, 6, 8) :: sound('dr').n(drunk()).end(.25).out() `, - false, -)} + false, + )} diff --git a/src/documentation/patterns/ziffers/index.ts b/src/documentation/patterns/ziffers/index.ts new file mode 100644 index 0000000..3bbcb74 --- /dev/null +++ b/src/documentation/patterns/ziffers/index.ts @@ -0,0 +1,6 @@ +export { ziffers_basics } from './ziffers_basics'; +export { ziffers_scales } from './ziffers_scales'; +export { ziffers_rhythm } from './ziffers_rhythm'; +export { ziffers_algorithmic } from './ziffers_algorithmic'; +export { ziffers_tonnetz } from './ziffers_tonnetz'; +export { ziffers_syncing } from './ziffers_syncing'; diff --git a/src/documentation/patterns/ziffers/ziffers_algorithmic.ts b/src/documentation/patterns/ziffers/ziffers_algorithmic.ts index c427cc0..2d7d3ee 100644 --- a/src/documentation/patterns/ziffers/ziffers_algorithmic.ts +++ b/src/documentation/patterns/ziffers/ziffers_algorithmic.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const ziffers_algorithmic = (application: Editor): string => { const makeExample = makeExampleFactory(application); diff --git a/src/documentation/patterns/ziffers/ziffers_basics.ts b/src/documentation/patterns/ziffers/ziffers_basics.ts index b56bdb2..34b37e5 100644 --- a/src/documentation/patterns/ziffers/ziffers_basics.ts +++ b/src/documentation/patterns/ziffers/ziffers_basics.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const ziffers_basics = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -13,8 +13,8 @@ Ziffers is a **musical number based notation** tuned for _live coding_. It is a - embracing a different mindset and approach to time and **patterning**. ${makeExample( - "Super Fancy Ziffers example", - ` + "Super Fancy Ziffers example", + ` z1('1/8 024!3 035 024 0124').sound('wt_stereo') .adsr(0, .4, 0.5, .4).gain(0.1) .lpadsr(4, 0, .2, 0, 0) @@ -29,8 +29,8 @@ let osci = 1500 + usine(1/2) * 2000; z3('can can:2').sound().gain(1).cutoff(osci).out() z4('1/4 kick kick snare kick').sound().gain(1).cutoff(osci).out() `, - true, -)} + true, + )} ## Evaluation @@ -58,57 +58,57 @@ The basic Ziffer notation is entirely written in JavaScript strings (_e.g_ " **Note:** Some features are experimental and some are still unsupported. For full / prior syntax see article about Ziffers. ${makeExample( - "Pitches from 0 to 9", - ` + "Pitches from 0 to 9", + ` z1('0.25 0 1 2 3 4 5 6 7 8 9').sound('wt_stereo') .adsr(0, .1, 0, 0).out()`, - true, -)} + true, + )} ${makeExample( - "Escaped pitches using curly brackets", - `z1('_ _ 0 {9 10 11} 4 {12 13 14}') + "Escaped pitches using curly brackets", + `z1('_ _ 0 {9 10 11} 4 {12 13 14}') .sound('wt_05').pan(r(0,1)) .cutoff(usaw(1/2) * 4000) .room(0.9).size(0.9).out()`, - false, -)} + false, + )} ${makeExample( - "Durations using fractions and floating point numbers", - ` + "Durations using fractions and floating point numbers", + ` z1('1/8 0 2 4 0 2 4 1/4 0 3 5 0.25 _ 0 7 0 7') .sound('square').delay(0.5).delayt(1/8) .adsr(0, .1, 0, 0).delayfb(0.45).out() `, - false, -)} + false, + )} ${makeExample( - "Disco was invented thanks to Ziffers", - ` + "Disco was invented thanks to Ziffers", + ` z1('e _ _ 0 ^ 0 _ 0 ^ 0').sound('jvbass').out() beat(1)::snd('bd').out(); beat(2)::snd('sd').out() beat(3) :: snd('cp').room(0.5).size(0.5).orbit(2).out() `, - false, -)} + false, + )} ${makeExample( - "Accidentals and rests for nice melodies", - ` + "Accidentals and rests for nice melodies", + ` z1('^ 1/8 0 1 b2 3 4 _ 4 b5 4 3 b2 1 0') .scale('major').sound('triangle') .cutoff(500).lpadsr(5, 0, 1/12, 0, 0) .fmi(0.5).fmh(2).delay(0.5).delayt(1/3) .adsr(0, .1, 0, 0).out() `, - false, -)} + false, + )} ${makeExample( - "Repeat items n-times", - ` + "Repeat items n-times", + ` z1('1/8 _ _ 0!4 3!4 4!4 3!4') .scale('major').sound('wt_oboe') .shape(0.2).sustain(0.1).out() @@ -116,38 +116,38 @@ z2('1/8 _ 0!4 5!4 4!2 7!2') .scale('major').sound('wt_oboe') .shape(0.2).sustain(0.1).out() `, - false, -)} + false, + )} ${makeExample( - "Subdivided durations", - ` + "Subdivided durations", + ` z1('w [0 [5 [3 7]]] h [0 4]') .scale('major').sound('sine') .fmi(usine(.5)).fmh(2).out() `, - false, -)} + false, + )} ## Rests ${makeExample( - "Rest and octaves", - ` + "Rest and octaves", + ` z1('q 0 ^ e0 r _ 0 _ r 4 ^4 4') .sound('sine').scale("godian").out() `, - true, -)} + true, + )} ${makeExample( - "Rests with durations", - ` + "Rests with durations", + ` z1('q 0 4 e^r 3 e3 0.5^r h4 1/4^r e 5 r 0.125^r 0') .sound('sine').scale("aeryptian").out() `, - true, -)} + true, + )} ## Chords @@ -161,7 +161,7 @@ ${makeExample( .room(0.5).size(0.9) .scale("minor").out() `, - true + true )} ${makeExample( @@ -171,7 +171,7 @@ ${makeExample( .sound('triangle').adsr(0.2, 0.3, 0, 0) .room(0.5).size(0.9).scale("major").out() `, - true + true )} ${makeExample( @@ -182,7 +182,7 @@ ${makeExample( .lpadsr(4, 0, .4, 0, 0).size(0.9) .scale("major").out() `, - true + true )} ${makeExample( @@ -227,74 +227,74 @@ ${makeExample( Chords can be arpeggiated using the @-character within the ziffers notation or by using arpeggio method. ${makeExample( - "Arpeggio using the mini-notation", - ` + "Arpeggio using the mini-notation", + ` z1("(i v vi%-3 iv%-2)@(s 0 2 0 1 2 1 0 2)") .sound("sine").out() `, -)} + )} ${makeExample( - "Arpeggio from named chords with durations", - ` + "Arpeggio from named chords with durations", + ` z1("_ Gm7 ^ C9 D7 Gm7") .arpeggio("e 0 2 q 3 e 1 2") .sound("sine").out() `, -)} + )} ${makeExample( - "Arpeggio from roman chords with inversions", - ` + "Arpeggio from roman chords with inversions", + ` z1("i v%-1 vi%-1 iv%-2") .arpeggio(0,2,1,2) .noteLength(0.125) .sound("sine").out() `, -)} + )} ## Chaining - Basic notation ${makeExample( - "Simple method chaining", - ` + "Simple method chaining", + ` z1('0 1 2 3').key('G3') .scale('minor').sound('sine').out() `, - true, -)} + true, + )} ${makeExample( - "More complex chaining", - ` + "More complex chaining", + ` z1('0 1 2 3 4').key('G3').scale('minor').sound('sine').often(n => n.pitch+=3).rarely(s => s.delay(0.5)).out() `, - true, -)} + true, + )} ${makeExample( - "Alternative way for inputting options", - ` + "Alternative way for inputting options", + ` z1('0 3 2 4',{key: 'D3', scale: 'minor pentatonic'}).sound('sine').out() `, - true, -)} + true, + )} ## String prototypes You can also use string prototypes as an alternative syntax for creating Ziffers patterns ${makeExample( - "String prototypes", - ` + "String prototypes", + ` "q 0 e 5 2 6 2 q 3".z0().sound('sine').out() "q 2 7 8 6".z1().octave(-1).sound('sine').out() "q 2 7 8 6".z2({key: "C2", scale: "aeolian"}).sound('sine').scale("minor").out() `, - true, -)} + true, + )} `; }; diff --git a/src/documentation/patterns/ziffers/ziffers_rhythm.ts b/src/documentation/patterns/ziffers/ziffers_rhythm.ts index ad0dd69..46885ee 100644 --- a/src/documentation/patterns/ziffers/ziffers_rhythm.ts +++ b/src/documentation/patterns/ziffers/ziffers_rhythm.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const ziffers_rhythm = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -9,30 +9,30 @@ export const ziffers_rhythm = (application: Editor): string => { Ziffers combines rhythmic and melodic notation into a single pattern language. This means that you can use the same pattern to describe both the rhythm and the melody of a musical phrase similarly to the way it is done in traditional music notation. ${makeExample( - "Duration chars", - ` + "Duration chars", + ` z1('q 0 0 4 4 5 5 h4 q 3 3 2 2 1 1 h0').sound('sine').out() `, - true, -)} + true, + )} ${makeExample( - "Fraction durations", - ` + "Fraction durations", + ` z1('1/4 0 0 4 4 5 5 2/4 4 1/4 3 3 2 2 1 1 2/4 0') .sound('sine').out() `, - true, -)} + true, + )} ${makeExample( - "Decimal durations", - ` + "Decimal durations", + ` z1('0.25 5 1 2 6 0.125 3 8 0.5 4 1.0 0') .sound('sine').scale("galian").out() `, - true, -)} + true, + )} ## List of all duration characters @@ -90,68 +90,68 @@ Ziffers maps the following duration characters to the corresponding note lengths Samples can be patterned using the sample names or using @-operator for assigning sample to a pitch. Sample index can be changed using the : operator. ${makeExample( - "Sampled drums", - ` + "Sampled drums", + ` z1('bd [hh hh]').octave(-2).sound('sine').out() `, - true, -)} + true, + )} ${makeExample( - "More complex pattern", - ` + "More complex pattern", + ` z1('bd [hh >]').octave(-2).sound('sine').out() `, - true, -)} + true, + )} ${makeExample( - "Pitched samples", - ` + "Pitched samples", + ` z1('0@sax 3@sax 2@sax 6@sax') .octave(-1).sound() .adsr(0.25,0.125,0.125,0.25).out() `, - true, -)} + true, + )} ${makeExample( - "Pitched samples from list operation", - ` + "Pitched samples from list operation", + ` z1('e (0 3 -1 4)+(-1 0 2 1)@sine') .key('G4') .scale('110 220 320 450') .sound().out() `, - true, -)} + true, + )} ${makeExample( - "Pitched samples with list notation", - ` + "Pitched samples with list notation", + ` z1('e (0 2 6 3 5 -2)@sax (0 2 6 3 5 -2)@arp') .octave(-1).sound() .adsr(0.25,0.125,0.125,0.25).out() `, - true, -)} + true, + )} ${makeExample( - "Sample indices", - ` + "Sample indices", + ` z1('e 1:2 4:3 6:2') .octave(-1).sound("east").out() `, - true, -)} + true, + )} ${makeExample( - "Pitched samples with sample indices", - ` + "Pitched samples with sample indices", + ` z1('_e 1@east:2 4@bd:3 6@arp:2 9@baa').sound().out() `, - true, -)} + true, + )} `; }; diff --git a/src/documentation/patterns/ziffers/ziffers_scales.ts b/src/documentation/patterns/ziffers/ziffers_scales.ts index 2096c22..e765ac9 100644 --- a/src/documentation/patterns/ziffers/ziffers_scales.ts +++ b/src/documentation/patterns/ziffers/ziffers_scales.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const ziffers_scales = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -80,8 +80,8 @@ export const ziffers_scales = (application: Editor): string => { )} ${makeExample( - "Werckmeister scale in Scala format", - ` + "Werckmeister scale in Scala format", + ` const werckmeister = "107.82 203.91 311.72 401.955 503.91 605.865 701.955 809.775 900. 1007.82 1103.91 1200." z0('s (0,3) ^ 0 3 ^ 0 (3,6) 0 _ (3,5) 0 _ 3 ^ 0 (3,5) ^ 0 6 0 _ 3 0') @@ -94,8 +94,8 @@ ${makeExample( onbeat(1,1.5,3) :: sound('bd').cutoff(100 + usine(.25) * 1000).out() `, - true, -)} + true, + )} `; }; diff --git a/src/documentation/patterns/ziffers/ziffers_syncing.ts b/src/documentation/patterns/ziffers/ziffers_syncing.ts index ccd4396..487ce92 100644 --- a/src/documentation/patterns/ziffers/ziffers_syncing.ts +++ b/src/documentation/patterns/ziffers/ziffers_syncing.ts @@ -1,5 +1,5 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const ziffers_syncing = (application: Editor): string => { const makeExample = makeExampleFactory(application); @@ -13,19 +13,19 @@ Ziffers patterns can be synced to any event by using **cue**, **sync**, **wait** The cue(name: string) methods can be used to send cue messages for ziffers patterns. The wait(name: string) method is used to wait for the cue message to be received before starting the next cycle. ${makeExample( -"Sending cue from event and wait", -` + "Sending cue from event and wait", + ` beat(4.0) :: sound("bd").cue("foo").out() z1("e 0 3 2 1 2 1").wait("foo").sound("sine").out() `, -true, -)} + true, + )} The sync(name: string) method is used to sync the ziffers pattern to the cue message. ${makeExample( - "Delayed start using individual cue", - ` + "Delayed start using individual cue", + ` register('christmas', n=>n.room(0.25).size(2).speed([0.5, 0.25, 0.125]) .delay(0.5).delayt(1/3).delayfb(0.5).bpf(200+usine(1/3)*500).out()) onbar(1) :: cue("bar") @@ -33,21 +33,21 @@ The sync(name: string) method is used to sync the ziffers pattern to th z1("<0.25 0.125> 0 4 2 -2").sync("bar").sound("ST40:25").christmas() z2("<0.25 0.125> 0 6 4 -4").sync("baz").sound("ST40:25").christmas() `, - true, - )} + true, + )} The listen(name: string) method can be used to listen for the cue messages and play one event from the pattern for every cue. ${makeExample( - "Delayed start using individual cue", - ` + "Delayed start using individual cue", + ` beat(1.0) :: cue("boom") z1("bd ").listen("boom") .sound().out() `, - true, - )} + true, + )} ## Sync with beat @@ -65,7 +65,7 @@ beat([2.0,0.5,1.5].bar(1)) :: .dur(0.5).out() `, true, -)} + )} ## Automatic sync for ziffers patterns diff --git a/src/documentation/patterns/ziffers/ziffers_tonnetz.ts b/src/documentation/patterns/ziffers/ziffers_tonnetz.ts index 122dd12..cbf33f1 100644 --- a/src/documentation/patterns/ziffers/ziffers_tonnetz.ts +++ b/src/documentation/patterns/ziffers/ziffers_tonnetz.ts @@ -1,9 +1,9 @@ import { type Editor } from "../../../main"; -import { makeExampleFactory } from "../../../Documentation"; +import { makeExampleFactory } from "../../Documentation"; export const ziffers_tonnetz = (application: Editor): string => { - const makeExample = makeExampleFactory(application); - return ` + const makeExample = makeExampleFactory(application); + return ` # Tonnetz The Riemannian Tonnetz is a geometric representation of pitches where we apply mathematical operations to analyze harmonic and melodic relationships in tonal music. Ziffers includes an implementation of live coding Tonnetz developed together with Edgar Delgado Vega. Nevertheless, our implementation allows you to play in different chord complexes and **combine 67 transformations** with **new exploratory notation**. You have at your disposal the sets: traditional PLR, film music, extended PLR* and functions for seventh chords PLRQ, PLRQ*, ST. @@ -37,47 +37,47 @@ Indexed transformations [plrfsntqNSEW][1-9]*: ### Examples: ${makeExample( - "Explorative transformations with roman chords", - ` + "Explorative transformations with roman chords", + ` z1('i i7').tonnetz("p1 p2 plr2") .sound('wt_stereo') .adsr(0, .1, 0, 0) .out()`, - true, - )} + true, + )} ${makeExample( - "Arpeggiated explorative transformations", - ` + "Arpeggiated explorative transformations", + ` z1("i7") .tonnetz("p l2 r3 rp4l") .arpeggio("e _ 0 1 s ^ 0 2 1 3 h _ 012 s ^ 2 1") .sound("sine") .out()`, - true, - )} + true, + )} ${makeExample( - "Arpeggios and note lengths with parameters", - ` + "Arpeggios and note lengths with parameters", + ` z1("024") .tonnetz("p lr rp lrp") .arpeggio(0,2,1,2) .noteLength(1/16,1/8) .sound("sine") .out()`, - true, - )} + true, + )} ${makeExample( - "Explorative transformations with cardinal directions", - ` + "Explorative transformations with cardinal directions", + ` z1("1/4 i") .tonnetz("p Np N2p N3p plr N3plr E EE EEE E6 NSE3W2") .sound("sine") .out() ` - )} + )} ## Triad transformations @@ -117,8 +117,8 @@ Therefore, you will see that paying attention to the examples will allow you to ### Examples: ${makeExample( - "Synthetic 'Morton'", - ` + "Synthetic 'Morton'", + ` z0('h. 0 q _6 h _4 _3 w _2 _0 h. ^0 q 6 h 4 3 3/4 2 5/4 0 w r') .scale("minor").sound('sawtooth').key("A") .room(0.9).size(9).phaser(0.25).phaserDepth(0.8) @@ -137,8 +137,8 @@ z2('904') z3('e __ 4 s 0 e 1 2 s') .sound('hat').delay(0.5).delayfb(0.35).out()`, - true, - )} + true, + )} ## Different Tonnetz, Chord Complexes @@ -204,8 +204,8 @@ So that you can incorporate this new musical machinery into your game, all the p ### Examples ${makeExample( - "Transform seventh chord from chromatic scale", - ` + "Transform seventh chord from chromatic scale", + ` z1("1.0 047{10}") .scale('chromatic') .tetraTonnetz("o p18 q15 l13 n51 p19 q15") @@ -214,8 +214,8 @@ z1("1.0 047{10}") .adsr(.5,0.05,0.25,0.5) .dur(2.0) .out()`, - true, - )} + true, + )} ## Cyclic methods @@ -236,8 +236,8 @@ Unlike HexaCycles and OctaCycles, **EnneaCycles** are four-note chord sequences. ### Examples: ${makeExample( - "Arpeggio with ennea cycle", - ` + "Arpeggio with ennea cycle", + ` z1("0 2 -1 3") .enneaCycle() .arpeggio(0,2,1) @@ -246,20 +246,20 @@ z1("0 2 -1 3") .sound("sine") .adsr(0.1,0.15,0.25,0.1) .out()`, - true, - )} + true, + )} ${makeExample( - "Variating arpeggios", - ` + "Variating arpeggios", + ` z1("s 0 3 2 1") .octaCycle() .arpeggio([0,[0,2],[1,0],[0,1,2]].beat(0.15)) .sound("triangle") .adsr(0.1,0.1,0.13,0.15) .out()`, - true, - )} + true, + )} ## Cycles with vitamins and repetitions @@ -278,15 +278,15 @@ As you can verify it manually, you will see that this is not the case. Upon reac To play the chords without jumps in our hexaCycle (although the prefix "hexa" would no longer have a precise meaning), we add a number of repetitions. ${makeExample( - "HexaCycles with vitamins", - ` + "HexaCycles with vitamins", + ` z1("0") .scale("chromatic") .hexaCycle([2,3,7],4) .sound("sine").out() `, - true - )} + true + )} By default hexaCycles and enneaCycles have 3 repetitions, while octaCycles has 4 repetitions. We have specified a **chromatic scale** although this is the **default scale**. Try changing the **repeats and scales** when playing with different Tonnetz. @@ -315,19 +315,19 @@ In addition to the cyclical traversing methods, Ziffers implements traversing me As you have noticed, all these graphs usually have many chords, so sometimes it will be convenient to slice up fragments of the cycles. We encourage you to explore these methods and their different parameters. The tonnetz traversing methods can be used in combination with the Ziffers generative methods to sequence, arpeggiate and to randomize the chords in different ways. ${makeExample( - "Cube Dance swing", - ` + "Cube Dance swing", + ` z1("0").cubeDance([3,4,5]) .sound("sine") .ad(r(0.1,0.5),0.1) .out() `, - true, - )} + true, + )} ${makeExample( - "Selecting subset of chords from the cube dance", - ` + "Selecting subset of chords from the cube dance", + ` z1("1/2 0") .cubeDance([3,4,5],4) .at(0,8,2,rI(9,14)) @@ -336,12 +336,12 @@ z1("1/2 0") .delay(2) .out() `, - true - )} + true + )} ${makeExample( - "Power Towers with pulse", - ` + "Power Towers with pulse", + ` z1("1/4 2").powerTowers([2,3,7]) .between(5,11) .arpeggio("e 0 3 1 2") @@ -349,12 +349,12 @@ z1("1/4 2").powerTowers([2,3,7]) .adsr(0.01,0.1,0.1,0.9) .out() `, - true, - )} + true, + )} ${makeExample( - "Between an OctaTower", - ` + "Between an OctaTower", + ` z1("s. 0") .octaTower() .between(2,8) @@ -363,12 +363,12 @@ z1("s. 0") .adsr(0.1,0.15,0,0.1) .out() `, - true - )} + true + )} ${makeExample( - "Selecting chords from the weitzmann region", - ` + "Selecting chords from the weitzmann region", + ` z1("1/8 0") .weitzmannRegions() .at(1,rI(0,7),4,6) @@ -377,12 +377,12 @@ z1("1/8 0") .ad(0.15,0.15) .out() `, - true - )} + true + )} ${makeExample( - "Boretz Spider", - ` + "Boretz Spider", + ` z1("1/16 0") .boretzRegions([1,4,7]) .at(2,rI(3,7),4,6) @@ -391,8 +391,8 @@ z1("1/16 0") .adsr(0.1,0.1,0.1,0.2) .out() `, - true - )} + true + )} * Remark F: You can find more details about Weitzmann and Boretz regions in chapters 4 and 7 of Richard Cohn's book [Audacious Euphony: Chromatic Harmony and the Triad's Second Nature (2012)](https://books.google.com.pe/books?id=rZxZCMRiO9EC&pg=PA59&hl=es&source=gbs_toc_r&cad=2#v=onepage&q&f=false). diff --git a/src/main.ts b/src/main.ts index 1044498..17a715f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,11 +13,11 @@ import { loadUniverserFromUrl, } from "./FileManagement"; import { singleElements, buttonGroups, ElementMap, createDocumentationStyle } from "./DomElements"; -import { registerFillKeys, registerOnKeyDown } from "./KeyActions"; +import { registerFillKeys, registerOnKeyDown } from "./Keyboard"; import { installEditor } from "./EditorSetup"; -import { documentation_factory, documentation_pages, showDocumentation, updateDocumentationContent } from "./Documentation"; +import { documentation_factory, documentation_pages, showDocumentation, updateDocumentationContent } from "./documentation/Documentation"; import { EditorView } from "codemirror"; -import { Clock } from "./Clock"; +import { Clock } from "./clock/Clock"; import { loadSamples, UserAPI } from "./API"; import * as oeis from "jisg"; import * as zpatterns from "zifferjs/src/patterns.ts"; @@ -28,7 +28,7 @@ import { tryEvaluate } from "./Evaluator"; // @ts-ignore import showdown from "showdown"; import { makeStringExtensions } from "./extensions/StringExtensions"; -import { installInterfaceLogic } from "./InterfaceLogic"; +import { installInterfaceLogic } from "./UILogic"; import { installWindowBehaviors } from "./WindowBehavior"; import { makeNumberExtensions } from "./extensions/NumberExtensions"; import colors from "./colors.json"; @@ -124,7 +124,6 @@ export class Editor { this.initializeElements(); this.initializeButtonGroups(); this.setCanvas(this.interface.feedback as HTMLCanvasElement); - this.setCanvas(this.interface.scope as HTMLCanvasElement); this.setCanvas(this.interface.drawings as HTMLCanvasElement); try { this.loadHydraSynthAsync(); @@ -198,7 +197,7 @@ export class Editor { // ================================================================================ installEditor(this); - runOscilloscope(this.interface.scope as HTMLCanvasElement, this); + runOscilloscope(this.interface.feedback as HTMLCanvasElement, this); // First evaluation of the init file tryEvaluate(this, this.universes[this.selected_universe.toString()].init); @@ -581,7 +580,6 @@ export class Editor { private setCanvas(canvas: HTMLCanvasElement): void { /** * Sets the canvas element and configures its size and context. - * * @param canvas - The HTMLCanvasElement to set. */ if (!canvas) return;