Skip to content

API Audio

Lu-Fi edited this page Oct 27, 2026 · 2 revisions

API reference: Audio (AI, AO, AENC, ADEC)

Four groups of calls: AI records from the microphone, AO plays to the speaker, AENC encodes PCM frames (G.711, G.726, IMA ADPCM or a codec registered by the application), ADEC decodes such streams back to PCM. AI and AO work on a device (the codec) and one channel on it; recording is polled frame by frame.

Typical recording order: AI_SetPubAttr, AI_Enable, AI_EnableChn, optional AI_SetVol / AI_SetGain, then loop on AI_PollingFrame, AI_GetFrame, AI_ReleaseFrame. Shut down with AI_DisableChn, AI_Disable. Playback: AO_SetPubAttr, AO_Enable, AO_EnableChn, AO_SendFrame in a loop, AO_FlushChnBuf to play out what is queued, AO_DisableChn, AO_Disable. Frame length must be a whole number of 10 ms blocks for echo cancellation (numPerFrm of 80 or 160 samples at 8 or 16 kHz).

Limits and conventions in OpenIMP: AI accepts devices 0 and 1 and channel 0, AO device 0 and channel 0. Attributes can only be set while the device is disabled. The sample format is 16-bit PCM. Noise suppression, AGC, high-pass filter and howling suppression use an audio processing library that is loaded at run time (libaudioProcess); the enable calls return -1 when it is not installed. Echo cancellation is OpenIMP's own (an AECM from WebRTC) and needs no extra library. Calls fail with -1 on errors; the codec driver is the ordinary /dev/dsp device.

T10 to T31 versus T40 and T41: AI/AO volume is a software gain on T10 to T31 (the value is applied to the samples); T40 and T41 program the codec register instead, with a conversion from the IMP scale. On T40 and T41 there are a few more calls (digital gain, raw capture, codec select).

Audio output tests on cameras in the OpenIMP test fleet are silence-only; the play path was verified with zero-valued frames, not with audible sound.

Status columns: T10 T20 T21 T23 T30 T31 T40 T41. As of 2026-10-26. Part of the API reference.

Contents

Status symbols are those of the feature matrix (API coverage tables):

  • ✅ works, device-tested
  • ✅+ works, device-tested, better than the vendor
  • ✅rt API round trip on device, no visible effect expected
  • ✅r works: called by the streamer on fleet cameras of this SoC that passed the fleet soak
  • ✅○ vendor no-op, OpenIMP matches that
  • 🔧h implemented, host tests only (no camera run yet)
  • 🔧a really connected per static audit, no device test tracked
  • 🔧+ API round trip in QEMU, no camera
  • ⚠c value only stored and read back, nothing applied
  • ⚠s returns 0 without any effect
  • ❌e exported but fails or has a known defect
  • ❌ not exported by OpenIMP
  • · function does not exist on this SoC (not in that SoC's vendor API; not a gap)
  • ? state not determined
  • 📋 no OpenIMP build for this SoC yet (planned)

AI device and channel

IMP_AI_Get/SetPubAttr

int IMP_AI_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
int IMP_AI_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr);

Sets or reads the capture format (sample rate, bit width, sound mode, frame length numPerFrm, number of buffers).

Parameters

  • devID: Audio device, 0 or 1.
  • attr: Format. Mono 16-bit is the supported case; AEC needs mono.

Returns: -1 for an invalid device, a NULL or unsupported attribute, or when the device is already enabled (Set).

Set it before AI_Enable.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

See also: IMP_AI_Enable

IMP_AI_Enable

int IMP_AI_Enable(int audioDevId);

Opens the sound device for recording and programs the format into the codec driver.

Returns: 0 on success and when already enabled; -1 for an invalid device, when /dev/dsp cannot be opened or the driver refuses the format.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

See also: IMP_AI_EnableChn, IMP_AI_Disable

IMP_AI_Disable

int IMP_AI_Disable(int audioDevId);

