Languages

Menu
Sites
Language
Gear2 onaudioprocess not fired

If you want record audio in mp3 with JS, you can see this code https://github.com/nusofthq/Recordmp3js

If port this code to Gear2, but onaudioprocess not fired. No errors, no warnings.. simply no fired.

Question: Do you get to get to work onaudioprocess?

Edited by: Ihar Shaduryn on 10 Jun, 2014

Responses

5 Replies
Kaveh Bakhtiyari

I also have the same problem.

I want to do the Signal Processing on the Audio input stream, and it works fine on Chrome (Preview window), but neither on Gear 2 device nor emulator.

I even searched the web and tried every single possible solution that I found.

Ihar Shaduryn

Sadly fact. Interesting how work native recorder without this feature..

AVSukhov

Hello,

May be this article help you:

http://stackoverflow.com/questions/20602720/javascript-audio-api-onaudioprocess-not-fired

Kaveh Bakhtiyari

I checked this, and my code doesn't have this mentioned problem in Stackoverflow.

Kaveh Bakhtiyari

Here is my code:

audioContext = window.AudioContext || window.webkitAudioContext;
        context = new audioContext();

        timeData = [];
        fft = new FFT(MY_FFT_SIZE, SAMPLE_RATE);
        
        procNode = context.createJavaScriptNode(BUFFER_LEN, 1, 1);
        
        procNode.onaudioprocess = window.audioProcess = function(e) {
            console.log('gotStream audioProcess');
            timeData = e.inputBuffer.getChannelData(0);
            if (recording) {
                leftChannel.push(new Float32Array(timeData));
                rightChannel.push(new Float32Array(timeData));
                recordingLength += BUFFER_LEN;
            }
        }
        
        inputHardware = context.createMediaStreamSource(stream);
        procNode.connect(context.destination);