當前位置: 首頁>>代碼示例>>Python>>正文


Python lws.lws方法代碼示例

本文整理匯總了Python中lws.lws方法的典型用法代碼示例。如果您正苦於以下問題:Python lws.lws方法的具體用法?Python lws.lws怎麽用?Python lws.lws使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在lws的用法示例。


在下文中一共展示了lws.lws方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: import lws [as 別名]
# 或者: from lws import lws [as 別名]
def main():
    data_foler = "data"
    wavs = [os.path.join(data_foler, file[:-4]) for file in os.listdir(data_foler) if file.endswith(".wav")]
    outputs_lws = [file + ".lws.gen.wav" for file in wavs]
    wavs = [audio.load_wav(wav_path + ".wav", hparams.sample_rate) for wav_path in wavs]

    lws_processor = lws.lws(512, 128, mode="speech")  # 512: window length; 128: window shift
    i = 0
    for x in wavs:
        X = lws_processor.stft(x)  # where x is a single-channel waveform
        X0 = np.abs(X)  # Magnitude spectrogram
        print('{:6}: {:5.2f} dB'.format('Abs(X)', lws_processor.get_consistency(X0)))
        X1 = lws_processor.run_lws(
            X0)  # reconstruction from magnitude (in general, one can reconstruct from an initial complex spectrogram)
        print(X1.shape)
        print('{:6}: {:5.2f} dB'.format('LWS', lws_processor.get_consistency(X1)))
        print(X1.shape)
        wav = lws_processor.istft(X1).astype(np.float32)

        audio.save_wav(wav, outputs_lws[i])
        i += 1 
開發者ID:candlewill,項目名稱:Griffin_lim,代碼行數:23,代碼來源:LWS.py

示例2: _lws_processor

# 需要導入模塊: import lws [as 別名]
# 或者: from lws import lws [as 別名]
def _lws_processor(hparams):
	import lws
	return lws.lws(hparams.n_fft, get_hop_size(hparams), fftsize=hparams.win_size, mode="speech") 
開發者ID:Rayhane-mamah,項目名稱:Tacotron-2,代碼行數:5,代碼來源:audio.py

示例3: _istft

# 需要導入模塊: import lws [as 別名]
# 或者: from lws import lws [as 別名]
def _istft(y, hparams):
	return librosa.istft(y, hop_length=get_hop_size(hparams), win_length=hparams.win_size)

##########################################################
#Those are only correct when using lws!!! (This was messing with Wavenet quality for a long time!) 
開發者ID:Rayhane-mamah,項目名稱:Tacotron-2,代碼行數:7,代碼來源:audio.py

示例4: _lws_processor

# 需要導入模塊: import lws [as 別名]
# 或者: from lws import lws [as 別名]
def _lws_processor(hparams):
    import lws
    return lws.lws(hparams.fft_size, get_hop_size(hparams), fftsize=hparams.win_size, mode="speech") 
開發者ID:hccho2,項目名稱:Tacotron-Wavenet-Vocoder-Korean,代碼行數:5,代碼來源:audio.py

示例5: _istft

# 需要導入模塊: import lws [as 別名]
# 或者: from lws import lws [as 別名]
def _istft(y, hparams):
    return librosa.istft(y, hop_length=get_hop_size(hparams), win_length=hparams.win_size)

##########################################################
#Those are only correct when using lws!!! (This was messing with Wavenet quality for a long time!) 
開發者ID:hccho2,項目名稱:Tacotron-Wavenet-Vocoder-Korean,代碼行數:7,代碼來源:audio.py

示例6: _lws_processor

# 需要導入模塊: import lws [as 別名]
# 或者: from lws import lws [as 別名]
def _lws_processor():
    return lws.lws(hparams.fft_size, hparams.hop_size, mode="speech")


# Conversions: 
開發者ID:G-Wang,項目名稱:WaveRNN-Pytorch,代碼行數:7,代碼來源:audio.py

示例7: _lws_processor

# 需要導入模塊: import lws [as 別名]
# 或者: from lws import lws [as 別名]
def _lws_processor():
    return lws.lws(hparams.fft_size, get_hop_size(), mode="speech") 
開發者ID:kastnerkyle,項目名稱:representation_mixing,代碼行數:4,代碼來源:audio.py

示例8: lws_num_frames

# 需要導入模塊: import lws [as 別名]
# 或者: from lws import lws [as 別名]
def lws_num_frames(length, fsize, fshift):
    """Compute number of time frames of lws spectrogram
    """
    pad = (fsize - fshift)
    if length % fshift == 0:
        M = (length + pad * 2 - fsize) // fshift + 1
    else:
        M = (length + pad * 2 - fsize) // fshift + 2
    return M 
開發者ID:kastnerkyle,項目名稱:representation_mixing,代碼行數:11,代碼來源:audio.py

示例9: lws_pad_lr

# 需要導入模塊: import lws [as 別名]
# 或者: from lws import lws [as 別名]
def lws_pad_lr(x, fsize, fshift):
    """Compute left and right padding lws internally uses
    """
    M = lws_num_frames(len(x), fsize, fshift)
    pad = (fsize - fshift)
    T = len(x) + 2 * pad
    r = (M - 1) * fshift + fsize - T
    return pad, pad + r

# Conversions: 
開發者ID:kastnerkyle,項目名稱:representation_mixing,代碼行數:12,代碼來源:audio.py


注:本文中的lws.lws方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。