hyochan / react-native-audio-recorder-player

react-native native module for audio recorder and player.
MIT License
713 stars 213 forks source link

All Audio file rejected process #635

Open Rbkyada opened 1 week ago

Rbkyada commented 1 week ago

Issue with Recorder Audio Failing for Speech-to-Text Models Version of react-native-audio-recorder-player: 3.6.11

Version of React Native: ^0.73.5

Platforms affected: Both iOS and Android

Expected Behavior I expected to record audio using the react-native-audio-recorder-player package and use the generated .wav file as input for speech-to-text models without issues.

Actual Behavior The audio files generated by the react-native-audio-recorder-player consistently fail when uploaded to speech-to-text AI models. I've tested multiple services, and they all reject the .wav files created by this package.

code option: AudioSourceAndroid: AudioSourceAndroidType.MIC, OutputFormatAndroid: OutputFormatAndroidType.DEFAULT, AudioEncoderAndroid: AudioEncoderAndroidType.AMR_NB, AudioSamplingRateAndroid: 44100, AudioChannelsAndroid: 2, AudioEncodingBitRateAndroid: 128000, AVSampleRateKeyIOS: 44100, AVFormatIDKeyIOS: AVEncodingOption.wav,

Steps to Reproduce

  1. Record an audio file using react-native-audio-recorder-player.
  2. Attempt to upload the resulting .wav file to any speech-to-text model.
  3. Observe that the upload or processing fails. 2024-10-02 21 20 43
tjlondon-npauctions commented 1 week ago

Try it without passing any settings at all, and don't pass an audioPath and let it generate its own file and file extension and see what comes out and upload that. Then work backwards from there adding in each of your settings.

I think this is more likely to do with the bitrate and encoding settings rather than the package.

Sorry, I'm no expert on audio codecs but I use this just fine with AssemblyAI, Gladia and Deepgram. I'm using AAC, MP3 and M4A on iOS. Just my advice, I find WAVs way too big. You generally don't need an uncompressed lossless format for transcribing speech.