Stops capture, closes the sound device and drops AEC state.

Returns: 0 on success, -1 for an invalid device.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_EnableChn

int IMP_AI_EnableChn(int audioDevId, int aiChn);

Starts the capture thread; captured audio collects in a queue until GetFrame takes it.

Returns: -1 for an invalid device or channel, or when AI_Enable was not called.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_DisableChn

int IMP_AI_DisableChn(int audioDevId, int aiChn);

Stops the capture thread and clears the queue.

Returns: -1 for an invalid device or channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_Get/SetChnParam

int IMP_AI_GetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *attr);
int IMP_AI_SetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *attr);

Stores or reads the channel parameter structure.

Returns: -1 for an invalid device or channel or a NULL pointer.

OpenIMP only keeps the values (usrFrmDepth does not change the capture queue).

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

AI frames

IMP_AI_PollingFrame

int IMP_AI_PollingFrame(int audioDevId, int aiChn, uint32_t timeoutMs);

Waits until one complete frame is available.

Parameters

  • timeout_ms: Maximum wait in milliseconds.

Returns: 0 when a frame is ready, -1 on timeout, when the channel is not running, or while a frame obtained earlier has not been released.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

See also: IMP_AI_GetFrame

IMP_AI_GetFrame

int IMP_AI_GetFrame(int audioDevId, int aiChn, IMPAudioFrame *frame, IMPBlock block);

Takes the oldest frame out of the queue and runs echo cancellation, effects and volume on it.

Parameters

  • frame: Receives length, timestamp, sequence number and a pointer to the data.
  • block: BLOCK waits for a full frame, NOBLOCK fails at once when there is none.

Returns: 0 on success, -1 when no frame is available, the channel is not running, a frame is still outstanding, or the arguments are invalid.

Only one frame may be outstanding; release it before the next call. The timestamp marks the end of the captured block and never goes backwards.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

See also: IMP_AI_ReleaseFrame

IMP_AI_ReleaseFrame

int IMP_AI_ReleaseFrame(int audioDevId, int aiChn, IMPAudioFrame *frame);

Gives the frame back.

Returns: -1 when no frame is outstanding or the pointer is not the one handed out.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

AI volume and gain

Volume is on a scale of half decibels from -30 (mute) to 120, 60 meaning unity. Gain is the analog gain of the codec, 0 to 31.

IMP_AI_Get/SetVol

int IMP_AI_GetVol(int audioDevId, int aiChn, int *vol);
int IMP_AI_SetVol(int audioDevId, int aiChn, int vol);

Software volume of the recorded signal, half decibels, -30 (mute) to 120, 60 = unity.

Returns: -1 for an invalid device or channel or (T10 to T31 Set) a value outside the range. T40 and T41 clamp the value.

T10 to T31 apply the value to the samples in AI_GetFrame. T40 and T41 convert it to the codec register (0 dB = register value 195), so it acts in the codec; Get answers the value stored by the last Set on T40, the register value converted back on T41.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_Get/SetGain

int IMP_AI_GetGain(int audioDevId, int aiChn, int *gain);
int IMP_AI_SetGain(int audioDevId, int aiChn, int gain);

Analog gain of the microphone input, 0 to 31.

Returns: -1 for an invalid device or channel, or when the codec ioctl fails (T10 to T31, T41). T40 clamps the value and does not report a failing codec.

Takes effect on the codec at once if the device is enabled, otherwise it is kept.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_Get/SetAlcGain

int IMP_AI_GetAlcGain(int audioDevId, int aiChn, int *gain);
int IMP_AI_SetAlcGain(int audioDevId, int aiChn, int gain);

ALC gain; in OpenIMP the same hardware setting as SetGain (the value is kept separately for GetAlcGain).

Returns: 0 on success, non-zero on error (mostly -1; T40 and T41 return their own error codes for some failures).

SoC: only in the vendor API of T21, T31

T10 T20 T21 T23 T30 T31 T40 T41
· · ✅ · · ✅ · ·

