BaseAudioContext: sampleRate property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{ APIRef("Web Audio API") }}
The **sampleRate** read-only property of the {{domxref("BaseAudioContext")}} interface returns a floating point number representing the sample rate, in samples per second, used by all nodes in this audio context. This limitation means that sample-rate converters are not supported.
Value
A floating point number indicating the audio context's sample rate, in samples per second.
Examples
توجه: For a full Web Audio example implementation, see one of our Web Audio Demos on the MDN GitHub repo. Try entering audioCtx.sampleRate into your browser console.
js
const audioCtx = new AudioContext();
// Older webkit/blink browsers require a prefix
// …
console.log(audioCtx.sampleRate);Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- Using the Web Audio API