當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。