Skip to content

Commit

Permalink
fix(examples): ignore feedback if not automode (fft-synth)
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jan 2, 2020
1 parent 1383ebd commit 3970aca
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions examples/fft-synth/src/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ export const stopAudio = () => {
};

export const updateAudio = () => {
let { bins, gain, feedback } = DB.value;
const pbins = [0, ...delay.read().slice(0, NUM_BINS - 1)];
let { auto, bins, gain, feedback } = DB.value;
gain *= BIN_AMP;
bins = bins.map((x, i) => x * gain + pbins[i] * feedback);
if (auto != null) {
const pbins = [0, ...delay.read().slice(0, NUM_BINS - 1)];
bins = bins.map((x, i) => x * gain + pbins[i] * feedback);
} else {
bins = bins.map((x) => x * gain);
}
delay.write(bins);
const wave = ifft(conjugate(bins))[0];
DB.resetIn("wave", wave);
Expand Down

0 comments on commit 3970aca

Please sign in to comment.