revy
revy

Reputation: 4707

Javascript: sample rate ignored on constructing an AudioContext

Why

let context = new AudioContext({
  latencyHint: "interactive",
  sampleRate: 44100
});

console.log(context)

gives a sample rate of 48000 samples, while I want it to be running at 44 Khz?

Chrome 71.0.3578.98, mac os 10.14.2

Reference: AudioContextOptions

Upvotes: 1

Views: 752

Answers (1)

chrisguttandin
chrisguttandin

Reputation: 9066

Apparently this is not yet implemented in Chrome. Here is a link to the relevant bug: https://bugs.chromium.org/p/chromium/issues/detail?id=432248.

It's implemented in Firefox though.

If you don't specify the sampleRate or the browser doesn't support setting the sampleRate it should pick the sampleRate of your default audio output device. This might change over time if you have for example an external sound card.

Upvotes: 1

Related Questions