Can we capture and manipulate audio data from TIZEN mic ?

Can we capture and manipulate audio data from TIZEN mic ?

BY 13 Mar 2013 Web Application Development

Hi, everybody

Can we capture and manipulate audio data from TIZEN mic ? I tried as following:

 

——————————————————————————–

 

—- main.js —-

var g_soundmeter = null;

$(document).ready(function () {

    // webkit shim

    window.AudioContext = window.AudioContext || window.webkitAudioContext;

    navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;

    window.URL = window.URL || window.webkitURL;

 

    g_soundmeter = new SoundMeter(onAudioProcess);

});

 

function onAudioProcess(e) {

   var i, s, v;

    var sdata = e.inputBuffer.getChannelData(0);

   for (i=0; i < len; i++) {

      s = sdata[i];

       if (s !=0 ) console.log(“s = “ + s);}

});

—– soundmeter.js ——

SoundMeter = function(cbAudioProcess) {

this._cbAudioProcess = cbAudioProcess;

this._isRecording = false;

this.context = null;

this.node = null;

    navigator.getUserMedia({audio: true}, this.startUserMedia.bind(this), function(e) {

        console.log(‘No live audio input: ‘ + e);

      });

}

 

SoundMeter.prototype.startUserMedia = function(stream) {

this._isRecording = true;

this.context = new AudioContext();

var input = this.context.createMediaStreamSource(stream);

    var bufferLen = 4096;

    this.node = this.context.createScriptProcessor(bufferLen, 2, 2);

    this.node.onaudioprocess = this._cbAudioProcess;

 

    input.connect(this.node);

    this.node.connect(this.context.destination);

}

 

——————————————————————————–

This steps into onAudioProcess callback function, but I can not see any log-string “s=….”,   sdata array is full of zeros(0)

Is it right that TIZEN supports “Web Audio API” completely now ?

 

Urgently help me, please.

Regards.

Adal.

 

Written by