From 4d6937b933f4034bf8661e909eebb04b4ea92d2c Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Mon, 21 Aug 2023 15:34:29 +0200 Subject: [PATCH] better FM --- src/API.ts | 4 +++- src/Documentation.ts | 11 +++++++++++ src/Sound.ts | 11 +++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/API.ts b/src/API.ts index e450723..ab4e4c5 100644 --- a/src/API.ts +++ b/src/API.ts @@ -9,6 +9,7 @@ import { samples, initAudioOnFirstClick, registerSynthSounds, + soundMap, // @ts-ignore } from "superdough"; @@ -59,7 +60,7 @@ export class UserAPI { load: samples; constructor(public app: Editor) { - this.load = samples("github:tidalcycles/Dirt-Samples/master"); + //this.load = samples("github:tidalcycles/Dirt-Samples/master"); } // ============================================================= @@ -1151,6 +1152,7 @@ export class UserAPI { }; snd = this.sound; samples = samples; + soundMap = soundMap; log = console.log; diff --git a/src/Documentation.ts b/src/Documentation.ts index 59be12d..6c17b2e 100644 --- a/src/Documentation.ts +++ b/src/Documentation.ts @@ -2,6 +2,8 @@ const key_shortcut = (shortcut: string): string => { return `${shortcut}`; }; +const injectAvailableSamples = (): string => {}; + const introduction: string = ` # Welcome @@ -317,6 +319,15 @@ No sound will play until you add .out() at the end of the chain. | out() | Returns an object processed by the superdough function, using the current values in the values object and the pulse_duration from the app.clock. | `; +const samples: string = ` +# Audio Samples + +## Available audio samples + +${injectAvailableSamples()} + +`; + const about: string = ` # About Topos diff --git a/src/Sound.ts b/src/Sound.ts index 2531e86..08bd5ab 100644 --- a/src/Sound.ts +++ b/src/Sound.ts @@ -46,6 +46,17 @@ export class Sound { return this; }; + fm = (value: number | string): this => { + if (typeof value === "number") { + this.values["fmi"] = value; + } else { + let values = value.split(":"); + this.values["fmi"] = parseFloat(values[0]); + if (values.length > 1) this.values["fmh"] = parseFloat(values[1]); + } + return this; + }; + fmi = (value: number): this => { this.values["fmi"] = value; return this;