我创建了一个 114dB 1KHz 的信号,并想用 librosa stft 绘制功率谱。但我在频谱中看到低频,也看到了其他频率的峰值。我不确定我在这里做错了什么。 在此处绘图 -> FFT spectrum, Power avg plot
y, sr = librosa.load('Noise Recorder (RMS)_APxRecordedAudio.wav',sr=None,duration=10)
print(y.shape, sr)
# Plot 1
fig, ax = plt.subplots(2,2)
librosa.display.waveplot(y, sr, ax=ax[0,0])
n_fft = 8192 # FFT Length
S = librosa.stft(y=y,n_fft=n_fft,win_length=n_fft,hop_length=n_fft,window='hann') # Short FFT
F = librosa.fft_frequencies(sr=sr, n_fft=n_fft) # Frequency components
Abs = np.abs(S) # Same as mag, phase = librosa.magphase(S)
Abs_mean = np.mean(Abs, axis = 1) # Mean
Power_avg =librosa.power_to_db(Abs_mean**2) # dB
Scale_dB = 86.85 # Scaling factor
Power_Scaled_dB = Power_avg + Scale_dB # Scaled dB # Max: 114dB