当前位置: 首页>>代码示例>>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;未经允许,请勿转载。