Minor fixes

This commit is contained in:
2023-11-10 13:27:03 +01:00
parent 1bd9468c40
commit c4f9cdccf2
5 changed files with 26 additions and 28 deletions

View File

@ -82,7 +82,7 @@ define(['./workbox-5357ef54'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812" "revision": "3ca0b8505b4bec776b69afdba2768812"
}, { }, {
"url": "index.html", "url": "index.html",
"revision": "0.juov83h1sno" "revision": "0.aa2tv1h0in8"
}], {}); }], {});
workbox.cleanupOutdatedCaches(); workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

File diff suppressed because one or more lines are too long

View File

@ -164,7 +164,7 @@ export class Clock {
} }
get realTime(): number { get realTime(): number {
return this.app.audioContext.currentTime - this.totalPauseTime; return this.app.audioContext.currentTime - this.totalPauseTime;
} }
get deviation(): number { get deviation(): number {
@ -175,6 +175,7 @@ export class Clock {
if (ppqn > 0 && this._ppqn !== ppqn) { if (ppqn > 0 && this._ppqn !== ppqn) {
this._ppqn = ppqn; this._ppqn = ppqn;
this.transportNode?.setPPQN(ppqn); this.transportNode?.setPPQN(ppqn);
this.logicalTime = this.realTime;
} }
} }
@ -192,15 +193,12 @@ export class Clock {
*/ */
const pulseDuration = this.pulse_duration; const pulseDuration = this.pulse_duration;
const nudgedTime = time + nudge; const nudgedTime = time + nudge;
const nextTickTime = Math.ceil(nudgedTime / const nextTickTime = Math.ceil(nudgedTime / pulseDuration) * pulseDuration;
pulseDuration) * pulseDuration;
const remainingTime = nextTickTime - nudgedTime; const remainingTime = nextTickTime - nudgedTime;
return remainingTime; return remainingTime;
} }
public convertPulseToSecond(n: number): number { public convertPulseToSecond(n: number): number {
/** /**
* Converts a pulse to a second. * Converts a pulse to a second.
@ -218,7 +216,7 @@ export class Clock {
this.running = true; this.running = true;
this.app.api.MidiConnection.sendStartMessage(); this.app.api.MidiConnection.sendStartMessage();
this.lastPlayPressTime = this.app.audioContext.currentTime; this.lastPlayPressTime = this.app.audioContext.currentTime;
this.totalPauseTime += (this.lastPlayPressTime - this.lastPauseTime); this.totalPauseTime += this.lastPlayPressTime - this.lastPauseTime;
this.transportNode?.start(); this.transportNode?.start();
} }

View File

@ -1,5 +1,4 @@
class TransportProcessor extends AudioWorkletProcessor { class TransportProcessor extends AudioWorkletProcessor {
constructor(options) { constructor(options) {
super(options); super(options);
this.port.addEventListener("message", this.handleMessage); this.port.addEventListener("message", this.handleMessage);
@ -20,19 +19,20 @@ class TransportProcessor extends AudioWorkletProcessor {
this.started = false; this.started = false;
} else if (message.data.type === "stop") { } else if (message.data.type === "stop") {
this.started = false; this.started = false;
} else if (message.data.type === 'bpm') { } else if (message.data.type === "bpm") {
this.bpm = message.data.value; this.bpm = message.data.value;
this.currentPulsePosition = currentTime; this.currentPulsePosition = currentTime;
} else if (message.data.type === 'ppqn') { } else if (message.data.type === "ppqn") {
this.ppqn = message.data.value; this.ppqn = message.data.value;
} else if (message.data.type === 'nudge') { this.currentPulsePosition = currentTime;
} else if (message.data.type === "nudge") {
this.nudge = message.data.value; this.nudge = message.data.value;
} }
} };
process(inputs, outputs, parameters) { process(inputs, outputs, parameters) {
if (this.started) { if (this.started) {
const adjustedCurrentTime = currentTime + (this.nudge / 100); const adjustedCurrentTime = currentTime + this.nudge / 100;
const beatNumber = adjustedCurrentTime / (60 / this.bpm); const beatNumber = adjustedCurrentTime / (60 / this.bpm);
const currentPulsePosition = Math.ceil(beatNumber * this.ppqn); const currentPulsePosition = Math.ceil(beatNumber * this.ppqn);
if (currentPulsePosition > this.currentPulsePosition) { if (currentPulsePosition > this.currentPulsePosition) {
@ -44,7 +44,4 @@ class TransportProcessor extends AudioWorkletProcessor {
} }
} }
registerProcessor( registerProcessor("transport", TransportProcessor);
"transport",
TransportProcessor
);

View File

@ -88,8 +88,9 @@ if (flip(8, 75)) {
.end(1).out() .end(1).out()
beat(.5) :: sound('ST01').note(melody).n($(1)).gain(0.4).end(1).out() beat(.5) :: sound('ST01').note(melody).n($(1)).gain(0.4).end(1).out()
beat(1) :: sound('ST02').note(melody).n($(1)).gain(0.4).end(1).out() beat(1) :: sound('ST02').note(melody).n($(1)).gain(0.4).end(1).out()
}`, `// Race day - Bubobubobubo }`,
bpm(125); `// Race day - Bubobubobubo
tempo(125);
beat(.5) :: sound('STB6').n(irand(1,10)).gain(1).out() beat(.5) :: sound('STB6').n(irand(1,10)).gain(1).out()
rhythm(flip(4) ? 1 : .5, 5, 8) :: sound('kick').out() rhythm(flip(4) ? 1 : .5, 5, 8) :: sound('kick').out()
rhythm(flip(2) ? .5 : .25, 7, 8) :: sound('click') rhythm(flip(2) ? .5 : .25, 7, 8) :: sound('click')
@ -113,7 +114,7 @@ rhythm(flip(2) ? .5 : .25, flip(4) ? 8 : 11, 12) :: sound('hat')
.orbit(3).room(0.5).size(0.5).n(0).out() .orbit(3).room(0.5).size(0.5).n(0).out()
`, `,
`// Part-Dieu - Bubobubobubo `// Part-Dieu - Bubobubobubo
bpm(90); tempo(90);
beat(rarely(12) ? .5 : .25) :: sound('ST22') beat(rarely(12) ? .5 : .25) :: sound('ST22')
.note([30, 30, 30, 31].repeat(8).beat(.5)) .note([30, 30, 30, 31].repeat(8).beat(.5))
.cut(1).n([19, 21].beat(.75)) .cut(1).n([19, 21].beat(.75))
@ -127,10 +128,11 @@ beat(.5) :: snd('dr')
.gain(1).out() .gain(1).out()
beat(flip(2) ? 1 : 0.75) :: snd('bd').n(2).out() beat(flip(2) ? 1 : 0.75) :: snd('bd').n(2).out()
beat(4) :: snd('snare').n(5) beat(4) :: snd('snare').n(5)
.delay(0.5).delayt(bpm() / 60 / 8) .delay(0.5).delayt(tempo() / 60 / 8)
.delayfb(0.25).out() .delayfb(0.25).out()
`, `// Atarism - Bubobubobubo `,
bpm(85); `// Atarism - Bubobubobubo
tempo(85);
let modifier = [.5, 1, 2].beat(8); let modifier = [.5, 1, 2].beat(8);
let othermod = [1, .5, 4].beat(4); let othermod = [1, .5, 4].beat(4);
beat(modifier / 2):: sound('STA9').n([0,2].beat(.5)).vel(0.5).out() beat(modifier / 2):: sound('STA9').n([0,2].beat(.5)).vel(0.5).out()
@ -159,7 +161,7 @@ beat(1/4)::snd(['sawtooth', 'triangle', 'square'].beat(1))
.sustain(0.01 + usine(.25) / 10).out() .sustain(0.01 + usine(.25) / 10).out()
beat(4)::snd('amencutup').n($(19)).cut(1).orbit(2).pan(rand(0.0,1.0)).out()`, beat(4)::snd('amencutup').n($(19)).cut(1).orbit(2).pan(rand(0.0,1.0)).out()`,
`// Crazy arpeggios - Bubobubobubo `// Crazy arpeggios - Bubobubobubo
bpm(110) tempo(110)
beat([0.25, 0.5].beat(4)) && sound('sawtooth') beat([0.25, 0.5].beat(4)) && sound('sawtooth')
.note([60, 62, 63, 67, 70].beat(.125) + .note([60, 62, 63, 67, 70].beat(.125) +
[-12,0,12].beat() + [0, 0, 5, 7].bar()) [-12,0,12].beat() + [0, 0, 5, 7].bar())
@ -194,7 +196,8 @@ beat([.25,.125, .5].beat(4))::snd('arpy:4')
.cutoff(100 + usine(1/8) * 800).lpadsr(5, 0, [1/8, 1.16].beat(), 0, 0) .cutoff(100 + usine(1/8) * 800).lpadsr(5, 0, [1/8, 1.16].beat(), 0, 0)
.resonance(0.2).gain(0.4).end(0.8).room(0.9).size(0.9).n(3).out(); .resonance(0.2).gain(0.4).end(0.8).room(0.9).size(0.9).n(3).out();
beat(.5) :: snd('arpy').note([30, 33, 35].repeat(4).beat(1) - [24,12].beat(0.5)) beat(.5) :: snd('arpy').note([30, 33, 35].repeat(4).beat(1) - [24,12].beat(0.5))
.cutoff(500).lpadsr(8, 0.05, .125, 0, 0).out()`, `// Naïf et agréable -- Bubobubobubo .cutoff(500).lpadsr(8, 0.05, .125, 0, 0).out()`,
`// Naïf et agréable -- Bubobubobubo
z1('1/8 024!3 035 024 0124').sound('wt_stereo') z1('1/8 024!3 035 024 0124').sound('wt_stereo')
.adsr(0, .4, 0.5, .4).gain(0.1) .adsr(0, .4, 0.5, .4).gain(0.1)
.lpadsr(4, 0, .2, 0, 0) .lpadsr(4, 0, .2, 0, 0)
@ -211,7 +214,7 @@ z4('1/4 kick kick snare kick').sound().gain(1).cutoff(osci).out()`,
/* /*
`// Numerology - Bubobubobubo `// Numerology - Bubobubobubo
bpm(130); tempo(130);
let mel = [ let mel = [
"0.125 _ (0 3 7 0 3 5 0 3 9)+(0 2)", "0.125 (0 7 0 10 0 5)+(0 3)", "0.125 _ (0 3 7 0 3 5 0 3 9)+(0 2)", "0.125 (0 7 0 10 0 5)+(0 3)",
"0.125 (0 3 7 0 3 5 0 3 9)+(0 2)", "0.125 (0 2 4 5 9 10)+(0 2)", "0.125 (0 3 7 0 3 5 0 3 9)+(0 2)", "0.125 (0 2 4 5 9 10)+(0 2)",
@ -219,7 +222,7 @@ let mel = [
z0(mel) z0(mel)
.scale('minor').sound('wt_piano').cutoff(800 + usine(.5) * 5000) .scale('minor').sound('wt_piano').cutoff(800 + usine(.5) * 5000)
.fmi([2, 4, 8].beat(2)).fmh(flip(2) ? 2 : 4) .fmi([2, 4, 8].beat(2)).fmh(flip(2) ? 2 : 4)
.delay(bpm() / 60 / 9).delayt(0.25).delayfb(0.5) .delay(tempo() / 60 / 9).delayt(0.25).delayfb(0.5)
.fmsus(0.3).fmrel(0.3).rel(rand(0.5,0.8)) .fmsus(0.3).fmrel(0.3).rel(rand(0.5,0.8))
.sus(rand(0.05, 0.1)).out(); .sus(rand(0.05, 0.1)).out();
beat(1) :: sound(flip(2) ? 'kick' : ['sd', 'cp'].beat(3)).out(); beat(1) :: sound(flip(2) ? 'kick' : ['sd', 'cp'].beat(3)).out();