当前位置: 首页>>代码示例>>Python>>正文


Python librosa.filters方法代码示例

本文整理汇总了Python中librosa.filters方法的典型用法代码示例。如果您正苦于以下问题:Python librosa.filters方法的具体用法?Python librosa.filters怎么用?Python librosa.filters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在librosa的用法示例。


在下文中一共展示了librosa.filters方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis():
    n_fft = (hparams.num_freq - 1) * 2
    return librosa.filters.mel(hparams.sample_rate, n_fft, n_mels=hparams.num_mels) 
开发者ID:candlewill,项目名称:Griffin_lim,代码行数:5,代码来源:audio.py

示例2: __init__

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def __init__(self, sample_rate, num_mels, num_freq, frame_length_ms, frame_shift_ms, preemphasis,
            min_level_db, ref_level_db, griffin_lim_iters, power):
        self.sr = sample_rate
        self.n_mels = num_mels
        self.n_fft = (num_freq - 1) * 2
        self.hop_length = int(frame_shift_ms / 1000 * sample_rate)
        self.win_length = int(frame_length_ms / 1000 * sample_rate)
        self.preemph = preemphasis
        self.min_level_db = min_level_db
        self.ref_level_db = ref_level_db
        self.GL_iter = griffin_lim_iters
        self.mel_basis = librosa.filters.mel(self.sr, self.n_fft, n_mels=self.n_mels)
        self.power = power 
开发者ID:ttaoREtw,项目名称:Tacotron-pytorch,代码行数:15,代码来源:utils.py

示例3: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis():
  n_fft = (hparams.num_freq - 1) * 2
  return librosa.filters.mel(hparams.sample_rate, n_fft, n_mels=hparams.num_mels) 
开发者ID:yanggeng1995,项目名称:vae_tacotron,代码行数:5,代码来源:audio.py

示例4: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis():
	assert hparams.fmax <= hparams.sample_rate // 2
	return librosa.filters.mel(hparams.sample_rate, hparams.fft_size, n_mels=hparams.num_mels,
							   fmin=hparams.fmin, fmax=hparams.fmax) 
开发者ID:rishikksh20,项目名称:vae_tacotron2,代码行数:6,代码来源:audio.py

示例5: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis(hparams):
	assert hparams.fmax <= hparams.sample_rate // 2
	return librosa.filters.mel(hparams.sample_rate, hparams.n_fft, n_mels=hparams.num_mels,
							   fmin=hparams.fmin, fmax=hparams.fmax) 
开发者ID:Rayhane-mamah,项目名称:Tacotron-2,代码行数:6,代码来源:audio.py

示例6: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis():
	n_fft = (config.num_freq - 1) * 2
	return librosa.filters.mel(config.sample_rate, n_fft, n_mels=config.num_mels) 
开发者ID:andi611,项目名称:ZeroSpeech-TTS-without-T,代码行数:5,代码来源:audio.py

示例7: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis(hparams):
    #assert hparams.fmax <= hparams.sample_rate // 2
    
    #fmin: Set this to 55 if your speaker is male! if female, 95 should help taking off noise. (To test depending on dataset. Pitch info: male~[65, 260], female~[100, 525])
    #fmax: 7600, To be increased/reduced depending on data.
    #return librosa.filters.mel(hparams.sample_rate, hparams.fft_size, n_mels=hparams.num_mels,fmin=hparams.fmin, fmax=hparams.fmax)
    return librosa.filters.mel(hparams.sample_rate, hparams.fft_size, n_mels=hparams.num_mels)  # fmin=0, fmax= sample_rate/2.0 
开发者ID:hccho2,项目名称:Tacotron-Wavenet-Vocoder-Korean,代码行数:9,代码来源:audio.py

示例8: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis():
    assert hparams.fmax <= hparams.sample_rate // 2
    return librosa.filters.mel(hparams.sample_rate, n_fft,
                               fmin=hparams.fmin, fmax=hparams.fmax,
                               n_mels=hparams.num_mels) 
开发者ID:tuan3w,项目名称:cnn_vocoder,代码行数:7,代码来源:audio.py

示例9: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis():
    n_fft = hparams.n_fft
    return librosa.filters.mel(hparams.sample_rate, n_fft, n_mels=hparams.num_mels) 
开发者ID:weixsong,项目名称:WaveGlow,代码行数:5,代码来源:audio_utils.py

示例10: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis():
    if hparams.fmax is not None:
        assert hparams.fmax <= hparams.sample_rate // 2
    return librosa.filters.mel(hparams.sample_rate, hparams.fft_size,
                               fmin=hparams.fmin, fmax=hparams.fmax,
                               n_mels=hparams.num_mels) 
