Python librosa.filters() Examples
The following are 26
code examples of librosa.filters().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
librosa
, or try the search function
.
Example #1
Source File: audio_utils.py From WaveGlow with MIT License | 5 votes |
def _build_mel_basis(): n_fft = hparams.n_fft return librosa.filters.mel(hparams.sample_rate, n_fft, n_mels=hparams.num_mels)
Example #2
Source File: audio.py From representation_mixing with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #3
Source File: audio.py From representation_mixing with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #4
Source File: audio.py From representation_mixing with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #5
Source File: audio.py From representation_mixing with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #6
Source File: audio.py From style-token_tacotron2 with MIT License | 5 votes |
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)
Example #7
Source File: audio.py From Tacotron2-Wavenet-Korean-TTS with MIT License | 5 votes |
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
Example #8
Source File: audio.py From Tacotron2-PyTorch with MIT License | 5 votes |
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)
Example #9
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
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)
Example #10
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
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)
Example #11
Source File: audio.py From WaveRNN-Pytorch with MIT License | 5 votes |
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)
Example #12
Source File: audio.py From Griffin_lim with MIT License | 5 votes |
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)
Example #13
Source File: audio.py From tacotron with MIT License | 5 votes |
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)
Example #14
Source File: audio.py From tacotron2-mandarin-griffin-lim with MIT License | 5 votes |
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)
Example #15
Source File: audio.py From cnn_vocoder with MIT License | 5 votes |
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)
Example #16
Source File: audio.py From Tacotron-Wavenet-Vocoder-Korean with MIT License | 5 votes |
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
Example #17
Source File: audio.py From ZeroSpeech-TTS-without-T with MIT License | 5 votes |
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)
Example #18
Source File: audio.py From Tacotron-2 with MIT License | 5 votes |
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)
Example #19
Source File: audio.py From arabic-tacotron-tts with MIT License | 5 votes |
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)
Example #20
Source File: audio.py From libfaceid with MIT License | 5 votes |
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)
Example #21
Source File: audio.py From vae_tacotron2 with MIT License | 5 votes |
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)
Example #22
Source File: audio.py From vae_tacotron2 with MIT License | 5 votes |
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)
Example #23
Source File: audio.py From vae_tacotron with MIT License | 5 votes |
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)
Example #24
Source File: utils.py From Tacotron-pytorch with MIT License | 5 votes |
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
Example #25
Source File: speech_utils.py From OpenSeq2Seq with Apache License 2.0 | 4 votes |
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
Example #26
Source File: speech_utils.py From OpenSeq2Seq with Apache License 2.0 | 4 votes |
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