Fixing setInterval not freed for some volume analyzers

Also: using a 256 fftSize instead of 2048 to save on CPU cycles.
This commit is contained in:
David Négrier
2022-03-16 15:27:58 +01:00
parent 53b184e82b
commit 37e824c494
3 changed files with 19 additions and 4 deletions
+2 -2
View File
@@ -57,8 +57,8 @@ export class SoundMeter {
this.context = context;
this.analyser = this.context.createAnalyser();
this.analyser.fftSize = 2048;
const bufferLength = this.analyser.fftSize;
this.analyser.fftSize = 256;
const bufferLength = this.analyser.frequencyBinCount;
this.dataArray = new Uint8Array(bufferLength);
}