Showing Web Audio FFT on a logarithmic scale

654 views Asked by At

I'm trying to make an audio analyzer with bars on an HTML5 canvas with the Web Audio API, showing frequencies on the x-axis and magnitudes on y-axis. I'm asking because my x-axis is in linear scale, how can I show this on a logarithmic scale?


I'm using an array Uint8Array like this var a = [32, 43, 46, 47, 46, 44, 54, 65, 67, 69, 68, 73, 64, 77, 76, 88, 92, 95, 146, 198, 217, 216, 194, 134, 94, 97, 79, 85, 71, 69, 61, 63, 60, 56, 50, 61, 56, 54, 52, 51, 53, 58, 59, 52, 45, 45, 40, 40, 32, 32, 35, 38, 31, 18, 5, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...];

These are the 99 first elements of an array of fftSize.length of 2048, the audio is a 440Hz tone;

I don't know what means "scale".

I've created a jsFiddle showing my errors https://jsfiddle.net/jmgarciamari/3namk9y9/2/

0

There are 0 answers