def reconstruct_wav(wavmat, stride_factor=0.5):
    '\n  Reconstructs the audiofile from sliced matrix wavmat\n  '
    window_length = wavmat.shape[1]
    window_stride = int((stride_factor * window_length))
    wav_length = (((wavmat.shape[0] - 1) * window_stride) + window_length)
    wav_recon = np.zeros((1, wav_length))
    for k in range(wavmat.shape[0]):
        wav_beg = (k * window_stride)
        wav_end = (wav_beg + window_length)
        wav_recon[0, wav_beg:wav_end] += wavmat[k, :]
    noverlap = int(np.ceil((1 / stride_factor)))
    scale_ = ((1 / float(noverlap)) * np.ones((1, wav_length)))
    for s in range((noverlap - 1)):
        s_beg = (s * window_stride)
        s_end = (s_beg + window_stride)
        scale_[0, s_beg:s_end] = (1 / (s + 1))
        scale_[0, ((- s_beg) - 1):(- s_end):(- 1)] = (1 / (s + 1))
    return (wav_recon * scale_)
Reconstructs the audiofile from sliced matrix wavmat
def reconstruct_wav(wavmat, stride_factor=0.5):
    '\n  \n  '
    window_length = wavmat.shape[1]
    window_stride = int((stride_factor * window_length))
    wav_length = (((wavmat.shape[0] - 1) * window_stride) + window_length)
    wav_recon = np.zeros((1, wav_length))
    for k in range(wavmat.shape[0]):
        wav_beg = (k * window_stride)
        wav_end = (wav_beg + window_length)
        wav_recon[0, wav_beg:wav_end] += wavmat[k, :]
    noverlap = int(np.ceil((1 / stride_factor)))
    scale_ = ((1 / float(noverlap)) * np.ones((1, wav_length)))
    for s in range((noverlap - 1)):
        s_beg = (s * window_stride)
        s_end = (s_beg + window_stride)
        scale_[0, s_beg:s_end] = (1 / (s + 1))
        scale_[0, ((- s_beg) - 1):(- s_end):(- 1)] = (1 / (s + 1))
    return (wav_recon * scale_)