本文整理汇总了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