### Minimal Import Example Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md Instantiate core classes like JitterBuffer, Preprocessor, and EchoCanceler with minimal setup. ```csharp using SpeexDSPSharp.Core; var jitter = new SpeexDSPJitterBuffer(1); var preprocessor = new SpeexDSPPreprocessor(960, 48000); var echo = new SpeexDSPEchoCanceler(960, 9600); ``` -------------------------------- ### SpeexDSPJitterBuffer Put and Get Example Source: https://github.com/avionblock/speexdspsharp/blob/main/docs/examples/SpeexDSPJitterBuffer.md Demonstrates how to initialize a SpeexJitterBuffer, put audio data into it, and then retrieve data, simulating packet loss. ```csharp using SpeexDSPSharp.Core; using SpeexDSPSharp.Core.Structures; var jitter = new SpeexJitterBuffer(); var inputData = new byte[960]; for(byte i = 0; i < 25; i++) { inputData[i] = (byte)Random.Shared.Next(byte.MinValue, byte.MaxValue); Console.WriteLine($"Input: {inputData[i]}"); } jitter.Put(inputData); Console.WriteLine(); jitter.Get(); //Found Packet jitter.Get(); //Missing Packet public class SpeexJitterBuffer { private readonly SpeexDSPJitterBuffer buffer = new SpeexDSPJitterBuffer(1); private uint timestamp = 1; public void Get() { var data = new byte[960]; var outPacket = new SpeexDSPJitterBufferPacket(data, (uint)data.Length); int temp = 0; if (buffer.Get(ref outPacket, 1, ref temp) != JitterBufferState.JITTER_BUFFER_OK) { Console.WriteLine("Missing Packet"); } else { Console.WriteLine("Found Packet"); for (byte i = 0; i < 25; i++) { Console.WriteLine($"Output: {data[i]}"); } } buffer.Tick(); } public void Put(byte[] frameData) { var inPacket = new SpeexDSPJitterBufferPacket(frameData, (uint)frameData.Length); if (frameData == null) throw new ArgumentNullException("frameData"); inPacket.sequence = 0; inPacket.span = 1; inPacket.timestamp = timestamp++; buffer.Put(ref inPacket); } } ``` -------------------------------- ### Complete Audio Processor Example in C# Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md This example demonstrates how to initialize and use the SpeexDSPSharp library for audio processing, including echo cancellation, noise suppression, automatic gain control, and voice activity detection. Ensure proper disposal of resources. ```csharp using System; using SpeexDSPSharp.Core; using SpeexDSPSharp.Core.Structures; namespace MyAudioApp { public class AudioProcessor { private readonly SpeexDSPJitterBuffer _jitter; private readonly SpeexDSPPreprocessor _preprocessor; private readonly SpeexDSPEchoCanceler _echoCanceler; public AudioProcessor(int sampleRate) { int frameSize = sampleRate == 48000 ? 960 : 160; // Initialize all components _jitter = new SpeexDSPJitterBuffer(1); _preprocessor = new SpeexDSPPreprocessor(frameSize, sampleRate); _echoCanceler = new SpeexDSPEchoCanceler(frameSize, sampleRate * 3); // 3 sec filter // Configure var enabled = 1; _preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_DENOISE, ref enabled); _preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC, ref enabled); _preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_VAD, ref enabled); } public void ProcessFrame(short[] micInput, short[] speakerOutput) { // Inform echo canceler of playback _echoCanceler.EchoPlayback(speakerOutput); // Remove echo short[] noEcho = new short[micInput.Length]; _echoCanceler.EchoCapture(micInput, noEcho); // Further processing int hasVoice = _preprocessor.Run(noEcho); Console.WriteLine(hasVoice == 1 ? "Speech detected" : "Silence"); } public void Dispose() { _jitter.Dispose(); _preprocessor.Dispose(); _echoCanceler.Dispose(); } } } ``` -------------------------------- ### Package Installation Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md Instructions for installing the SpeexDSPSharp library via NuGet package manager. ```APIDOC ## Package Reference Install via NuGet: ```bash dotnet add package SpeexDSPSharp # or for Core only (manage native binaries yourself): dotnet add package SpeexDSPSharp.Core ``` ``` -------------------------------- ### Complete Voice Call Example with SpeexDSPSharp Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/README.md A comprehensive example demonstrating a voice call setup using SpeexDSPSharp. It includes initializing a jitter buffer, echo canceler, and preprocessor, configuring the preprocessor, and processing audio frames for both microphone input and speaker output. ```csharp using SpeexDSPSharp.Core; const int SAMPLE_RATE = 48000; const int FRAME_SIZE = 960; // 20ms frames // Initialize processing components var jitterBuffer = new SpeexDSPJitterBuffer(1); var echoCanceler = new SpeexDSPEchoCanceler(FRAME_SIZE, 14400); // 300ms filter var preprocessor = new SpeexDSPPreprocessor(FRAME_SIZE, SAMPLE_RATE); // Configure preprocessor var enabled = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_DENOISE, ref enabled); preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC, ref enabled); preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_VAD, ref enabled); // Process incoming audio void ProcessAudio(short[] microphoneInput, short[] speakerOutput) { // Inform echo canceler of speaker output echoCanceler.EchoPlayback(speakerOutput); // Remove echo from microphone short[] cleanAudio = new short[FRAME_SIZE]; echoCanceler.EchoCapture(microphoneInput, cleanAudio); // Further preprocessing int voiceDetected = preprocessor.Run(cleanAudio); if (voiceDetected == 1) { // Process speech } } // Cleanup jitterBuffer.Dispose(); echoCanceler.Dispose(); preprocessor.Dispose(); ``` -------------------------------- ### Minimal SpeexDSPPreprocessor Setup Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/README.md Initializes the SpeexDSPPreprocessor with frame size and sample rate. Use this for basic instantiation. ```csharp var preprocessor = new SpeexDSPPreprocessor(960, 48000); ``` -------------------------------- ### Install SpeexDSPSharp.Core via CLI Source: https://github.com/avionblock/speexdspsharp/blob/main/docs/quick-start/index.md Use this command to add the core library to your .NET project. ```csharp dotnet add package SpeexDSPSharp.Core --version x.y.z ``` -------------------------------- ### Install SpeexDSPSharp.Natives via CLI Source: https://github.com/avionblock/speexdspsharp/blob/main/docs/quick-start/index.md Use this command to add the precompiled native binaries to your platform-specific project. ```csharp dotnet add package SpeexDSPSharp.Natives --version x.y.z ``` -------------------------------- ### Import with Enums Example Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md Control preprocessor settings using enumerated values for clarity and type safety. ```csharp using SpeexDSPSharp.Core; var preprocessor = new SpeexDSPPreprocessor(960, 48000); var enabled = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC, ref enabled); ``` -------------------------------- ### Import with Interfaces Example Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md Use interfaces for dependency injection, allowing for more flexible and testable code. ```csharp using SpeexDSPSharp.Core; using SpeexDSPSharp.Core.Interfaces; ISpeexDSPJitterBuffer jitter = new SpeexDSPJitterBuffer(1); ISpeexDSPPreprocessor preprocessor = new SpeexDSPPreprocessor(960, 48000); ISpeexDSPEchoCanceler echo = new SpeexDSPEchoCanceler(960, 9600); ``` -------------------------------- ### Import with Structures Example Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md Utilize structures like JitterBufferPacket to pass data and manage packet information when interacting with the jitter buffer. ```csharp using SpeexDSPSharp.Core; using SpeexDSPSharp.Core.Structures; var jitter = new SpeexDSPJitterBuffer(1); byte[] data = new byte[960]; var packet = new SpeexDSPJitterBufferPacket(data, 960); jitter.Put(ref packet); ``` -------------------------------- ### JitterBuffer Example in C# Source: https://github.com/avionblock/speexdspsharp/blob/main/README.md Demonstrates the basic usage of the SpeexJitterBuffer for handling audio packets. Ensure necessary using directives are present. ```csharp using SpeexDSPSharp.Core; using SpeexDSPSharp.Core.Structures; var jitter = new SpeexJitterBuffer(); var inputData = new byte[960]; for(byte i = 0; i < 25; i++) { inputData[i] = (byte)Random.Shared.Next(byte.MinValue, byte.MaxValue); Console.WriteLine($"Input: {inputData[i]}"); } jitter.Put(inputData); Console.WriteLine(); jitter.Get(); //Found Packet jitter.Get(); //Missing Packet public class SpeexJitterBuffer { private readonly SpeexDSPJitterBuffer buffer = new SpeexDSPJitterBuffer(1); private uint timestamp = 1; public void Get() { var data = new byte[960]; var outPacket = new SpeexDSPJitterBufferPacket(data, (uint)data.Length); int temp = 0; if (buffer.Get(ref outPacket, 1, ref temp) != JitterBufferState.JITTER_BUFFER_OK) { Console.WriteLine("Missing Packet"); } else { Console.WriteLine("Found Packet"); for (byte i = 0; i < 25; i++) { Console.WriteLine($"Output: {data[i]}"); } } buffer.Tick(); } public void Put(byte[] frameData) { var inPacket = new SpeexDSPJitterBufferPacket(frameData, (uint)frameData.Length); if (frameData == null) throw new ArgumentNullException("frameData"); inPacket.sequence = 0; inPacket.span = 1; inPacket.timestamp = timestamp++; buffer.Put(ref inPacket); } } ``` -------------------------------- ### Comprehensive SpeexDSP Preprocessor Configuration Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/configuration.md Example demonstrating how to initialize and configure all major features of the SpeexDSP preprocessor, including noise reduction, AGC, VAD, and echo suppression. ```csharp var preprocessor = new SpeexDSPPreprocessor(960, 48000); // Enable all processing features var one = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_DENOISE, ref one); preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC, ref one); preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_VAD, ref one); // Configure noise suppression var noiseSuppression = -40; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, ref noiseSuppression); // Configure AGC var agcTarget = 30000; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC_TARGET, ref agcTarget); var agcMaxGain = 30; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC_MAX_GAIN, ref agcMaxGain); // Configure VAD var probStart = 80; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_PROB_START, ref probStart); var probContinue = 50; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_PROB_CONTINUE, ref probContinue); // Configure echo suppression var echoSuppress = -40; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_ECHO_SUPPRESS, ref echoSuppress); var echoSuppressActive = -20; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE, ref echoSuppressActive); ``` -------------------------------- ### Initialize and Process Audio with SpeexDSP Preprocessor Source: https://github.com/avionblock/speexdspsharp/blob/main/README.md This example shows how to initialize the SpeexDSP preprocessor with NAudio for real-time audio processing. It configures AGC, denoise, and VAD, and plays back processed audio. ```csharp using NAudio.Wave; using SpeexDSPSharp.Core; var format = new WaveFormat(48000, 1); var preprocessor = new SpeexDSPPreprocessor(20 * format.SampleRate / 1000, format.SampleRate); var @true = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC, ref @true); preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_DENOISE, ref @true); preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_VAD, ref @true); var gain = 30000; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC_TARGET, ref gain); var buffer = new BufferedWaveProvider(format) { ReadFully = true }; var recorder = new WaveInEvent() { WaveFormat = format, BufferMilliseconds = 20 }; var output = new WaveOutEvent() { DesiredLatency = 100 }; recorder.DataAvailable += Recorder_DataAvailable; output.Init(buffer); Task.Delay(500).Wait(); output.Play(); recorder.StartRecording(); void Recorder_DataAvailable(object? sender, WaveInEventArgs e) { try { Console.WriteLine($"Detecting Voice: {(preprocessor.Run(e.Buffer) == 1? true : false)}"); buffer.AddSamples(e.Buffer, 0, e.BytesRecorded); } catch (Exception ex) { Console.WriteLine(ex); } } Console.ReadLine(); ``` -------------------------------- ### NAudio Echo Cancellation Setup Source: https://github.com/avionblock/speexdspsharp/blob/main/docs/examples/Home.md Sets up NAudio components for audio recording and playback with echo cancellation. Ensure the 'Tester' namespace is accessible. ```csharp using NAudio.Wave; using Tester; var format = new WaveFormat(48000, 1); var buffer = new BufferedWaveProvider(format) { ReadFully = true }; var echo = new EchoCancellationWaveProvider(20, 200, buffer); var recorder = new WaveInEvent() { WaveFormat = format, BufferMilliseconds = 20 }; var output = new WaveOutEvent() { DesiredLatency = 100 }; recorder.DataAvailable += Recorder_DataAvailable; output.Init(echo); Task.Delay(500).Wait(); output.Play(); recorder.StartRecording(); void Recorder_DataAvailable(object? sender, WaveInEventArgs e) { try { var output = new byte[e.BytesRecorded]; echo.Cancel(e.Buffer, output); buffer.AddSamples(output, 0, e.BytesRecorded); } catch(Exception ex) { Console.WriteLine(ex); } } Console.ReadLine(); ``` -------------------------------- ### Force Static Linking Example Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/configuration.md Demonstrates how to explicitly force static library linking for JitterBuffer, Preprocessor, and EchoCanceler instances by setting `use_static` to `true`. ```csharp var jitter = new SpeexDSPJitterBuffer(1, use_static: true); var preprocessor = new SpeexDSPPreprocessor(960, 48000, use_static: true); var echo = new SpeexDSPEchoCanceler(960, 9600, use_static: true); ``` -------------------------------- ### Force Dynamic Linking Example Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/configuration.md Demonstrates how to explicitly force dynamic library linking for JitterBuffer, Preprocessor, and EchoCanceler instances by setting `use_static` to `false`. ```csharp var jitter = new SpeexDSPJitterBuffer(1, use_static: false); var preprocessor = new SpeexDSPPreprocessor(960, 48000, use_static: false); var echo = new SpeexDSPEchoCanceler(960, 9600, use_static: false); ``` -------------------------------- ### Basic SpeexDSP Preprocessor Usage Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/README.md Demonstrates the basic setup and usage of the SpeexDSPPreprocessor for audio processing. This includes enabling denoising and automatic gain control, and processing an audio frame. ```csharp using SpeexDSPSharp.Core; // Create preprocessor for 48kHz audio, 20ms frames var preprocessor = new SpeexDSPPreprocessor(960, 48000); // Enable denoising and AGC var enabled = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_DENOISE, ref enabled); preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC, ref enabled); // Process audio frame short[] audioFrame = new short[960]; // ... fill audioFrame with audio ... int voiceDetected = preprocessor.Run(audioFrame); // Clean up preprocessor.Dispose(); ``` -------------------------------- ### Configure VAD Probability Start Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/configuration.md Sets the probability threshold for transitioning from silence to speech. A higher value requires more speech evidence to detect the start of a voice segment. Typical range is 70-90%. ```csharp var probStart = 80; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_PROB_START, ref probStart); ``` -------------------------------- ### Install SpeexDSPSharp Package Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/README.md Use the dotnet CLI to add the SpeexDSPSharp package to your project. Choose the full package with native binaries or the core-only package if you manage native binaries separately. ```bash dotnet add package SpeexDSPSharp ``` ```bash # Or Core-only (manage native binaries yourself) dotnet add package SpeexDSPSharp.Core ``` -------------------------------- ### Advanced: Direct P/Invoke Example Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md Access native library functions directly via P/Invoke for performance-critical operations. Requires careful manual resource management and is marked as unsafe. ```csharp using SpeexDSPSharp.Core; unsafe { var handler = NativeSpeexDSP.jitter_buffer_init(1); // ... use handler ... // Note: SafeHandle requires proper cleanup } ``` -------------------------------- ### SpeexDSPJitterBuffer Class Reference Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/DOCUMENTATION_SUMMARY.txt Detailed documentation for the SpeexDSPJitterBuffer class, including its constructor, public methods, parameters, return types, and usage examples. ```APIDOC ## SpeexDSPJitterBuffer ### Description Provides functionality for a jitter buffer used in audio streaming to handle network latency variations. ### Methods - **Constructor**: Initializes a new instance of the SpeexDSPJitterBuffer class. - **Put**: Inserts a packet into the jitter buffer. - **Get**: Retrieves a packet from the jitter buffer. - **GetAnother**: Retrieves another packet from the jitter buffer. - **UpdateDelay**: Updates the jitter buffer's delay. - **GetPointerTimestamp**: Gets the timestamp of the current packet pointer. - **Tick**: Advances the jitter buffer's internal state. - **RemainingSpan**: Gets the remaining span of packets in the buffer. - **Ctl**: Controls various aspects of the jitter buffer's behavior. - **Reset**: Resets the jitter buffer to its initial state. - **Dispose**: Releases unmanaged resources and cleans up the jitter buffer. ### Parameters (Detailed parameter tables for each method are available in the source documentation.) ### Return Types (Return types and error conditions are documented for each method.) ### Usage Examples (5+ usage examples are provided in the source documentation.) ### Remarks Notes on thread safety and memory management are included. ``` -------------------------------- ### Install SpeexDSPSharp NuGet Package Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md Add the SpeexDSPSharp package to your .NET project using the dotnet CLI. For core functionality without bundled native binaries, use SpeexDSPSharp.Core. ```bash dotnet add package SpeexDSPSharp # or for Core only (manage native binaries yourself): dotnet add package SpeexDSPSharp.Core ``` -------------------------------- ### Force Static Native SpeexDSP Usage Source: https://github.com/avionblock/speexdspsharp/blob/main/README.md This example demonstrates how to manually force SpeexDSPSharp to use the statically linked speexdsp binary, which is the default behavior on iOS. ```csharp // On iOS SpeexDSPSharp switches to StaticNativeSpeexDSP automatically. // You can still force the same behavior manually with use_static: true. var jitterBuffer = new SpeexDSPJitterBuffer(1, true); ``` -------------------------------- ### Create Multi-Channel Echo Canceler Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-echo-canceler.md Instantiate this constructor for echo cancellation in multi-channel audio setups with multiple microphones and speakers. Specify the exact number of microphone and speaker channels. ```csharp public SpeexDSPEchoCanceler(int frame_size, int filter_length, int nb_mic, int nb_speaker, bool use_static) ``` ```csharp // Multi-channel: 2 mics, 2 speakers var multichanEchoCanceler = new SpeexDSPEchoCanceler(960, 9600, nb_mic: 2, nb_speaker: 2, use_static: false); ``` -------------------------------- ### VoIP Call Configuration (48kHz) Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/configuration.md Standard setup for voice over IP at 48kHz with 20ms frames. Configures echo cancellation and preprocessor settings for noise reduction, automatic gain control, and voice activity detection. ```csharp // Common setup for voice over IP at 48kHz, 20ms frames const int SAMPLE_RATE = 48000; const int FRAME_SIZE = 960; // 20ms var jitter = new SpeexDSPJitterBuffer(1); var echo = new SpeexDSPEchoCanceler(FRAME_SIZE, 14400); // 300ms filter var preprocess = new SpeexDSPPreprocessor(FRAME_SIZE, SAMPLE_RATE); // Configure preprocessor for voice call var enabled = 1; preprocess.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_DENOISE, ref enabled); preprocess.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC, ref enabled); preprocess.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_VAD, ref enabled); var agcTarget = 30000; preprocess.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC_TARGET, ref agcTarget); ``` -------------------------------- ### Initialize and Use EchoCapture Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-echo-canceler.md Demonstrates initializing the echo canceler and using EchoCapture for real-time echo removal. This pattern is suitable when playback is known and can be fed to the canceler. ```csharp var echoCanceler = new SpeexDSPEchoCanceler(960, 9600); while (running) { short[] micFrame = ReadMicrophoneFrame(); // From input device short[] outputFrame = new short[960]; // Inform of playback echoCanceler.EchoPlayback(speakerFrame); // Capture with echo removal echoCanceler.EchoCapture(micFrame, outputFrame); // outputFrame now contains near-end audio with echo removed ProcessAudio(outputFrame); } ``` -------------------------------- ### jitter_buffer_get_pointer_timestamp Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/native-speex-dsp.md Gets the current buffer pointer timestamp. ```APIDOC ## jitter_buffer_get_pointer_timestamp ### Description Gets current buffer pointer timestamp. ### Method ```csharp [DllImport("speexdsp", CallingConvention = CallingConvention.Cdecl)] public static extern int jitter_buffer_get_pointer_timestamp(SpeexDSPJitterBufferSafeHandler jitter); ``` ### Parameters #### Path Parameters - **jitter** (SpeexDSPJitterBufferSafeHandler) - Required - Jitter buffer handle. ### Response #### Success Response - **int** - Timestamp value. ``` -------------------------------- ### Primary Public API Entry Points Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md Demonstrates how to instantiate the main public API wrapper classes for Jitter Buffer, Preprocessor, and Echo Canceler. ```APIDOC ## Primary Public API All public types are in namespace `SpeexDSPSharp.Core`. The main entry points are three managed wrapper classes: ```csharp using SpeexDSPSharp.Core; // Jitter buffer for managing packet timing var jitterBuffer = new SpeexDSPJitterBuffer(step_size: 1); // Audio preprocessor (denoise, AGC, VAD) var preprocessor = new SpeexDSPPreprocessor(frame_size: 960, sample_rate: 48000); // Echo canceler var echoCanceler = new SpeexDSPEchoCanceler(frame_size: 960, filter_length: 9600); ``` ``` -------------------------------- ### Get Jitter Buffer Pointer Timestamp Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/native-speex-dsp.md Retrieves the current timestamp of the jitter buffer pointer. ```csharp [DllImport("speexdsp", CallingConvention = CallingConvention.Cdecl)] public static extern int jitter_buffer_get_pointer_timestamp(SpeexDSPJitterBufferSafeHandler jitter); ``` -------------------------------- ### Initialize SpeexDSP Core Components Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/module-structure.md Instantiate the primary managed wrapper classes for jitter buffer, audio preprocessor, and echo canceler. Ensure correct parameters like step size, frame size, and sample rate are provided. ```csharp using SpeexDSPSharp.Core; // Jitter buffer for managing packet timing var jitterBuffer = new SpeexDSPJitterBuffer(step_size: 1); // Audio preprocessor (denoise, AGC, VAD) var preprocessor = new SpeexDSPPreprocessor(frame_size: 960, sample_rate: 48000); // Echo canceler var echoCanceler = new SpeexDSPEchoCanceler(frame_size: 960, filter_length: 9600); ``` -------------------------------- ### speex_echo_state_reset Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/native-speex-dsp.md Resets the echo canceler state to its initial configuration. This is useful for starting a new echo cancellation session or recovering from unexpected states. ```APIDOC ## speex_echo_state_reset ### Description Resets echo canceler state. ### Method Signature ```csharp [DllImport("speexdsp", CallingConvention = CallingConvention.Cdecl)] public static unsafe extern void speex_echo_state_reset(SpeexDSPEchoStateSafeHandler st); ``` ### Parameters #### Path Parameters - **st** (SpeexDSPEchoStateSafeHandler) - Required - Echo state handle to reset. ### Returns - **void** ``` -------------------------------- ### Reset() Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-jitter-buffer.md Resets the jitter buffer to its initial state, clearing all stored packets. This is useful for re-initializing the buffer, for example, when a new connection is established. ```APIDOC ## Reset() ### Description Resets the jitter buffer to its initial state, clearing all stored packets. ### Method Signature ```csharp public void Reset() ``` ### Returns - **void** ### Throws - `ObjectDisposedException` if disposed. ### Example ```csharp jitterBuffer.Reset(); // Clear buffer for new connection ``` ``` -------------------------------- ### Reset() Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-echo-canceler.md Resets the echo canceler to its initial state, clearing all learned echo filters. This is useful for starting fresh or after significant changes in audio conditions. ```APIDOC ## Reset() ### Description Resets the echo canceler to its initial state, clearing all learned echo filters. ### Method `Reset()` ### Endpoint None ### Parameters None ### Returns - **void** ### Throws - `ObjectDisposedException` - if disposed. ### Example ```csharp echoCanceler.Reset(); // Clear for new connection or after noise event ``` ``` -------------------------------- ### PreprocessorCtl Enum Definition Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/types.md Defines control operations for preprocessor configuration and diagnostic queries. Use these values to set or get parameters for the Speex preprocessor. ```csharp public enum PreprocessorCtl { SPEEX_PREPROCESS_SET_DENOISE = 0, SPEEX_PREPROCESS_GET_DENOISE = 1, SPEEX_PREPROCESS_SET_AGC = 2, SPEEX_PREPROCESS_GET_AGC = 3, SPEEX_PREPROCESS_SET_VAD = 4, SPEEX_PREPROCESS_GET_VAD = 5, SPEEX_PREPROCESS_SET_AGC_LEVEL = 6, SPEEX_PREPROCESS_GET_AGC_LEVEL = 7, SPEEX_PREPROCESS_SET_DEREVERB = 8, SPEEX_PREPROCESS_GET_DEREVERB = 9, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL = 10, SPEEX_PREPROCESS_GET_DEREVERB_LEVEL = 11, SPEEX_PREPROCESS_SET_DEREVERB_DECAY = 12, SPEEX_PREPROCESS_GET_DEREVERB_DECAY = 13, SPEEX_PREPROCESS_SET_PROB_START = 14, SPEEX_PREPROCESS_GET_PROB_START = 15, SPEEX_PREPROCESS_SET_PROB_CONTINUE = 16, SPEEX_PREPROCESS_GET_PROB_CONTINUE = 17, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS = 18, SPEEX_PREPROCESS_GET_NOISE_SUPPRESS = 19, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS = 20, SPEEX_PREPROCESS_GET_ECHO_SUPPRESS = 21, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE = 22, SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE = 23, SPEEX_PREPROCESS_SET_ECHO_STATE = 24, SPEEX_PREPROCESS_GET_ECHO_STATE = 25, SPEEX_PREPROCESS_SET_AGC_INCREMENT = 26, SPEEX_PREPROCESS_GET_AGC_INCREMENT = 27, SPEEX_PREPROCESS_SET_AGC_DECREMENT = 28, SPEEX_PREPROCESS_GET_AGC_DECREMENT = 29, SPEEX_PREPROCESS_SET_AGC_MAX_GAIN = 30, SPEEX_PREPROCESS_GET_AGC_MAX_GAIN = 31, SPEEX_PREPROCESS_GET_AGC_LOUDNESS = 33, SPEEX_PREPROCESS_GET_AGC_GAIN = 35, SPEEX_PREPROCESS_GET_PSD_SIZE = 37, SPEEX_PREPROCESS_GET_PSD = 39, SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE = 41, SPEEX_PREPROCESS_GET_NOISE_PSD = 43, SPEEX_PREPROCESS_GET_PROB = 45, SPEEX_PREPROCESS_SET_AGC_TARGET = 46, SPEEX_PREPROCESS_GET_AGC_TARGET = 47, } ``` -------------------------------- ### Get Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-jitter-buffer.md Retrieves one packet from the jitter buffer. It can return a missing packet indicator if data is unavailable or late, and provides the timestamp of the retrieved packet. ```APIDOC ## Get ### Description Retrieves one packet from the jitter buffer. May return a missing packet indicator if data is unavailable or late. ### Method `Get` ### Parameters #### Path Parameters - **packet** (SpeexDSPJitterBufferPacket) - Required - Reference to packet structure that will receive the buffered packet data. - **desired_span** (int) - Required - Requested number of samples/units to retrieve from the buffer (no guarantee of exact amount). - **start_offset** (int) - Required - Reference parameter returning the timestamp for the retrieved packet. ### Returns - `JitterBufferState` enum indicating result (`JITTER_BUFFER_OK`, `JITTER_BUFFER_MISSING`, `JITTER_BUFFER_INSERTION`, or error codes). ### Throws - `ObjectDisposedException` if disposed. ### Example ```csharp var packet = new SpeexDSPJitterBufferPacket(outputBuffer, (uint)outputBuffer.Length); int startOffset = 0; var state = jitterBuffer.Get(ref packet, 960, ref startOffset); if (state == JitterBufferState.JITTER_BUFFER_OK) { // Process retrieved packet Console.WriteLine($"Got packet at timestamp: {startOffset}"); } else if (state == JitterBufferState.JITTER_BUFFER_MISSING) { // Handle missing/late packet Console.WriteLine("Packet lost or arrived too late"); } ``` ``` -------------------------------- ### Update Estimates (short[]) Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-preprocessor.md Updates preprocessor state for 16-bit PCM audio using a short array without processing. The array is not modified. ```csharp public void EstimateUpdate(short[] x) { // Implementation omitted for brevity } ``` -------------------------------- ### Configure Echo Canceler Settings Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/configuration.md Demonstrates initializing the echo canceler and using the Ctl() method to set the sampling rate and query the frame size. The Ctl() method is used for various configuration and query operations. ```csharp // Single-channel, 20ms frames at 48kHz, 300ms echo filter var echo = new SpeexDSPEchoCanceler(960, 14400); // Change sampling rate if needed int newRate = 48000; echo.Ctl(EchoCancellationCtl.SPEEX_ECHO_SET_SAMPLING_RATE, ref newRate); // Query frame size int frameSize = 0; echo.Ctl(EchoCancellationCtl.SPEEX_ECHO_GET_FRAME_SIZE, ref frameSize); Console.WriteLine($"Frame size: {frameSize}"); // Multi-channel: 2 mics, 2 speakers var echoMc = new SpeexDSPEchoCanceler(960, 14400, 2, 2, use_static: false); ``` -------------------------------- ### Reset Echo Canceler State Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-echo-canceler.md Call the Reset method to clear the echo canceler's learned filters. This is useful for starting fresh or after significant noise events. ```csharp public void Reset() ``` ```csharp echoCanceler.Reset(); // Clear for new connection or after noise event ``` -------------------------------- ### SpeexDSPPreprocessor Constructor and Configuration Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-preprocessor.md Instantiates a SpeexDSPPreprocessor and configures its AGC, denoising, and VAD settings. Ensure frame size and sample rate match your audio source. ```csharp using SpeexDSPSharp.Core; // 48kHz audio with 20ms frames (960 samples) var preprocessor = new SpeexDSPPreprocessor(960, 48000); // Configure AGC, denoising, and VAD var enableAgc = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC, ref enableAgc); var enableDenoise = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_DENOISE, ref enableDenoise); var enableVad = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_VAD, ref enableVad); ``` -------------------------------- ### Initialize and Use EchoCancel Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-echo-canceler.md Shows how to initialize the echo canceler and use EchoCancel for direct echo cancellation. This method requires both microphone and speaker frames to be provided explicitly. ```csharp var echoCanceler = new SpeexDSPEchoCanceler(960, 9600); while (running) { short[] micFrame = ReadMicrophoneFrame(); short[] speakerFrame = GetCurrentPlaybackFrame(); short[] outputFrame = new short[960]; echoCanceler.EchoCancel(micFrame, speakerFrame, outputFrame); ProcessAudio(outputFrame); } ``` -------------------------------- ### SpeexDSPSharp Preprocessor Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/DOCUMENTATION_SUMMARY.txt Documentation for the SpeexDSP preprocessor, including its constructor, Run() and EstimateUpdate() methods, and the Ctl() control interface. ```APIDOC ## SpeexDSP Preprocessor ### Description Provides functionalities for audio preprocessing, including denoising, automatic gain control (AGC), voice activity detection (VAD), de-reverberation, and echo suppression. ### Methods - **Constructor**: Initializes the preprocessor. - **Run()**: Processes audio frames. (12 overloads) - **EstimateUpdate()**: Estimates updates for processing. (12 overloads) - **Ctl()**: Accesses the control interface for fine-tuning various parameters. (47 operations) ### Control Operations (Ctl) Each control operation is documented with its enum value, parameter type, valid ranges, and a detailed description. Examples include features like denoising levels, AGC settings (8 options), VAD thresholds (4 options), and echo suppression parameters. ### Usage Examples Includes feature enablement examples and 7+ usage examples demonstrating common configurations and scenarios. ``` -------------------------------- ### SpeexDSP Preprocessor Constructor Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/configuration.md Initializes the SpeexDSP preprocessor with frame size and sample rate. The use_static parameter can override the binding mode. ```csharp public SpeexDSPPreprocessor(int frame_size, int sample_rate, bool? use_static = null) ``` -------------------------------- ### Reset Jitter Buffer State Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-jitter-buffer.md Call the Reset method to clear all stored packets and return the jitter buffer to its initial state. This is useful when starting a new connection or stream. ```csharp public void Reset() ``` ```csharp jitterBuffer.Reset(); // Clear buffer for new connection ``` -------------------------------- ### SpeexDSPPreprocessor Constructor Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-preprocessor.md Initializes a new SpeexDSPPreprocessor instance with specified frame size and sample rate. Optional parameter to control static library imports. ```APIDOC ## Constructor SpeexDSPPreprocessor(int frame_size, int sample_rate, bool? use_static = null) ### Description Creates a new audio preprocessor instance configured for specific audio parameters. ### Parameters #### Path Parameters - **frame_size** (int) - Required - Number of samples to process per frame. Should correspond to 10-20ms of audio. Must match frame size used for echo canceler if residual echo suppression is needed. Common values: 480 (10ms@48kHz), 960 (20ms@48kHz). - **sample_rate** (int) - Required - Audio sampling rate in Hz. Common values: 8000, 16000, 48000. Must be known at construction time. - **use_static** (bool?) - Optional - Set to `true` to force static library imports, `false` for dynamic imports, or `null` to auto-select based on platform (iOS uses static linking automatically). ### Returns A new `SpeexDSPPreprocessor` instance ready for audio processing. ### Throws `SpeexDSPException` if preprocessor initialization fails. ### Example ```csharp using SpeexDSPSharp.Core; // 48kHz audio with 20ms frames (960 samples) var preprocessor = new SpeexDSPPreprocessor(960, 48000); // Configure AGC, denoising, and VAD var enableAgc = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC, ref enableAgc); var enableDenoise = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_DENOISE, ref enableDenoise); var enableVad = 1; preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_VAD, ref enableVad); ``` ``` -------------------------------- ### Get Current Jitter Buffer Pointer Timestamp Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-jitter-buffer.md Retrieves the current timestamp value indicated by the jitter buffer's internal pointer. This can be used for monitoring buffer progress. ```csharp int timestamp = jitterBuffer.GetPointerTimestamp(); Console.WriteLine($"Buffer pointer at: {timestamp}"); ``` -------------------------------- ### Run(short[]) Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-preprocessor.md Processes a frame of audio samples in 16-bit PCM format. The array is modified in-place. Returns a voice activity detection result if enabled. ```APIDOC ## Run(short[]) ### Description Processes a frame of audio samples in 16-bit PCM format (most common). The array is modified in-place. Returns a voice activity detection result if enabled. ### Method `public int Run(short[] x)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **x** (short[]) - Required - Audio sample array in 16-bit signed PCM format. Length must match frame_size. Modified in-place. ### Request Example ```csharp short[] audioFrame = new short[960]; // ... fill with PCM samples ... int hasVoice = preprocessor.Run(audioFrame); // Processed audio is now in audioFrame Console.WriteLine($"VAD Result: {hasVoice}"); ``` ### Response #### Success Response (200) - **return value** (int) - Voice activity detection result (1 = speech, 0 = silence/noise) if VAD enabled. #### Response Example ```json 1 // or 0 ``` ### Throws - `ObjectDisposedException` if disposed - `SpeexDSPException` on error ``` -------------------------------- ### Create SpeexDSPJitterBuffer Instance Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-jitter-buffer.md Instantiate a new jitter buffer with a specified step size for delay adjustments. Optionally, force static library imports. Ensure the step size is appropriate for your audio processing needs. ```csharp using SpeexDSPSharp.Core; using SpeexDSPSharp.Core.Structures; // Create a jitter buffer with step size of 1 for fine-grained delay adjustments var jitterBuffer = new SpeexDSPJitterBuffer(1); // Or force static linking on non-iOS platforms var jitterBuffer = new SpeexDSPJitterBuffer(1, use_static: true); ``` -------------------------------- ### speex_preprocess_state_init Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/native-speex-dsp.md Creates a new preprocessor state. This function initializes the necessary structures for audio preprocessing operations like denoising, AGC, and VAD. ```APIDOC ## speex_preprocess_state_init ### Description Creates preprocessor state. ### Method ```csharp [DllImport("speexdsp", CallingConvention = CallingConvention.Cdecl)] public static extern SpeexDSPPreprocessStateSafeHandler speex_preprocess_state_init(int frame_size, int sampling_rate); ``` ### Parameters #### Path Parameters - **frame_size** (int) - Required - Samples per frame (10-20ms). - **sampling_rate** (int) - Required - Sampling rate in Hz. ### Returns - **SpeexDSPPreprocessStateSafeHandler** - Handle to preprocessor state. ``` -------------------------------- ### Retrieve Additional Packet with Same Timestamp Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-jitter-buffer.md Call this method after a `Get` operation to retrieve another packet that shares the same timestamp. This is useful when a single audio frame is fragmented across multiple packets. ```csharp // After calling Get()... var anotherPacket = new SpeexDSPJitterBufferPacket(anotherBuffer, (uint)anotherBuffer.Length); int result = jitterBuffer.GetAnother(ref anotherPacket); if (result == (int)JitterBufferState.JITTER_BUFFER_OK) { Console.WriteLine("Retrieved second packet with same timestamp"); } ``` -------------------------------- ### SpeexDSPPreprocessor Class Reference Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/DOCUMENTATION_SUMMARY.txt Reference for the SpeexDSPPreprocessor class, detailing its constructor, audio processing methods, and extensive control options. ```APIDOC ## SpeexDSPPreprocessor ### Description Handles audio signal preprocessing tasks such as noise reduction and echo suppression. ### Constructor Parameters - **frame_size** (int): The size of the audio frame. - **sample_rate** (int): The sample rate of the audio. - **use_static** (bool): Whether to use static memory allocation. ### Methods - **Run()**: Processes audio data for byte[], short[], float[], and Span. - **EstimateUpdate()**: Variants for updating the preprocessor's internal state. - **Ctl()**: Provides access to over 40 control options for fine-tuning preprocessing. ### Feature Configuration Examples (Examples for configuring various preprocessing features are available.) ### Parameter Documentation (Comprehensive documentation for all parameters is provided.) ``` -------------------------------- ### Initialize Speex Preprocessor State Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/native-speex-dsp.md Creates and initializes a preprocessor state object. Specify the frame size in samples and the audio sampling rate. ```csharp [DllImport("speexdsp", CallingConvention = CallingConvention.Cdecl)] public static extern SpeexDSPPreprocessStateSafeHandler speex_preprocess_state_init(int frame_size, int sampling_rate); ``` -------------------------------- ### Correct Parameter Type for Ctl() in SpeexDSP Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/errors.md Pass the correct parameter type to Ctl() methods to avoid unexpected behavior or memory corruption. For example, SPEEX_PREPROCESS_SET_AGC_TARGET expects an int, not a float. ```csharp float level = 30.0f; // SPEEX_PREPROCESS_SET_AGC_TARGET expects int, not float preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC_TARGET, ref level); ``` ```csharp int target = 30000; // int, not float preprocessor.Ctl(PreprocessorCtl.SPEEX_PREPROCESS_SET_AGC_TARGET, ref target); ``` -------------------------------- ### EchoCancellationWaveProvider Implementation Source: https://github.com/avionblock/speexdspsharp/blob/main/docs/examples/Home.md Custom NAudio IWaveProvider for integrating SpeexDSPSharp's echo cancellation. Requires 'SpeexDSPSharp.Core' and 'NAudio.Wave' namespaces. ```csharp using NAudio.Wave; using SpeexDSPSharp.Core; namespace Tester { public class EchoCancellationWaveProvider : IWaveProvider { private IWaveProvider _source; private SpeexDSPEchoCanceler _canceller; public WaveFormat WaveFormat => _source.WaveFormat; public EchoCancellationWaveProvider(int frame_size_ms, int filter_length_ms, IWaveProvider source) { _source = source; var sampleRate = WaveFormat.SampleRate; var frame_size = frame_size_ms * sampleRate / 1000; var filter_length = filter_length_ms * sampleRate / 1000; _canceller = new SpeexDSPEchoCanceler(frame_size, filter_length); _canceller.Ctl(EchoCancellationCtl.SPEEX_ECHO_SET_SAMPLING_RATE, ref sampleRate); } public int Read(byte[] buffer, int offset, int count) { int samplesRead = _source.Read(buffer, offset, count); _canceller.EchoPlayback(buffer); return samplesRead; } public void Cancel(byte[] buffer, byte[] canceled) { _canceller.EchoCapture(buffer, canceled); } } } ``` -------------------------------- ### SpeexDSPEchoCanceler Constructor (Multi-Channel) Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/api-reference/speex-echo-canceler.md Creates a multi-channel echo canceler supporting multiple microphones and speakers. Use this constructor when dealing with complex audio setups involving several input and output channels. ```APIDOC ## SpeexDSPEchoCanceler(int frame_size, int filter_length, int nb_mic, int nb_speaker, bool use_static) ### Description Creates a multi-channel echo canceler supporting multiple microphones and speakers. ### Parameters #### Path Parameters - **frame_size** (int) - Required - Samples per frame (10-20ms duration). - **filter_length** (int) - Required - Echo filter length in samples (100-500ms). - **nb_mic** (int) - Required - Number of microphone channels. - **nb_speaker** (int) - Required - Number of speaker channels. - **use_static** (bool) - Required - `true` for static linking, `false` for dynamic. ### Returns A new multi-channel `SpeexDSPEchoCanceler` instance. ### Throws `SpeexDSPException` if initialization fails. ### Example ```csharp // Multi-channel: 2 mics, 2 speakers var multichanEchoCanceler = new SpeexDSPEchoCanceler(960, 9600, nb_mic: 2, nb_speaker: 2, use_static: false); ``` ``` -------------------------------- ### NativeSpeexDSP P/Invoke Bindings Reference Source: https://github.com/avionblock/speexdspsharp/blob/main/_autodocs/DOCUMENTATION_SUMMARY.txt Reference for the low-level P/Invoke bindings to the native Speex DSP library, detailing all exposed functions. ```APIDOC ## NativeSpeexDSP (P/Invoke Bindings) ### Description Provides direct access to the underlying native Speex DSP library functions through P/Invoke. ### Jitter Buffer Functions - Approximately 12 functions related to jitter buffer management. ### Echo Cancellation Functions - Approximately 8 functions for echo cancellation operations. ### Preprocessor Functions - Approximately 4 functions for audio preprocessing. ### Parameter Documentation - Detailed parameter documentation is provided for each native function. ### Remarks Includes remarks on usage and performance considerations for the native functions. ```