Opus
The OpusEncoder handles high-quality, low-latency VoIP audio encoding for the HoloMIT SDK.
Implementation Details
The encoder inherits from VoiceEncoder (and ultimately BaseWorker) and operates asynchronously using thread-safe queues. It pulls raw audio frames (FloatMemoryChunk) from an input queue, compresses them, and pushes the resulting ByteMemoryChunk to an output queue.
- Implementation: Wraps the
UnityOpuslibrary. - Configuration:
- Sampling Frequency:
16000 Hz - Channels:
Mono - Application:
VoIP - Bitrate:
96000 bps - Complexity:
10 - Signal Type:
Voice
- Sampling Frequency:
- Buffer Size: Fixed at 320 samples per frame.
Decoder (VoiceDecoder)
Instead of having a separate decoder class, the system uses a unified VoiceDecoder that handles Opus dynamically.
- When instantiated, it prepares a
UnityOpus.Decoder(16000Hz, Mono). - It reads the format from the first packet's metadata (
_chunk.Info.Dsi). - Because the incoming stream is Mono but Unity's spatial audio or multi-channel setups might require more, the decoder duplicates the decoded mono signal across 6 channels into the final
FloatMemoryChunkbefore queueing it for theAudioPreparer.