开发者ID:G-Wang,项目名称:WaveRNN-Pytorch,代码行数:8,代码来源:audio.py

示例11: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis():
	n_fft = (hps.num_freq - 1) * 2
	return librosa.filters.mel(hps.sample_rate, n_fft, n_mels=hps.num_mels) 
开发者ID:BogiHsu,项目名称:Tacotron2-PyTorch,代码行数:5,代码来源:audio.py

示例12: _build_mel_basis

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def _build_mel_basis():
    assert hparams.fmax <= hparams.sample_rate // 2
    return librosa.filters.mel(hparams.sample_rate, hparams.fft_size,
                               fmin=hparams.fmin, fmax=hparams.fmax,
                               n_mels=hparams.num_mels) 
开发者ID:kastnerkyle,项目名称:representation_mixing,代码行数:7,代码来源:audio.py

示例13: get_mel

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def get_mel(
    log_mag_spec,
    fs=22050,
    n_fft=1024,
    n_mels=80,
    power=2.,
    feature_normalize=False,
    mean=0,
    std=1,
    mel_basis=None,
    data_min=1e-5,
    htk=True,
    norm=None
):
  """
  Method to get mel spectrograms from magnitude spectrograms

  Args:
    log_mag_spec (np.array): log of the magnitude spec
    fs (int): sampling frequency in Hz
    n_fft (int): size of fft window in samples
    n_mels (int): number of mel features
    power (float): power of the mag spectrogram
    feature_normalize (bool): whether the mag spec was normalized
    mean (float): normalization param of mag spec
    std (float): normalization param of mag spec
    mel_basis (np.array): optional pre-computed mel basis to save computational
      time if passed. If not passed, it will call librosa to construct one
    data_min (float): min clip value prior to taking the log.
    htk (bool): whther to compute the mel spec with the htk or slaney algorithm
    norm: Should be None for htk, and 1 for slaney

  Returns:
    np.array: mel_spec with shape [time, n_mels]
  """
  if mel_basis is None:
    mel_basis = librosa.filters.mel(
        fs,
        n_fft,
        n_mels=n_mels,
        htk=htk,
        norm=norm
    )
  log_mag_spec = log_mag_spec * power
  mag_spec = np.exp(log_mag_spec)
  mel_spec = np.dot(mag_spec, mel_basis.T)
  mel_spec = np.log(np.clip(mel_spec, a_min=data_min, a_max=None))
  if feature_normalize:
    mel_spec = normalize(mel_spec, mean, std)
  return mel_spec 
开发者ID:NVIDIA,项目名称:OpenSeq2Seq,代码行数:52,代码来源:speech_utils.py

示例14: inverse_mel

# 需要导入模块: import librosa [as 别名]
# 或者: from librosa import filters [as 别名]
def inverse_mel(
    log_mel_spec,
    fs=22050,
    n_fft=1024,
    n_mels=80,
    power=2.,
    feature_normalize=False,
    mean=0,
    std=1,
    mel_basis=None,
    htk=True,
    norm=None
):
  """
  Reconstructs magnitude spectrogram from a mel spectrogram by multiplying it
  with the transposed mel basis.

  Args:
    log_mel_spec (np.array): log of the mel spec
    fs (int): sampling frequency in Hz
    n_fft (int): size of fft window in samples
    n_mels (int): number of mel features
    power (float): power of the mag spectrogram that was used to generate the
      mel spec
    feature_normalize (bool): whether the mel spec was normalized
    mean (float): normalization param of mel spec
    std (float): normalization param of mel spec
    mel_basis (np.array): optional pre-computed mel basis to save computational
      time if passed. If not passed, it will call librosa to construct one
    htk (bool): whther to compute the mel spec with the htk or slaney algorithm
    norm: Should be None for htk, and 1 for slaney

  Returns:
    np.array: mag_spec with shape [time, n_fft/2 + 1]
  """
  if mel_basis is None:
    mel_basis = librosa.filters.mel(
        fs,
        n_fft,
        n_mels=n_mels,
        htk=htk,
        norm=norm
    )
  if feature_normalize:
    log_mel_spec = denormalize(log_mel_spec, mean, std)
  mel_spec = np.exp(log_mel_spec)
  mag_spec = np.dot(mel_spec, mel_basis)
  mag_spec = np.power(mag_spec, 1. / power)
  return mag_spec 
开发者ID:NVIDIA,项目名称:OpenSeq2Seq,代码行数:51,代码来源:speech_utils.py


注:本文中的librosa.filters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。