เปลี่ยนรอบการทำงานใน AudioContext

ฉันกำลังพยายามเล่นความถี่ที่มีรอบหน้าที่แตกต่างจากค่าเริ่มต้น (0.5)

ที่นี่พวกเขาเพิ่งกล่าวถึงปัญหา https://developer.mozilla.org/en-US/docs/Web/API/OscillatorNode/type

และไม่มีข้อมูลว่าต้องทำอย่างไร

function beep() {
    const audioCtx = new AudioContext();
    const oscillator = audioCtx.createOscillator();

    oscillator.type = 'square';
    oscillator.frequency.setValueAtTime(440, audioCtx.currentTime);
    oscillator.start();
}
<button onclick="beep()">beep</button>


person Shai    schedule 21.04.2020    source แหล่งที่มา
comment
สิ่งนี้ตอบคำถามของคุณหรือไม่? วิธีปรับความกว้างพัลส์ของเว็บ Audio API Square OscillatorNode?   -  person ggorlen    schedule 21.04.2020