More agressive audio nudge

This commit is contained in:
2023-10-07 20:56:10 +02:00
parent 0c21770eaa
commit 1a0d689441
2 changed files with 81 additions and 83 deletions

View File

@ -461,7 +461,7 @@ export class MidiConnection {
const estimatedBPM = this.estimatedBPM();
if (estimatedBPM !== this.roundedBPM) {
console.log("Esimated BPM: ", estimatedBPM);
console.log("Estimated BPM: ", estimatedBPM);
this.api.bpm(estimatedBPM);
this.roundedBPM = estimatedBPM;
}
@ -523,8 +523,7 @@ export class MidiConnection {
if (typeof output === "number") {
if (output < 0 || output >= this.midiOutputs.length) {
console.error(
`Invalid MIDI output index. Index must be in the range 0-${
this.midiOutputs.length - 1
`Invalid MIDI output index. Index must be in the range 0-${this.midiOutputs.length - 1
}.`
);
return this.currentOutputIndex;
@ -553,8 +552,7 @@ export class MidiConnection {
if (typeof input === "number") {
if (input < 0 || input >= this.midiInputs.length) {
console.error(
`Invalid MIDI input index. Index must be in the range 0-${
this.midiInputs.length - 1
`Invalid MIDI input index. Index must be in the range 0-${this.midiInputs.length - 1
}.`
);
return -1;

View File

@ -33,7 +33,7 @@ class TransportProcessor extends AudioWorkletProcessor {
process(inputs, outputs, parameters) {
if (this.started) {
const adjustedCurrentTime = currentTime + (this.nudge / 1000);
const adjustedCurrentTime = currentTime + (this.nudge / 100);
const beatNumber = adjustedCurrentTime / (60 / this.bpm);
const currentPulsePosition = Math.ceil(beatNumber * this.ppqn);
if (currentPulsePosition > this.currentPulsePosition) {