React Native audio recording module used for DSP with Android + iOS
$ npm i react-native-recording
import { PermissionsAndroid } from "react-native";
import Recording from "react-native-recording";
await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
]);
Recording.init({
bufferSize: 4096,
sampleRate: 44100,
bitsPerChannel: 16,
channelsPerFrame: 1,
});
const listener = Recording.addRecordingEventListener((data) =>
console.log(data)
);
Recording.start();
// stop recording
Recording.stop();
listener.remove();
As of iOS 10.0, you must declare an intention to access a microphone. Add NSMicrophoneUsageDescription key and declaration value in Info.plist.
<dict>
...
<key>NSMicrophoneUsageDescription</key>
<string>This app uses the microphone to record the soundscape.</string>
...
</dict>