def get_window()

in sing/dsp.py [0:0]


def get_window(name, window_length, squared=False):
    """
    Returns a windowing function.

    Arguments:
        window (str): name of the window, currently only 'hann' is available
        window_length (int): length of the window
        squared (bool): if true, square the window

    Returns:
        torch.FloatTensor: window of size `window_length`
    """
    if name == "hann":
        window = torch.hann_window(window_length)
    else:
        raise ValueError("Invalid window name {}".format(name))
    if squared:
        window *= window
    return window