本文整理匯總了Python中librosa.db_to_amplitude方法的典型用法代碼示例。如果您正苦於以下問題:Python librosa.db_to_amplitude方法的具體用法?Python librosa.db_to_amplitude怎麽用?Python librosa.db_to_amplitude使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類librosa
的用法示例。
在下文中一共展示了librosa.db_to_amplitude方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: db2amp
# 需要導入模塊: import librosa [as 別名]
# 或者: from librosa import db_to_amplitude [as 別名]
def db2amp(db):
return librosa.db_to_amplitude(db)
示例2: magnitude_db_and_phase_to_audio
# 需要導入模塊: import librosa [as 別名]
# 或者: from librosa import db_to_amplitude [as 別名]
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
示例3: db_to_amplitude
# 需要導入模塊: import librosa [as 別名]
# 或者: from librosa import db_to_amplitude [as 別名]
def db_to_amplitude(x):
"""Convert decibels to amplitude."""
return librosa.db_to_amplitude(x)
示例4: linear_to_mel
# 需要導入模塊: import librosa [as 別名]
# 或者: from librosa import db_to_amplitude [as 別名]
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)
示例5: inverse_spectrogram
# 需要導入模塊: import librosa [as 別名]
# 或者: from librosa import db_to_amplitude [as 別名]
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