1.1.1 • Published 3 years ago

@alifelived/react-native-audio-record v1.1.1

Weekly downloads
35
License
MIT
Repository
github
Last release
3 years ago

react-native-audio-record

Audio record buffers for iOS and Android.

Install

npm i react-native-audio-record
cd ios
pod install

Usage

import AudioRecord from 'react-native-audio-record';

const options = {
  sampleRate: 16000,  // default 44100
  channels: 1,        // 1 or 2, default 1
  bitsPerSample: 16,  // 8 or 16, default 16
  audioSource: 6,     // android only (see below)
  wavFile: 'test.wav' // default 'audio.wav'
};

AudioRecord.init(options);

AudioRecord.start();

AudioRecord.stop();
// or to get the wav file path
audioFile = await AudioRecord.stop();

AudioRecord.on('data', data => {
  // base64-encoded audio data chunks
});

For audioSource use one of the constant values from here. Default value is 6 (VOICE_RECOGNITION).

Use 3rd-party module like buffer to decode base64 data. Example -

// yarn add buffer
import { Buffer } from 'buffer';
chunk = Buffer.from(data, 'base64');

Don't forget to add microphone permission in your app.

Credits/References

I'm not a native app developer. Most of the code is taken from online resources.

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.4.9

3 years ago

0.4.8

3 years ago

1.0.3

3 years ago

0.4.7

3 years ago

0.5.0

3 years ago

0.5.1

3 years ago

0.4.5

3 years ago

0.4.6

3 years ago

0.4.4

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.3.0

4 years ago

0.3.1

4 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago