Skip to main content
Overview > Inworld Audio Module Class: InworldAudioModule | Inherits from: MonoBehaviour Abstract base class for all audio processing modules in the Inworld framework. Provides common functionality for audio modules including coroutine management and audio manager access. All audio modules should inherit from this class to integrate with the audio processing pipeline.

Properties

Methods


Audio Processing Pipeline

The InworldAudioModule interfaces are called in a specific order during audio processing:
  1. Pre-Processing: OnPreProcessAudio() is called first
  2. Collection: OnCollectAudio() gathers audio data from the input buffer
  3. Post-Processing: OnPostProcessAudio() processes the collected data
  4. Voice Detection: Voice detection runs continuously when enabled
  5. Audio Sending: Audio data is sent when the player is speaking
This pipeline runs continuously in the audio coroutine managed by the InworldAudioManager.

Constants

The base class defines several audio processing constants:
  • k_InputSampleRate (16000) - Standard sample rate for audio input
  • k_InputChannels (1) - Number of audio channels (mono)
  • k_InputBufferSecond (1) - Buffer duration in seconds
  • k_SizeofInt16 (2) - Size of 16-bit integer in bytes

Interfaces

The InworldAudioModule system uses several interfaces that define different aspects of audio processing. These interfaces are implemented by child classes and called by the InworldAudioManager at specific times:

IMicrophoneHandler

Handles microphone recording functionality. Methods:

ICollectAudioHandler

Handles audio data collection from the input buffer. Methods:

IPlayerAudioEventHandler

Handles voice detection and player audio events. Methods:

ICalibrateAudioHandler

Handles audio calibration functionality. Methods:

IProcessAudioHandler

Handles audio pre-processing and post-processing. Methods:

ISendAudioHandler

Handles sending audio data to external services. Methods:

Reference

Priority

Gets or sets the execution priority of this audio module. Lower values indicate higher priority and will be processed first.

Returns

Type: int

Audio

Gets the InworldAudioManager instance that coordinates audio processing. Automatically finds and caches the audio manager in the scene if not already set.

Returns

Type: InworldAudioManager

StartModule

Starts the module’s processing coroutine. Only one coroutine can be active per module at a time.

Parameters

ParameterTypeDescription
moduleCycleIEnumeratorThe coroutine to start for this module’s processing cycle.

Returns

Type: void

StopModule

Stops the currently running module coroutine and cleans up resources. Safe to call even if no coroutine is currently running.

Returns

Type: void