wx.createAudioContext 功能问题
wx.createAudioContext
创建的组件,和H5原生的window.AudioContext || window.webkitAudioContext 有很大的差别。
如果我想实现播放正弦波、控制音量等功能,比如:
window.AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); var oscillator = audioCtx.createOscillator(); var gainNode = audioCtx.createGain(); oscillator.connect(gainNode); gainNode.connect(audioCtx.destination); oscillator.type = 'sine' ; oscillator.frequency.value = 196.00; gainNode.gain.setValueAtTime(0, audioCtx.currentTime); gainNode.gain.linearRampToValueAtTime(1, audioCtx.currentTime + 0.01); oscillator.start(audioCtx.currentTime); gainNode.gain.exponentialRampToValueAtTime(0.001, audioCtx.currentTime + 1); oscillator.stop(audioCtx.currentTime + 1); |
在小程序中是否可以实现?后续还会扩展这个组件的功能吗?谢谢、