BaseAudioContext: thuộc tính sampleRate
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
Thuộc tính sampleRate của giao diện BaseAudioContext trả về một số dấu phẩy động biểu diễn tốc độ lấy mẫu, tính theo số mẫu mỗi giây, được dùng bởi mọi node trong audio context này.
Hạn chế này có nghĩa là các bộ chuyển đổi tốc độ lấy mẫu không được hỗ trợ.
Giá trị
Một số dấu phẩy động biểu thị tốc độ lấy mẫu của audio context, tính theo số mẫu mỗi giây.
Ví dụ
Note:
Để xem ví dụ triển khai Web Audio đầy đủ, hãy xem một trong các
Web Audio Demo trên repo GitHub của MDN. Hãy thử nhập
audioCtx.sampleRate vào console của trình duyệt.
js
const audioCtx = new AudioContext();
// Các trình duyệt webkit/blink cũ yêu cầu tiền tố
// …
console.log(audioCtx.sampleRate);
Thông số kỹ thuật
| Specification |
|---|
| Web Audio API> # dom-baseaudiocontext-samplerate> |