Used by: timps.

IMP_AI_SetVolMute

int IMP_AI_SetVolMute(int audioDevId, int aiChn, int mute);

Mutes or unmutes the recording.

Parameters

  • mute: 1 mutes, 0 unmutes.

Returns: -1 for an invalid device or channel; T40 and T41 also for other mute values.

Software mute, the codec is not touched; captured frames are silent while muted.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_AI_Get/SetDigitalGain

/* IMP_AI_GetDigitalGain: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */
/* IMP_AI_SetDigitalGain: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Digital gain as the raw codec register (0 to 255, 0.5 dB steps).

Returns: -1 for an invalid device or channel or NULL; out of range values are clamped.

It uses the same register as AI_SetVol; the call made last wins. A failing codec ioctl is logged only.

SoC: Only on T40 and T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · ✅ ✅

AI effects

Noise suppression, AGC, high-pass filter and howling suppression run on every captured frame before it is handed out, in the order echo cancellation, effects, volume.

IMP_AI_EnableHpf

int IMP_AI_EnableHpf(IMPAudioIOAttr *attr);

Switches on a high-pass filter on the microphone signal; it removes rumble below the cut-off frequency.

Parameters

  • attr: The capture format (sample rate is used for the filter design).

Returns: -1 when the audio processing library is missing, the attribute is invalid, or the cut-off frequency is not below the sample rate.

Set the cut-off with AI_SetHpfCoFrequency first; with 0 a default is used (300 Hz class at 16 kHz).

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_DisableHpf

int IMP_AI_DisableHpf(void);

Switches the filter off.

Returns: 0.0

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_SetHpfCoFrequency

int IMP_AI_SetHpfCoFrequency(int freq);

Stores the cut-off frequency in Hz that the next EnableHpf uses.

Returns: 0.0

It does not change a filter that is already running; call DisableHpf and EnableHpf again.

SoC: only in the vendor API of T23, T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · ✅ ✅ ✅

Used by: prudynt, raptor.

IMP_AI_EnableNs

int IMP_AI_EnableNs(IMPAudioIOAttr *attr, int level);

Switches on noise suppression.

Parameters

  • attr: The capture format.
  • mode: Strength, 0 (low) to 4; values outside are refused.

Returns: -1 for an invalid attribute or mode or when the audio processing library is missing.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_DisableNs

int IMP_AI_DisableNs(void);

Switches noise suppression off.

Returns: 0.0

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_EnableAgc

int IMP_AI_EnableAgc(IMPAudioIOAttr *attr, IMPAudioAgcConfig config);

Switches on automatic gain control with a target level and a compression gain.

Parameters

  • attr: The capture format.
  • agcConfig: TargetLevelDbfs and CompressionGaindB.

Returns: -1 for an invalid attribute or when the audio processing library is missing.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_DisableAgc

int IMP_AI_DisableAgc(void);

Switches AGC off.

Returns: 0.0

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_AI_SetAgcMode

int IMP_AI_SetAgcMode(int mode);

Chooses the AGC mode (1 to 3, anything else becomes 2) used by the next EnableAgc.

Returns: 0.0

SoC: only in the vendor API of T31

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ · ·

Echo cancellation

The AEC compares the microphone with what the speaker played. The driver records the playback next to the microphone; OpenIMP's AECM works on 10 ms blocks of mono samples at 8 or 16 kHz and removes the echo in AI_GetFrame. AEC is a software step in the capture path; it can only be judged with a playing speaker.

IMP_AI_GetFrameAndRef

int IMP_AI_GetFrameAndRef(int audioDevId, int aiChn, IMPAudioFrame *frame, IMPAudioFrame *ref, IMPBlock block);

Like GetFrame, additionally returns the playback reference frame that belongs to the captured block (all zero when no reference was recorded).

Parameters

  • reference: Receives the reference frame.

Returns: Same as AI_GetFrame.

Needs AI_EnableAecRefFrame first. The application can then run its own echo canceller.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅rt ? ✅rt ✅rt ✅rt

Used by: raptor.

IMP_AI_EnableAec

int IMP_AI_EnableAec(int aiDevId, int aiChn, int aoDevId, int aoChn);

Starts echo cancellation of the microphone against the speaker playback.

Parameters

  • aiDevId, aiChn: Microphone device and channel 0.
  • aoDevId, aoChn: Speaker device and channel 0.

Returns: 0 on success and when already running. -1 when the AI device is not enabled, the capture is not mono, the sample rate is not 8000 or 16000, numPerFrm is not a multiple of 10 ms, or the driver cannot supply the playback reference.

Enable the AI device (and the AO device whose playback is to be cancelled) first. The delay between microphone and reference that the driver reports is applied automatically.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅rt ✅rt

Used by: raptor, timps.

Difference from the vendor library: The cancellation is OpenIMP's own (WebRTC AECM) running on the playback reference the codec driver records next to the microphone. It does not need the vendor AEC library.

See also: IMP_AI_DisableAec

IMP_AI_DisableAec

int IMP_AI_DisableAec(int aiDevId, int aiChn);

Stops echo cancellation and, if nobody uses reference frames, the driver's playback recording.

Returns: -1 for an invalid device or channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅rt ? ✅rt ✅rt ✅rt

Used by: raptor, timps.

IMP_AI_EnableAecRefFrame

int IMP_AI_EnableAecRefFrame(int aiDevId, int aiChn, int aoDevId, int aoChn);

Lets the application receive the playback reference frame with AI_GetFrameAndRef (to run its own canceller).

Returns: -1 for invalid arguments or when the driver does not enable the reference.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅rt ? ✅rt ✅rt ✅rt

Used by: raptor.

IMP_AI_DisableAecRefFrame

int IMP_AI_DisableAecRefFrame(int aiDevId, int aiChn, int aoDevId, int aoChn);

Stops delivering reference frames.

Returns: -1 for invalid arguments.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅rt ? ✅rt ✅rt ✅rt

Used by: raptor.

AO device and channel

IMP_AO_Get/SetPubAttr

int IMP_AO_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
int IMP_AO_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr);

Sets or reads the playback format.

Returns: -1 for a device other than 0, a NULL or unsupported attribute, or when the device is enabled (Set).

Set it before AO_Enable. numPerFrm times the channel count sets the size of a write block to the driver; it is rounded down to the driver fragment.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: prudynt, raptor, timps.

IMP_AO_Enable

int IMP_AO_Enable(int audioDevId);

Opens the sound device for playback and programs the format.

Returns: 0 on success and when already enabled; -1 when /dev/dsp cannot be opened, the driver refuses the format or the block size is unusable.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅rt ✅rt

Used by: prudynt, raptor, timps.

IMP_AO_Disable

int IMP_AO_Disable(int audioDevId);

Plays out what the cache still holds, then stops and closes the device.

Returns: 0 on success, -1 for a device other than 0.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: prudynt, raptor, timps.

IMP_AO_EnableChn

int IMP_AO_EnableChn(int audioDevId, int aoChn);

Opens the channel for SendFrame.

Returns: -1 for an invalid device or channel or when AO_Enable was not called.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅rt ✅rt

Used by: prudynt, raptor, timps.

IMP_AO_DisableChn

int IMP_AO_DisableChn(int audioDevId, int aoChn);

Closes the channel, writing out cached data first.

Returns: -1 for an invalid device or channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: prudynt, raptor, timps.

AO playback

IMP_AO_SendFrame

int IMP_AO_SendFrame(int audioDevId, int aoChn, IMPAudioFrame *frame, IMPBlock block);

Queues PCM to the speaker. The data is collected into driver-sized blocks and written in the calling thread.

Parameters

  • frame: PCM data and length.
  • block: Ignored; the call returns when the data has been handed to the driver.

Returns: -1 for invalid arguments, a channel that is not enabled, a paused channel or a driver write error.

On T10 to T31 volume, mute and the high-pass/AGC effects are applied to each block in software. A partial block stays queued until more data arrives; use FlushChnBuf to play it out.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅rt ✅rt

Used by: prudynt, raptor, timps.

See also: IMP_AO_FlushChnBuf

IMP_AO_ClearChnBuf

int IMP_AO_ClearChnBuf(int audioDevId, int aoChn);

Throws away audio that has been queued but not played.

Returns: -1 for invalid arguments, a device that is not open, or a failing driver call.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor, timps.

IMP_AO_FlushChnBuf

int IMP_AO_FlushChnBuf(int audioDevId, int aoChn);

Pads the pending partial block with silence, writes everything held, and waits until the driver has played it.

Returns: -1 for invalid arguments, a device that is not open, or a failing driver call.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: prudynt, raptor, timps.

IMP_AO_PauseChn

int IMP_AO_PauseChn(int audioDevId, int aoChn);

Pauses playback; SendFrame fails with -1 while paused.

Returns: -1 for invalid arguments.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

IMP_AO_ResumeChn

int IMP_AO_ResumeChn(int audioDevId, int aoChn);

Resumes a paused channel.

Returns: -1 for invalid arguments.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

IMP_AO_QueryChnStat

int IMP_AO_QueryChnStat(int audioDevId, int aoChn, IMPAudioOChnState *stat);

Reports the buffer count (chnTotalNum, chnFreeNum). In OpenIMP both equal the configured frmNum; busy is always 0.

Returns: -1 for invalid arguments.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

Difference from the vendor library: The numbers are constant. Do not use the call to find out how much audio is still queued.

IMP_AO_CacheSwitch

int IMP_AO_CacheSwitch(int audioDevId, int aoChn, int enable);

Switches the play cache. With the cache on, the first data is held until two blocks are collected, so a late next frame does not cause stutter.

Parameters

  • enable: Non-zero on, 0 off.

Returns: -1 for invalid arguments or a failing driver write while releasing held data; 0 when the device is not yet open.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

Difference from the vendor library: The vendor default is on. In OpenIMP the default is off (set the environment variable OPENIMP_AO_CACHE=1 for the vendor default) because there is no play thread; turning the cache off writes out held data.

AO volume and gain

IMP_AO_Get/SetVol

int IMP_AO_GetVol(int audioDevId, int aoChn, int *vol);
int IMP_AO_SetVol(int audioDevId, int aoChn, int vol);

Playback volume, half decibels, -30 (mute) to 120, 60 = unity.

Returns: -1 for an invalid device or channel or (T10 to T31) a value outside the range.

T10 to T31 apply the value to the samples before the driver write. T40 and T41 convert it to the DAC register (0 dB = 241).

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: prudynt, raptor, timps.

IMP_AO_Get/SetGain

int IMP_AO_GetGain(int audioDevId, int aoChn, int *gain);
int IMP_AO_SetGain(int audioDevId, int aoChn, int gain);

Analog gain of the speaker output, 0 to 31.

Returns: -1 for an invalid device or channel, a value outside 0 to 31 (T10 to T31) or a failing codec ioctl.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: prudynt, raptor, timps.

IMP_AO_SetVolMute

int IMP_AO_SetVolMute(int audioDevId, int aoChn, int mute);

Mutes or unmutes the playback in software; while muted SendFrame plays silence of the same length.

Returns: -1 for invalid arguments; T40 and T41 also for mute values other than 0 and 1.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: prudynt, raptor.

IMP_AO_Soft_Mute

int IMP_AO_Soft_Mute(int audioDevId, int aoChn);

Same as AO_SetVolMute(…, 1).

Returns: As AO_SetVolMute.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

IMP_AO_Soft_UNMute

int IMP_AO_Soft_UNMute(int audioDevId, int aoChn);

Same as AO_SetVolMute(…, 0).

Returns: As AO_SetVolMute.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

IMP_AO_Get/SetDigitalGain

/* IMP_AO_GetDigitalGain: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */
/* IMP_AO_SetDigitalGain: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Digital gain as the raw DAC register (0 to 255, 0.5 dB steps).

Returns: -1 for an invalid device or channel, NULL, or an AO device that is not enabled; out of range values are clamped.

Same register as AO_SetVol; the call made last wins.

SoC: Only on T40 and T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · ✅rt ✅rt

AO effects

IMP_AO_EnableHpf

int IMP_AO_EnableHpf(IMPAudioIOAttr *attr);

Switches on a high-pass filter on the playback signal.

Returns: -1 when the audio processing library is missing, the attribute is invalid, or twice the cut-off frequency is not below the sample rate.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

IMP_AO_DisableHpf

int IMP_AO_DisableHpf(void);

Switches the filter off.

Returns: 0.0

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

IMP_AO_SetHpfCoFrequency

int IMP_AO_SetHpfCoFrequency(int freq);

Stores the cut-off frequency for the next AO_EnableHpf.

Returns: -1 for a negative value.

SoC: only in the vendor API of T23, T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · ✅rt ✅rt ✅rt

Used by: prudynt, raptor.

IMP_AO_EnableAgc

int IMP_AO_EnableAgc(IMPAudioIOAttr *attr, IMPAudioAgcConfig config);

Switches on automatic gain control of the playback signal.

Returns: -1 for an invalid attribute or when the audio processing library is missing.

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

IMP_AO_DisableAgc

int IMP_AO_DisableAgc(void);

Switches AGC off.

Returns: 0.0

T10 T20 T21 T23 T30 T31 T40 T41
✅rt ✅rt ✅rt ✅ ? ✅rt ✅rt ✅rt

Used by: raptor.

Profile-driven effects, debug hooks, extras

IMP_AI_Set_WebrtcProfileIni_Path

int IMP_AI_Set_WebrtcProfileIni_Path(char *path);

Sets the directory of the profile file webrtc_profile.ini that AI_EnableAlgo and AO_EnableAlgo read.

Returns: -1 for a NULL or too long path.

SoC: Only on T23, T31, T40 and T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · ✅ ✅ ✅

Used by: raptor.

IMP_AI_EnableGetRaw

/* IMP_AI_EnableGetRaw: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Allows AI_GetFrameAndRaw to deliver the capture before echo cancellation and effects.

Returns: -1 for an invalid device or channel.

SoC: Only on T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · ✅

IMP_AI_DisableGetRaw

/* IMP_AI_DisableGetRaw: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Switches raw delivery off again.

Returns: -1 for an invalid device or channel.

SoC: Only on T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · ✅

IMP_AI_GetFrameAndRaw

/* IMP_AI_GetFrameAndRaw: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Returns the processed frame and the unprocessed capture of the same block.

Returns: -1 when the device or channel is not running, a pointer is NULL, or AI_EnableGetRaw was not called.

One AI_ReleaseFrame of the first frame releases both.

SoC: Only on T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · ✅

IMP_AI_EnableAlgo

/* IMP_AI_EnableAlgo: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Reads the profile file webrtc_profile.ini and switches on noise suppression, AGC and the high-pass filter of the microphone as the file says.

Returns: 0, also when the file is missing (nothing is switched on then); -1 for a device other than 0 or 1, a channel above 0, or when the device attributes cannot be read. A failing noise suppression or AGC start is only logged; a failing high-pass filter start returns -1.

The file is looked up in the directory set with AI_Set_WebrtcProfileIni_Path (a path ending in .ini is used as the file itself), default /etc/webrtc_profile.ini. Section NS_AI (NS_enable = true, set_level = kLow, kModerate, kHigh or kVeryHigh, default kHigh), section AGC_AI (AGC_enable, set_mode, set_target_level_dbfs, set_compression_gain_db) and section HP_AI (HP_enable, cofrequency, default 400) turn on the matching effect with the public AI_Enable* calls. AI_DisableAlgo switches the three effects off again.

SoC: Only on T23 and T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ✅

IMP_AI_DisableAlgo

/* IMP_AI_DisableAlgo: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Switches high-pass filter, noise suppression and AGC off.

Returns: -1 for an invalid device or channel.

SoC: Only on T23 and T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ✅

IMP_AI_EnableHs

/* IMP_AI_EnableHs: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Switches on howling suppression, run on every captured frame ahead of the other effects.

Returns: -1 when the audio processing library is not available.

SoC: Only on T23, T40 and T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · ✅ ✅

IMP_AI_DisableHs

/* IMP_AI_DisableHs: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Switches howling suppression off.

Returns: 0.0

SoC: Only on T23, T40 and T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · ✅ ✅

IMP_AI_IMPDBG_Init

/* IMP_AI_IMPDBG_Init: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Debug server hook of the vendor library. OpenIMP has no debug server, so the call succeeds and does nothing.

Returns: 0.0

IMP_AI_IMPDBG_DeInit

/* IMP_AI_IMPDBG_DeInit: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Debug server hook of the vendor library. OpenIMP has no debug server, so the call succeeds and does nothing.

Returns: 0.0

IMP_AO_IMPDBG_Init

/* IMP_AO_IMPDBG_Init: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Debug server hook of the vendor library. OpenIMP has no debug server, so the call succeeds and does nothing.

Returns: 0.0

IMP_AO_IMPDBG_DeInit

/* IMP_AO_IMPDBG_DeInit: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Debug server hook of the vendor library. OpenIMP has no debug server, so the call succeeds and does nothing.

Returns: 0.0

IMP_AO_EnableAlgo

/* IMP_AO_EnableAlgo: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Reads the profile file webrtc_profile.ini and enables the AGC and the high-pass filter of the playback as the file says.

Returns: 0, also when the file is missing; -1 for a device or channel other than 0 or when the device attributes cannot be read. A failing AGC start is only logged; a failing high-pass filter start returns -1.

Same file lookup as AI_EnableAlgo. Section AGC_AO (AGC_enable, set_mode, set_target_level_dbfs, set_compression_gain_db) and section HP_AO (HP_enable, cofrequency, default 400). The playback keeps its own AGC mode. AO_DisableAlgo switches both off.

SoC: Only on T23 and T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ✅rt

IMP_AO_DisableAlgo

/* IMP_AO_DisableAlgo: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Switches the playback filter and AGC off.

Returns: -1 for an invalid device or channel.

SoC: Only on T23 and T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ✅rt

IMP_Audio_Select_Codec

/* IMP_Audio_Select_Codec: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Selects the internal or the external codec (SELECT_INTERNAL 0, SELECT_EXTERNAL 1) of the audio driver.

Parameters

  • codec: 0 or 1.

Returns: -1 for an invalid device or channel, a device or channel that is not running, or a driver error.

SoC: Only on T41.

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · 🔧h

Audio encoder (AENC)

Six channels. The work is done synchronously: SendFrame runs the codec in the calling thread and queues the result, GetStream takes it, ReleaseStream gives the buffer back. Built-in codecs are slots 0 to 5 (G.711 A-law, G.711 mu-law, G.726, IMA ADPCM; PCM and AEC types are not built in); slots 6 to 10 take codecs registered with RegisterEncoder. The returned handle is used as type of the channel attribute.

IMP_AENC_RegisterEncoder

int IMP_AENC_RegisterEncoder(int *handle, IMPAudioEncEncoder *encoder);

Registers a codec of the application and returns its slot (6 to 10).

Parameters

  • handle: Receives the slot.
  • encoder: Callbacks and maximum frame length of the codec.

Returns: -1 for NULL or when all user slots are in use.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_AENC_UnRegisterEncoder

int IMP_AENC_UnRegisterEncoder(int *handle);

Frees a user slot.

Returns: -1 for a built-in or out of range slot.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_AENC_CreateChn

int IMP_AENC_CreateChn(int aeChn, IMPAudioEncChnAttr *attr);

Creates one of the six encoder channels for a codec type with bufSize buffers.

Returns: -1 for a bad channel number, an unregistered type, a channel that exists, or no memory.

The buffer size follows the AI frame size (800 bytes when AI has no attributes yet); user codecs get at least 8 KiB of output room.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_AENC_DestroyChn

int IMP_AENC_DestroyChn(int aeChn);

Frees the channel.

Returns: -1 for an invalid or not created channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_AENC_SendFrame

int IMP_AENC_SendFrame(int aeChn, IMPAudioFrame *frame);

Encodes one PCM frame in the calling thread and queues the result.

Returns: -1 for an invalid channel, NULL or when no free buffer is available.

Release streams with ReleaseStream, otherwise the buffers run out. User codecs get NULL as their instance pointer, as in the vendor library.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_AENC_PollingStream

int IMP_AENC_PollingStream(int aeChn, unsigned int timeoutMs);

Waits until an encoded stream is available.

Returns: -1 on timeout or for an invalid channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_AENC_GetStream

int IMP_AENC_GetStream(int aeChn, IMPAudioStream *stream, IMPBlock block);

Takes the oldest encoded frame.

Parameters

  • block: BLOCK waits, NOBLOCK returns at once.

Returns: -1 when nothing is queued and NOBLOCK is used (the vendor library returns 0 with an untouched stream there), or for invalid arguments.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_AENC_ReleaseStream

int IMP_AENC_ReleaseStream(int aeChn, IMPAudioStream *stream);

Gives the encoded buffer back.

Returns: -1 for an invalid channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

Audio decoder (ADEC)

Mirror of the encoder with the same slot scheme; SendStream decodes in the calling thread.

IMP_ADEC_RegisterDecoder

int IMP_ADEC_RegisterDecoder(int *handle, IMPAudioDecDecoder *decoder);

Registers a decoder of the application and returns its slot (6 to 10).

Returns: -1 for NULL or when all user slots are in use.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_ADEC_UnRegisterDecoder

int IMP_ADEC_UnRegisterDecoder(int *handle);

Frees a user slot.

Returns: -1 for a built-in or out of range slot.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_ADEC_CreateChn

int IMP_ADEC_CreateChn(int adChn, IMPAudioDecChnAttr *attr);

Creates one of the six decoder channels.

Returns: -1 for a bad channel number, unregistered type, existing channel or no memory.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_ADEC_DestroyChn

int IMP_ADEC_DestroyChn(int adChn);

Frees the channel.

Returns: -1 for an invalid or not created channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_ADEC_SendStream

int IMP_ADEC_SendStream(int adChn, IMPAudioStream *stream, IMPBlock block);

Decodes a stream chunk in the calling thread and queues the PCM.

Parameters

  • block: Ignored, the call always waits for a free buffer.

Returns: -1 for an invalid channel, NULL, or when no buffer is available.

The built-in decoders never write beyond their buffer.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_ADEC_PollingStream

int IMP_ADEC_PollingStream(int adChn, unsigned int timeoutMs);

Waits until decoded PCM is available.

Returns: -1 on timeout or for an invalid channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_ADEC_GetStream

int IMP_ADEC_GetStream(int adChn, IMPAudioStream *stream, IMPBlock block);

Takes the oldest decoded block.

Returns: -1 when nothing is queued and NOBLOCK is used, or for invalid arguments.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_ADEC_ReleaseStream

int IMP_ADEC_ReleaseStream(int adChn, IMPAudioStream *stream);

Gives the decoded buffer back.

Returns: -1 for an invalid channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_ADEC_ClearChnBuf

int IMP_ADEC_ClearChnBuf(int adChn);

Drops all decoded blocks that have not been taken.

Returns: -1 for an invalid or not created channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

Clone this wiki locally