Member Junction
    Preparing search index...
    • Resamples a block of linear PCM16 samples from fromRate to toRate using linear interpolation.

      Handles the telephony rate set (8 k ↔ 16 k ↔ 24 k) and any other positive integer rates. When the rates are equal the input is returned as a fresh copy (never the same reference, so callers can mutate freely). The output length is round(input.length * toRate / fromRate).

      Parameters

      • input: Int16Array

        The source PCM16 samples (mono).

      • fromRate: number

        The source sample rate in Hz (must be > 0).

      • toRate: number

        The target sample rate in Hz (must be > 0).

      Returns Int16Array

      The resampled PCM16 samples at toRate.

      when either rate is not a positive finite number.