示例#1
0
def no_overlap(D):

    if D == 1:
        x_local = x[:, 0]
    else:
        x_local = x[:, :D]

    hop = block_size

    # analysis
    X = analysis(x_local, L=block_size, hop=hop)

    # synthesis
    x_r = synthesis(X, L=block_size, hop=hop)

    return pra.dB(np.max(np.abs(x_local - x_r)))
示例#2
0
def half_overlap(D):

    if D == 1:
        x_local = x[:, 0]
    else:
        x_local = x[:, :D]

    hop = block_size//2

    # analysis
    analysis_win = pra.hann(block_size)
    X = analysis(x_local, L=block_size, hop=hop, win=analysis_win)

    # synthesis
    x_r = synthesis(X, L=block_size, hop=hop)

    return pra.dB(np.max(np.abs(x_local[:-hop, ] - x_r[hop:, ])))
示例#3
0
def hop_one_sample(D):

    if D == 1:
        x_local = x[:, 0]
    else:
        x_local = x[:, :D]

    hop = 1

    # analysis
    analysis_win = pra.hann(block_size)
    X = analysis(x_local, L=block_size, hop=hop, win=analysis_win)

    # synthesis
    synthesis_win = pra.transform.compute_synthesis_window(analysis_win, hop)
    x_r = synthesis(X, L=block_size, hop=hop, win=synthesis_win)

    return pra.dB(
        np.max(np.abs(x_local[:-block_size + hop, ] -
                      x_r[block_size - hop:, ])))
示例#4
0
def append_one_sample(D):
    hop = block_size // 2
    n_samples = x.shape[0]
    n_frames = n_samples // hop
    x_local = x[:n_frames * hop - 1, :]

    if D == 1:
        x_local = x_local[:, 0]
    else:
        x_local = x_local[:, :D]

    # analysis
    analysis_win = pra.hann(block_size)
    X = analysis(x_local, L=block_size, hop=hop, win=analysis_win)

    # synthesis
    x_r = synthesis(X, L=block_size, hop=hop)

    return pra.dB(
        np.max(
            np.abs(x_local[:-block_size + hop, ] -
                   x_r[block_size - hop:-1, ])))