io.agora.rtc

## Class AgoraAudioVadConfig

- java.lang.Object
- - io.agora.rtc.AgoraAudioVadConfig

-     public class AgoraAudioVadConfig
      extends java.lang.Object

  Configuration values for the Java VAD implementation.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private float` | `activePercent` active percent, if over this percent, will be recognized as speaking, default value is 0.6
    `private float` | `aggressive` aggressive factor, greater value means more aggressive, default value is 5.0
    `private int` | `anaWindowSz` fft-window Size, will be used to calc rms, default value is 768
    `private int` | `fftSz` fft-size, only support: 128, 256, 512, 1024, default value is 1024
    `private int` | `frqInputAvailableFlag` whether Aed_InputData will contain external freq.
    `private int` | `hopSz` fft-Hop Size, will be used to check, default value is 160
    `private float` | `inactivePercent` inactive percent, if below this percent, will be recognized as non-speaking, default value is 0.2
    `private float` | `jointThr` joint threshold in dB, default value is 0.0
    `private int` | `preStartRecognizeCount` pre start recognize count, buffer size for 10ms 16KHz 16bit 1channel PCM, default value is 10
    `private float` | `rmsThr` rms threshold in dB, default value is -40.0
    `private int` | `startRecognizeCount` start recognize count, buffer size for 10ms 16KHz 16bit 1channel PCM, default value is 10
    `private int` | `stopRecognizeCount` stop recognize count, buffer size for 10ms 16KHz 16bit 1channel PCM, default value is 6
    `private int` | `useCVersionAIModule` whether to use the C version of AI submodules, default value is 0
    `private float` | `voiceProbThr` voice probability threshold 0.0f ~ 1.0f, default value is 0.8

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AgoraAudioVadConfig()` Creates a configuration with default thresholds and counters.
    `AgoraAudioVadConfig(int fftSz, int hopSz, int anaWindowSz, int frqInputAvailableFlag, int useCVersionAIModule, float voiceProbThr, float rmsThr, float jointThr, float aggressive, int startRecognizeCount, int stopRecognizeCount, int preStartRecognizeCount, float activePercent, float inactivePercent)` Creates a configuration with custom parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `float` | `getActivePercent()` Returns the percentage threshold for active detection.
    `float` | `getAggressive()` Returns the aggressiveness factor.
    `int` | `getAnaWindowSz()` Returns the analysis window size.
    `int` | `getFftSz()` Returns the FFT size used by the detector.
    `int` | `getFrqInputAvailableFlag()` Returns the flag indicating external frequency input.
    `int` | `getHopSz()` Returns the FFT hop size.
    `float` | `getInactivePercent()` Returns the percentage threshold for inactivity detection.
    `float` | `getJointThr()` Returns the joint threshold in dB.
    `int` | `getPreStartRecognizeCount()` Returns the pre-start recognition buffer size.
    `float` | `getRmsThr()` Returns the RMS threshold in dB.
    `int` | `getStartRecognizeCount()` Returns the frames required to start recognition.
    `int` | `getStopRecognizeCount()` Returns the frames required to stop recognition.
    `int` | `getUseCVersionAIModule()` Returns the flag for using the C AI modules.
    `float` | `getVoiceProbThr()` Returns the voice probability threshold.
    `void` | `setActivePercent(float activePercent)` Sets the percentage threshold for active detection.
    `void` | `setAggressive(float aggressive)` Sets the aggressiveness factor.
    `void` | `setAnaWindowSz(int anaWindowSz)` Sets the analysis window size.
    `void` | `setFftSz(int fftSz)` Sets the FFT size used by the detector.
    `void` | `setFrqInputAvailableFlag(int frqInputAvailableFlag)` Sets the flag indicating external frequency input.
    `void` | `setHopSz(int hopSz)` Sets the FFT hop size.
    `void` | `setInactivePercent(float inactivePercent)` Sets the percentage threshold for inactivity detection.
    `void` | `setJointThr(float jointThr)` Sets the joint threshold in dB.
    `void` | `setPreStartRecognizeCount(int preStartRecognizeCount)` Sets the pre-start recognition buffer size.
    `void` | `setRmsThr(float rmsThr)` Sets the RMS threshold in dB.
    `void` | `setStartRecognizeCount(int startRecognizeCount)` Sets the frames required to start recognition.
    `void` | `setStopRecognizeCount(int stopRecognizeCount)` Sets the frames required to stop recognition.
    `void` | `setUseCVersionAIModule(int useCVersionAIModule)` Sets the flag for using the C AI modules.
    `void` | `setVoiceProbThr(float voiceProbThr)` Sets the voice probability threshold.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### fftSz

          private int fftSz

      fft-size, only support: 128, 256, 512, 1024, default value is 1024

    - #### hopSz

          private int hopSz

      fft-Hop Size, will be used to check, default value is 160

    - #### anaWindowSz

          private int anaWindowSz

      fft-window Size, will be used to calc rms, default value is 768

    - #### frqInputAvailableFlag

          private int frqInputAvailableFlag

      whether Aed_InputData will contain external freq. power-sepctra, default value is 0

    - #### useCVersionAIModule

          private int useCVersionAIModule

      whether to use the C version of AI submodules, default value is 0

    - #### voiceProbThr

          private float voiceProbThr

      voice probability threshold 0.0f ~ 1.0f, default value is 0.8

    - #### rmsThr

          private float rmsThr

      rms threshold in dB, default value is -40.0

    - #### jointThr

          private float jointThr

      joint threshold in dB, default value is 0.0

    - #### aggressive

          private float aggressive

      aggressive factor, greater value means more aggressive, default value is 5.0

    - #### startRecognizeCount

          private int startRecognizeCount

      start recognize count, buffer size for 10ms 16KHz 16bit 1channel PCM, default value is 10

    - #### stopRecognizeCount

          private int stopRecognizeCount

      stop recognize count, buffer size for 10ms 16KHz 16bit 1channel PCM, default value is 6

    - #### preStartRecognizeCount

          private int preStartRecognizeCount

      pre start recognize count, buffer size for 10ms 16KHz 16bit 1channel PCM, default value is 10

    - #### activePercent

          private float activePercent

      active percent, if over this percent, will be recognized as speaking, default value is 0.6

    - #### inactivePercent

          private float inactivePercent

      inactive percent, if below this percent, will be recognized as non-speaking, default value is 0.2

  - ### Constructor Detail

    - #### AgoraAudioVadConfig

          public AgoraAudioVadConfig()

      Creates a configuration with default thresholds and counters.

    - #### AgoraAudioVadConfig

          public AgoraAudioVadConfig(int fftSz,
                                     int hopSz,
                                     int anaWindowSz,
                                     int frqInputAvailableFlag,
                                     int useCVersionAIModule,
                                     float voiceProbThr,
                                     float rmsThr,
                                     float jointThr,
                                     float aggressive,
                                     int startRecognizeCount,
                                     int stopRecognizeCount,
                                     int preStartRecognizeCount,
                                     float activePercent,
                                     float inactivePercent)

      Creates a configuration with custom parameters.
      Parameters:
        `fftSz` - FFT window size
        `hopSz` - Hop size for FFT
        `anaWindowSz` - Window size used to calculate RMS
        `frqInputAvailableFlag` - Flag indicating external frequency spectra availability
        `useCVersionAIModule` - Flag indicating whether to use C AI modules
        `voiceProbThr` - Voice probability threshold
        `rmsThr` - RMS threshold in dB
        `jointThr` - Joint threshold in dB
        `aggressive` - Aggressiveness factor
        `startRecognizeCount` - Frames required to enter speaking state
        `stopRecognizeCount` - Frames required to leave speaking state
        `preStartRecognizeCount` - Frames buffered before recognizing speaking
        `activePercent` - Percentage threshold to treat as speaking
        `inactivePercent` - Percentage threshold to treat as silence

  - ### Method Detail

    - #### getFftSz

          public int getFftSz()

      Returns the FFT size used by the detector.
      Returns:
        FFT size

    - #### setFftSz

          public void setFftSz(int fftSz)

      Sets the FFT size used by the detector.
      Parameters:
        `fftSz` - FFT size

    - #### getHopSz

          public int getHopSz()

      Returns the FFT hop size.
      Returns:
        Hop size

    - #### setHopSz

          public void setHopSz(int hopSz)

      Sets the FFT hop size.
      Parameters:
        `hopSz` - Hop size

    - #### getAnaWindowSz

          public int getAnaWindowSz()

      Returns the analysis window size.
      Returns:
        Analysis window size

    - #### setAnaWindowSz

          public void setAnaWindowSz(int anaWindowSz)

      Sets the analysis window size.
      Parameters:
        `anaWindowSz` - Analysis window size

    - #### getFrqInputAvailableFlag

          public int getFrqInputAvailableFlag()

      Returns the flag indicating external frequency input.
      Returns:
        Frequency input flag

    - #### setFrqInputAvailableFlag

          public void setFrqInputAvailableFlag(int frqInputAvailableFlag)

      Sets the flag indicating external frequency input.
      Parameters:
        `frqInputAvailableFlag` - Frequency input flag

    - #### getUseCVersionAIModule

          public int getUseCVersionAIModule()

      Returns the flag for using the C AI modules.
      Returns:
        C AI module flag

    - #### setUseCVersionAIModule

          public void setUseCVersionAIModule(int useCVersionAIModule)

      Sets the flag for using the C AI modules.
      Parameters:
        `useCVersionAIModule` - C AI module flag

    - #### getVoiceProbThr

          public float getVoiceProbThr()

      Returns the voice probability threshold.
      Returns:
        Voice probability threshold

    - #### setVoiceProbThr

          public void setVoiceProbThr(float voiceProbThr)

      Sets the voice probability threshold.
      Parameters:
        `voiceProbThr` - Voice probability threshold

    - #### getRmsThr

          public float getRmsThr()

      Returns the RMS threshold in dB.
      Returns:
        RMS threshold

    - #### setRmsThr

          public void setRmsThr(float rmsThr)

      Sets the RMS threshold in dB.
      Parameters:
        `rmsThr` - RMS threshold

    - #### getJointThr

          public float getJointThr()

      Returns the joint threshold in dB.
      Returns:
        Joint threshold

    - #### setJointThr

          public void setJointThr(float jointThr)

      Sets the joint threshold in dB.
      Parameters:
        `jointThr` - Joint threshold

    - #### getAggressive

          public float getAggressive()

      Returns the aggressiveness factor.
      Returns:
        Aggressiveness factor

    - #### setAggressive

          public void setAggressive(float aggressive)

      Sets the aggressiveness factor.
      Parameters:
        `aggressive` - Aggressiveness factor

    - #### getStartRecognizeCount

          public int getStartRecognizeCount()

      Returns the frames required to start recognition.
      Returns:
        Start recognition count

    - #### setStartRecognizeCount

          public void setStartRecognizeCount(int startRecognizeCount)

      Sets the frames required to start recognition.
      Parameters:
        `startRecognizeCount` - Start recognition count

    - #### getStopRecognizeCount

          public int getStopRecognizeCount()

      Returns the frames required to stop recognition.
      Returns:
        Stop recognition count

    - #### setStopRecognizeCount

          public void setStopRecognizeCount(int stopRecognizeCount)

      Sets the frames required to stop recognition.
      Parameters:
        `stopRecognizeCount` - Stop recognition count

    - #### getPreStartRecognizeCount

          public int getPreStartRecognizeCount()

      Returns the pre-start recognition buffer size.
      Returns:
        Pre-start recognition count

    - #### setPreStartRecognizeCount

          public void setPreStartRecognizeCount(int preStartRecognizeCount)

      Sets the pre-start recognition buffer size.
      Parameters:
        `preStartRecognizeCount` - Pre-start recognition count

    - #### getActivePercent

          public float getActivePercent()

      Returns the percentage threshold for active detection.
      Returns:
        Active percentage

    - #### setActivePercent

          public void setActivePercent(float activePercent)

      Sets the percentage threshold for active detection.
      Parameters:
        `activePercent` - Active percentage

    - #### getInactivePercent

          public float getInactivePercent()

      Returns the percentage threshold for inactivity detection.
      Returns:
        Inactive percentage

    - #### setInactivePercent

          public void setInactivePercent(float inactivePercent)

      Sets the percentage threshold for inactivity detection.
      Parameters:
        `inactivePercent` - Inactive percentage

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`