Audio Recording Format

Please provide the following:

  1. SDK Version:47.0
  2. Platforms(Android/iOS/web/all):Android

Hi I was having some trouble where when I was using expo-av and medialibrary to save recorded audio files to the shared folder, the audio was being saved as video files. So I wanted to change the format but it wasnt obvious how to do that so I’ll drop a short snippet here describing it:

   const recordOptions = {
        android: {
          extension: '.m4a',
          outputFormat: Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4,
          audioEncoder: Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC,
          sampleRate: 44100,
          numberOfChannels: 2,
          bitRate: 128000,
        },
        ios: {
          extension: '.wav',
          audioQuality: Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_HIGH,
          sampleRate: 8000,
          numberOfChannels: 1,
          linearPCMBitDepth: 16,
          linearPCMIsBigEndian: false,
          linearPCMIsFloat: true,
        },
      };
      await AudioRecorder.current.prepareToRecordAsync(
       // Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY
       recordOptions
      );

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.