[英]Web Audio APIs - Capture audio - Disable low pass filter
我使用了本教程: http : //typedarray.org/from-microphone-to-wav-with-getusermedia-and-web-audio/
以及這個實時演示頁面: http : //typedarray.org/wp-content/projects/WebAudioRecorder/
創建我的高頻分析儀。
我的問題是,默認情況下,Web Audio API會切斷高頻。
當我錄制WAV並播放10000hz信號時,wav包含我的頻率。
如果我播放17000Hz信號,WAV將不包含我的頻率。
如何禁用低通濾波器?
碼:
function success(e){
// creates the audio context
audioContext = window.AudioContext || window.webkitAudioContext;
context = new audioContext();
// creates a gain node
volume = context.createGain();
// creates an audio node from the microphone incoming stream
audioInput = context.createMediaStreamSource(e);
// connect the stream to the gain node
audioInput.connect(volume);
/* From the spec: This value controls how frequently the audioprocess event is
dispatched and how many sample-frames need to be processed each call.
Lower values for buffer size will result in a lower (better) latency.
Higher values will be necessary to avoid audio breakup and glitches */
var bufferSize = 2048;
recorder = context.createJavaScriptNode(bufferSize, 2, 2);
recorder.onaudioprocess = function(e){
console.log ('recording');
var left = e.inputBuffer.getChannelData (0);
var right = e.inputBuffer.getChannelData (1);
// we clone the samples
leftchannel.push (new Float32Array (left));
rightchannel.push (new Float32Array (right));
recordingLength += bufferSize;
}
// we connect the recorder
volume.connect (recorder);
recorder.connect (context.destination);
}
這在getUserMedia
,而不在Web Audio API中。 默認情況下, getUserMedia
提供給您的MediaStream
包含已經(取決於瀏覽器)的數據:-取消了回聲-抑制了噪音-應用了自動增益補償
您可以使用約束禁用這些約束(例如,對於Firefox):
navigator.mediaDevices.getUserMedia({audio: { echoCancellation: false, mozNoiseSuppression: false, mozAutoGainControl: false });
我們目前正在對這些屬性進行標准化,但尚未完成。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.