Python librosa.db_to_amplitude() Examples

The following are 7 code examples of librosa.db_to_amplitude(). 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.py    From parallel-wavenet-vocoder with MIT License 5 votes vote down vote up
def db2amp(db):
    return librosa.db_to_amplitude(db) 
Example #2
Source File: audio.py    From voice-vector with MIT License 5 votes vote down vote up
def db2amp(db):
    return librosa.db_to_amplitude(db) 
Example #3
Source File: audio.py    From deep-voice-conversion with MIT License 5 votes vote down vote up
def db2amp(db):
    return librosa.db_to_amplitude(db) 
Example #4
Source File: data_tools.py    From Speech-enhancement with MIT License 5 votes vote down vote up
def magnitude_db_and_phase_to_audio(frame_length, hop_length_fft, stftaudio_magnitude_db, stftaudio_phase):
    """This functions reverts a spectrogram to an audio"""

    stftaudio_magnitude_rev = librosa.db_to_amplitude(stftaudio_magnitude_db, ref=1.0)

    # taking magnitude and phase of audio
    audio_reverse_stft = stftaudio_magnitude_rev * stftaudio_phase
    audio_reconstruct = librosa.core.istft(audio_reverse_stft, hop_length=hop_length_fft, length=frame_length)

    return audio_reconstruct 
Example #5
Source File: audio.py    From Multilingual_Text_to_Speech with MIT License 5 votes vote down vote up
def db_to_amplitude(x):
    """Convert decibels to amplitude."""
    return librosa.db_to_amplitude(x) 
Example #6
Source File: audio.py    From Multilingual_Text_to_Speech with MIT License 5 votes vote down vote up
def linear_to_mel(S):
    """Convert linear to mel spectrogram (this does not return the same spec. as mel_spec. method due to the db->amplitude conversion)."""
    S = db_to_amplitude(S)
    S = librosa.feature.melspectrogram(S=S, sr=hp.sample_rate, n_mels=hp.num_mels)
    return amplitude_to_db(S) 
Example #7
Source File: audio.py    From Multilingual_Text_to_Speech with MIT License 5 votes vote down vote up
def inverse_spectrogram(s, mel=False):
    """Convert log-magnitude spectrogram to waveform."""
    S = db_to_amplitude(s)
    wf = ms_to_frames(hp.stft_window_ms)
    hf = ms_to_frames(hp.stft_shift_ms)
    if mel: S = librosa.feature.inverse.mel_to_stft(S, power=1, sr=hp.sample_rate, n_fft=hp.num_fft)
    y = librosa.griffinlim(S ** hp.griffin_lim_power, n_iter=hp.griffin_lim_iters, hop_length=hf, win_length=wf)
    if hp.use_preemphasis: y = deemphasis(y)
    y /= max(y)
    return y