From b96c670015f459ecc7624851b35bdb48d75b6b47 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Sun, 17 Sep 2023 22:10:11 +0200 Subject: [PATCH] temp push 2 --- src/classes/SoundEvent.ts | 12 +++++++----- src/documentation/patterns.ts | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/classes/SoundEvent.ts b/src/classes/SoundEvent.ts index 7111518..3ca63e2 100644 --- a/src/classes/SoundEvent.ts +++ b/src/classes/SoundEvent.ts @@ -15,7 +15,7 @@ export class SoundEvent extends AudibleEvent { this.values = { s: sound.split(":")[0], n: sound.split(":")[1], - dur: 0.5, + dur: app.clock.convertPulseToSecond(app.clock.ppqn), }; } else { this.values = { s: sound, dur: 0.5 }; @@ -55,7 +55,7 @@ export class SoundEvent extends AudibleEvent { public sustainVolume = (value: number) => this.updateValue("sustainVolume", value); public tremolo = (value: number) => this.updateValue("tremolo", value); - public duration = (value: number) => this.updateValue("duration", value); + public dur = (value: number) => this.updateValue("dur", value); public zzfx = (value: number[]) => this.updateValue("zzfx", value); // ================================================================================ @@ -106,7 +106,7 @@ export class SoundEvent extends AudibleEvent { public lpe = (value: number) => this.updateValue("lpenv", value); public lpattack = (value: number) => this.updateValue("lpattack", value); public lpa = this.lpattack; - public lpdecay = (value: number) => this.updateValue("lbdecay", value); + public lpdecay = (value: number) => this.updateValue("lpdecay", value); public lpd = this.lpdecay; public lpsustain = (value: number) => this.updateValue("lpsustain", value); public lps = this.lpsustain; @@ -295,10 +295,12 @@ export class SoundEvent extends AudibleEvent { this.values.chord.forEach((freq: number) => { const copy = { ...this.values }; copy.freq = freq; - superdough(copy, 1 / 4, this.values.dur || 0.5); + // This is pure non-sense but I need to adapt somehow + superdough(copy, this.values.dur * 2, this.values.dur); }); } else { - superdough(this.values, 1 / 4, this.values.dur || 0.5); + // This is pure non-sense but I need to adapt somehow + superdough(this.values, this.values.dur * 2, this.values.dur); } }; } diff --git a/src/documentation/patterns.ts b/src/documentation/patterns.ts index 0f73585..ffeeb48 100644 --- a/src/documentation/patterns.ts +++ b/src/documentation/patterns.ts @@ -111,7 +111,7 @@ beat([.5, 1].random() / 2) :: snd( ${makeExample( "Generate a list of random numbers", - `beat(0.5) && sound('arp').freq([].gen(300,600,10).div(3)).out()`, + `beat(0.5) && sound('arp').freq([].gen(300,600,10).beat(3)).out()`, true )} @@ -188,7 +188,7 @@ beat(1)::snd('sine').sustain(0.1).freq([100,100,100,100,200].unique().beat()).ou - add(): add a given amount to every list element. - sub(): add a given amount to every list element. - mult(): add a given amount to every list element. -- division(): add a given amount to every list element. The method is named division because obviously div is already taken. +- div(): add a given amount to every list element. ${makeExample("Simple addition", `[1, 2 ,3].add(2).beat()`, true)}