Reputation: 7734
The default sample rate of web audio context is 48000. However, most people can only hear 20-20000Hz and almost no one can hear over 30000Hz, why it is set to 48000?
var a = new AudioContext();
var samplerate = a.sampleRate;
alert(samplerate); // 48000
Upvotes: 0
Views: 1176
Reputation: 9126
The fact that 20kHz is approximately the highest frequency humans can hear is exactly the reason why values above 40kHz are so commonly used by audio hardware.
To represent a signal digitally you have to sample it with at least twice the frequency. https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
By default an AudioContext
uses the sampleRate
of the audio hardware which is commonly 44.1kHz (thanks to the CD format) or 48kHz these days.
Upvotes: 2