How to get microphone levels in real time using Phonegap / Cordova?

I am looking for a way to read volume data in real time from a microphone. Just some kind of general "volume". The goal is to make your lips move when you speak into the microphone on an html5 canvas element ...

I basically want this plugin, but for the microphone level instead of the camera:

https://github.com/casoninabox/luminance-cordova-ios

Does anyone know of any existing libraries for this, or how I can create a plugin for iOS? I assume this will be related to AVAudioSession ?

+6
source share
1 answer

There is a plugin that measures volume data in decibels: https://github.com/akofman/cordova-plugin-dbmeter

Install the plugin with:

 cordova plugin add cordova-plugin-dbmeter 

Make sure you add these lines to your config.xml application, as this plugin does not currently support Swift 3.

 <preference name="UseLegacySwiftLanguageVersion" value="true" /> 

Use the plugin as follows:

 document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { DBMeter.start(function(dB){ console.log(dB); }); } 
+1
source

Source: https://habr.com/ru/post/981303/


All Articles