Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# NS API Structure Definitions

group ns_defs

  Defines

  NS_FRAME_ADVANCE

    Length of the frame of data on which the NS will operate.

  NS_PROC_FRAME_LENGTH

    Time domain samples block length used internally.

  NS_PROC_FRAME_BINS

    Number of bins of spectrum data computed when doing a DFT of a NS_PROC_FRAME_LENGTH length time domain vector. The NS_PROC_FRAME_BINS spectrum values represent the bins from DC to Nyquist.

  NS_INT_EXP

    The exponent used internally to keep q1.31 format.

  NS_WINDOW_LENGTH

    The length of the window applied in time domain

  struct ns_state_t
    #include <ns_state.h>

    NS state structure.

    This structure holds the current state of the NS instance and members are updated each time that `ns_process_frame()` runs. Many of these members are exponentially-weighted moving averages (EWMA) which influence the behaviour of the NS filter. The user should not directly modify any of these members.

    Public Members

    bfp_s32_t S

      BFP structure to hold the local energy.

    bfp_s32_t S_min

      BFP structure to hold the minimum local energy within 10 frames.

    bfp_s32_t S_tmp

      BFP structure to hold the temporary local energy.

    bfp_s32_t p

      BFP structure to hold the conditional signal presence probability

    bfp_s32_t alpha_d_tilde

      BFP structure to hold the time-varying smoothing parameter.

    bfp_s32_t lambda_hat

      BFP structure to hold the noise estimation.

    int32_t data_S[NS_PROC_FRAME_BINS]

      int32_t array to hold the data for S.

    int32_t data_S_min[NS_PROC_FRAME_BINS]

      int32_t array to hold the data for S_min.

    int32_t data_S_tmp[NS_PROC_FRAME_BINS]

      int32_t array to hold the data for S_tmp.

    int32_t data_p[NS_PROC_FRAME_BINS]

      int32_t array to hold the data for p.

    int32_t data_adt[NS_PROC_FRAME_BINS]

      int32_t array to hold the data for alpha_d_tilde.

    int32_t data_lambda_hat[NS_PROC_FRAME_BINS]

      int32_t array to hold the data for lambda_hat.

    bfp_s32_t prev_frame

      BFP structure to hold the previous frame.

    bfp_s32_t overlap

      BFP structure to hold the overlap.

    bfp_s32_t wind

      BFP structure to hold the first part of the window.

    bfp_s32_t rev_wind

      BFP structure to hold the second part of the window.

    int32_t data_prev_frame[NS_PROC_FRAME_LENGTH - NS_FRAME_ADVANCE]

      int32_t array to hold the data for prev_frame.

    int32_t data_ovelap[NS_FRAME_ADVANCE]

      int32_t array to hold the data for overlap.

    int32_t data_rev_wind[NS_WINDOW_LENGTH / 2]

      int32_t array to hold the data for rev_wind.

    float_s32_t delta

      EWMA of the energy ratio to calculate p.

    float_s32_t alpha_d

      EWMA of the smoothing parameter for alpha_d_tilde.

    float_s32_t alpha_s

      EWMA of the smoothing parameter for S.

    float_s32_t alpha_p

      EWMA of the smoothing parameter for p.

    float_s32_t one_minus_aplha_d

      EWMA of the 1 - alpha_d parameter.

    float_s32_t one_minus_alpha_s

      EWMA of the 1 - alpha_s parameter.

    float_s32_t one_minus_alpha_p

      EWMA of the 1 - alpha_p parameter.

    unsigned reset_period

      Filter reset period value for auto-reset.

    unsigned reset_counter

      Filter reset counter.