Skip to main content

RecordingConfig

@siteed/expo-audio-studio


@siteed/expo-audio-studio / RecordingConfig

Interface: RecordingConfig

Defined in: src/ExpoAudioStream.types.ts:378

Properties

android?

optional android: AndroidConfig

Defined in: src/ExpoAudioStream.types.ts:427

Android-specific configuration


autoResumeAfterInterruption?

optional autoResumeAfterInterruption: boolean

Defined in: src/ExpoAudioStream.types.ts:456

Whether to automatically resume recording after an interruption (default is false)


bufferDurationSeconds?

optional bufferDurationSeconds: number

Defined in: src/ExpoAudioStream.types.ts:486

Buffer duration in seconds. Controls the size of audio buffers used during recording. Smaller values reduce latency but increase CPU usage. Larger values improve efficiency but increase latency.

Platform Notes:

  • iOS/macOS: Minimum effective 0.1s, uses accumulation below
  • Android: Respects all sizes within hardware limits
  • Web: Fully configurable

Default: undefined (uses platform default ~23ms at 44.1kHz) Recommended: 0.01 - 0.5 seconds Optimal iOS: >= 0.1 seconds


channels?

optional channels: 1 | 2

Defined in: src/ExpoAudioStream.types.ts:383

Number of audio channels (1 for mono, 2 for stereo)


deviceDisconnectionBehavior?

optional deviceDisconnectionBehavior: DeviceDisconnectionBehaviorType

Defined in: src/ExpoAudioStream.types.ts:470

How to handle device disconnection during recording


deviceId?

optional deviceId: string

Defined in: src/ExpoAudioStream.types.ts:467

ID of the device to use for recording (if not specified, uses default)


enableProcessing?

optional enableProcessing: boolean

Defined in: src/ExpoAudioStream.types.ts:421

Enable audio processing (default is false)


encoding?

optional encoding: EncodingType

Defined in: src/ExpoAudioStream.types.ts:400

Encoding type for the recording.

Platform limitations:

  • pcm_8bit: Android only (iOS/Web will fallback to pcm_16bit with warning)
  • pcm_16bit: All platforms (recommended for cross-platform compatibility)
  • pcm_32bit: All platforms

The library will automatically validate and adjust the encoding based on platform capabilities. A warning will be logged if fallback is required.

Default

'pcm_16bit'

See


features?

optional features: AudioFeaturesOptions

Defined in: src/ExpoAudioStream.types.ts:436

Feature options to extract during audio processing


filename?

optional filename: string

Defined in: src/ExpoAudioStream.types.ts:464

Optional filename for the recording (uses UUID if not provided)


interval?

optional interval: number

Defined in: src/ExpoAudioStream.types.ts:403

Interval in milliseconds at which to emit recording data (minimum: 10ms)


intervalAnalysis?

optional intervalAnalysis: number

Defined in: src/ExpoAudioStream.types.ts:406

Interval in milliseconds at which to emit analysis data (minimum: 10ms)


ios?

optional ios: IOSConfig

Defined in: src/ExpoAudioStream.types.ts:424

iOS-specific configuration


keepAwake?

optional keepAwake: boolean

Defined in: src/ExpoAudioStream.types.ts:409

Keep the device awake while recording (default is false)


notification?

optional notification: NotificationConfig

Defined in: src/ExpoAudioStream.types.ts:418

Configuration for the notification


onAudioAnalysis()?

optional onAudioAnalysis: (_) => Promise<void>

Defined in: src/ExpoAudioStream.types.ts:442

Callback function to handle audio features extraction results

Parameters

_

AudioAnalysisEvent

Returns

Promise<void>


onAudioStream()?

optional onAudioStream: (_) => Promise<void>

Defined in: src/ExpoAudioStream.types.ts:439

Callback function to handle audio stream data

Parameters

_

AudioDataEvent

Returns

Promise<void>


onRecordingInterrupted()?

optional onRecordingInterrupted: (_) => void

Defined in: src/ExpoAudioStream.types.ts:459

Optional callback to handle recording interruptions

Parameters

_

RecordingInterruptionEvent

Returns

void


output?

optional output: OutputConfig

Defined in: src/ExpoAudioStream.types.ts:453

Configuration for audio output files

Examples:

  • Primary only (default): { primary: { enabled: true } }
  • Compressed only: { primary: { enabled: false }, compressed: { enabled: true, format: 'aac' } }
  • Both outputs: { compressed: { enabled: true } }
  • Streaming only: { primary: { enabled: false } }

outputDirectory?

optional outputDirectory: string

Defined in: src/ExpoAudioStream.types.ts:462

Optional directory path where output files will be saved


sampleRate?

optional sampleRate: SampleRate

Defined in: src/ExpoAudioStream.types.ts:380

Sample rate for recording in Hz (16000, 44100, or 48000)


segmentDurationMs?

optional segmentDurationMs: number

Defined in: src/ExpoAudioStream.types.ts:433

Duration of each segment in milliseconds for analysis (default: 100)


showNotification?

optional showNotification: boolean

Defined in: src/ExpoAudioStream.types.ts:412

Show a notification during recording (default is false)


showWaveformInNotification?

optional showWaveformInNotification: boolean

Defined in: src/ExpoAudioStream.types.ts:415

Show waveform in the notification (Android only, when showNotification is true)


web?

optional web: WebConfig

Defined in: src/ExpoAudioStream.types.ts:430

Web-specific configuration options