Skip to content

Commit

Permalink
fix smoothing adjustment
Browse files Browse the repository at this point in the history
with a lookup table
  • Loading branch information
spessasus committed Dec 15, 2024
1 parent 23d4bd9 commit b90b439
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 30 deletions.
14 changes: 12 additions & 2 deletions src/website/js/settings_ui/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ import { ANIMATION_REFLOW_TIME } from "../utils/animation_utils.js";

const TRANSITION_TIME = 0.2;

// these delays sync with the AnalyserNode delay
// tested on firefox
const niceDelayLookupTable = {
2048: 0.05,
4096: 0.27,
8192: 0.34,
16384: 0.37151927437641724,
32768: 0.48,
};

/**
* settings.js
* purpose: manages the gui settings, controlling things like render settings, light mode etc.
Expand Down Expand Up @@ -375,9 +385,9 @@ class SpessaSynthSettings
let delayTime;
// calculate delay:
// 16384 fft size = 0.37 s
if (fft > 2048)
if (fft >= 2048)
{
delayTime = fft / this.synthui.synth.context.sampleRate;
delayTime = niceDelayLookupTable[fft]//fft / this.synthui.synth.context.sampleRate;
}
else
{
Expand Down
20 changes: 10 additions & 10 deletions src/website/minified/demo_main.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit b90b439

Please sign in to comment.