Hello
I have some problem about measure decibel from microphone input.
What I have to do is recording start when detected lound sound.
So first, I tested audio recording sample code, and modified some part in audio.js
modified code in audio.js:
function registerStream(mediaStream) {
navigator.tizCamera.createCameraControl(
mediaStream,
onAudioControlCreated,
onAudioControlError
);
//This is modified section.
var audioContext = new window.webkitAudioContext();
var analyser = audioContext.createAnalyser();
var mic = audioContext.createMediaStreamSource(mediaStream);
var javascriptNode = audioContext.createScriptProcessor(2048,1,1);
analyser.smoothingTimeConstant = 0.8;
analyser.fftSize = 1024;
mic.connect(analyser);
analyser.connect(javascriptNode);
javascriptNode.connect(audioContext.destination);
javascriptNode.onaudioprocess = function(){
var array = new Uint8Array(analyser.frequencyBinCount);
analyser.getByteFrequencyData(array);
var values = 0;
var length = array.length;
for(var i=0; i < length; i++){
values += (array[i]);
}
var average = values / length;
console.log(average);
}
/////
}
But any console log can't see.
Any problem in my code?
My question is webkitAudioContext() is not supported in tizen?
And, Any other method to measure decibel or sound level? or Is it impossible in web app?
Thanks in advance.