llfbandit / record

Audio recorder from microphone to a given file path. No external dependencies, MediaRecorder is used for Android an AVAudioRecorder for iOS.
https://pub.dev/packages/record
233 stars 196 forks source link

[Android] Audio Recording volume suddenly drops after approximately 3 seconds #404

Open azrinsani opened 3 days ago

azrinsani commented 3 days ago

Package version record: ^5.1.2

Environment

Describe the bug

Audio Recording volume suddenly drop after recording is started for 3 seconds. So the recorded Audio will have a steady sound and suddenly a drop after about 3 seconds. This happens all the time on this device.

Future<void> startRecording() async { String fileName = '${UserConfig.current.recordedFileNamePrefix}_${DateTime.now().millisecondsSinceEpoch}.${MyRecorder.audioFileExtension}'; String audioFilePath = path.join(Utilities.tmpDir, fileName); await _audioRecorder.cancel(); monitoringStreamStarted = false; await _audioRecorder.start(const RecordConfig(encoder: AudioEncoder.wav), path: audioFilePath); }

I have also tried RecordConfig(encoder: AudioEncoder.wav, autoGain: true, androidConfig: AndroidRecordConfig(useLegacy: true)) and changing the encoder to AAC, yet the same problem occurs

Note: Other android recording apps on this phone works fine

To Reproduce

Steps to reproduce the behavior:

  1. Create a new Recorder
  2. Create a new RecordingConfig
  3. Start recording with config
  4. Stop recording
  5. Try to listen to recorded file

Expected behavior

Recorded volume should be consistent

renancaraujo commented 1 day ago

Low volume on android is also a problem on my tests on two different devices (Samsung s21 ultra and Xperia 1 IV)