pyroomacoustics.windows module

A collection of windowing functions.

pyroomacoustics.windows.blackman_harris(N, flag='asymmetric', length='full')

The Hann window function

\[w[n] = a_0 - a_1 \cos(2\pi n/M) + a_2 \cos(4\pi n/M) + a_3 \cos(6\pi n/M), n=0,\ldots,N-1\]
Parameters:
  • N (int) – the window length
  • flag (string, optional) –

    Possible values

    • asymmetric: asymmetric windows are used for overlapping transforms (\(M=N\))
    • symmetric: the window is symmetric (\(M=N-1\))
  • length (string, optional) –

    Possible values

    • full: the full length window is computed
    • right: the right half of the window is computed
    • left: the left half of the window is computed
pyroomacoustics.windows.cosine(N, flag='asymmetric', length='full')

The cosine window function

\[w[n] = \cos(\pi (n/M - 0.5))^2\]
Parameters:
  • N (int) – the window length
  • flag (string, optional) –

    Possible values

    • asymmetric: asymmetric windows are used for overlapping transforms (\(M=N\))
    • symmetric: the window is symmetric (\(M=N-1\))
    • mdct: impose MDCT condition on the window (\(M=N-1\) and \(w[n]^2 + w[n+N/2]^2=1\))
  • length (string, optional) –

    Possible values

    • full: the full length window is computed
    • right: the right half of the window is computed
    • left: the left half of the window is computed
pyroomacoustics.windows.hann(N, flag='asymmetric', length='full')

The Hann window function

\[w[n] = 0.5 (1 - \cos(2 \pi n / M)), n=0,\ldots,N-1\]
Parameters:
  • N (int) – the window length
  • flag (string, optional) –

    Possible values

    • asymmetric: asymmetric windows are used for overlapping transforms (\(M=N\))
    • symmetric: the window is symmetric (\(M=N-1\))
    • mdct: impose MDCT condition on the window (\(M=N-1\) and \(w[n]^2 + w[n+N/2]^2=1\))
  • length (string, optional) –

    Possible values

    • full: the full length window is computed
    • right: the right half of the window is computed
    • left: the left half of the window is computed
pyroomacoustics.windows.rect(N)

The rectangular window

\[w[n] = 1, n=0,\ldots,N-1\]
Parameters:N (int) – the window length
pyroomacoustics.windows.triang(N, flag='asymmetric', length='full')

The triangular window function

\[w[n] = 1 - | 2 n / M - 1 |, n=0,\ldots,N-1\]
Parameters:
  • N (int) – the window length
  • flag (string, optional) –

    Possible values

    • asymmetric: asymmetric windows are used for overlapping transforms (\(M=N\))
    • symmetric: the window is symmetric (\(M=N-1\))
    • mdct: impose MDCT condition on the window (\(M=N-1\) and \(w[n]^2 + w[n+N/2]^2=1\))
  • length (string, optional) –

    Possible values

    • full: the full length window is computed
    • right: the right half of the window is computed
    • left: the left half of the window is computed