audio-spectrum-main.js constructs an AudioContext with the default sample rate, but this may not be the best sample rate available for a given input device. Detect what that sample rate is and re-create the context to suit. This will require consulting MediaStreamTrack.getCapabilities(), and refactoring to allow replacing the AudioContext after startup.