Closed yigithanyucedag closed 3 years ago
try this using buffer ` Recording.init({ bufferSize: 4096, sampleRate: 44100, bitsPerChannel: 16, channelsPerFrame: 1, });
const dataToLevel = data => {
const chunk = Buffer.from(data, 'base64');
level.current = Math.round((Object.values(chunk)[0] * audioMax) / 256);
console.log( level.current) };
const listener = Recording.addRecordingEventListener(dataToLevel);
Recording.start();`
I use this algorithm which called root-mean-square It basically calculates the amount of signal in the buffer but when there is no sound it gives values which are more than 0.
My question: What is the proper way to determine input audio level in react native by using this library?
Note: I'm trying to implement this tuner to my react native app it is written with javascript web audio api
https://github.com/googlearchive/guitar-tuner/blob/master/src/elements/audio-processor/audio-processor.js
I think I need to use AnalyserNode in react native but how? https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode