Files
Obsidian-Main/00.01. 雜/使用 librosa 做 mel spectrogram.md
Awin Huang afeb207be2 vault backup: 2025-08-20 14:35:48
Affected files:
Too many files to list
2025-08-20 14:35:48 +08:00

13 lines
620 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
由於人類會對低頻低音高的片段更感興趣,所以會對通過 FFT 變換得到的 Amplitude 和 Frequency。
[[Mel spectrogram]] 和 spectrogram 的差別就是 mel spectrogram 的頻率是 mel scale 變換後的頻率你可以想像把Spectrogram整體往下壓
```python
mel_spect = librosa.feature.melspectrogram(y=y, sr=sr, n fft=2048, hop_Iength=1024)
mel_spect = librosa.power_to_db(mel_spect, ref=np.max)
librosa.display.specshow(mel_spect, y_axis='mel', fmax=8000, x_axis='time')
plt.title('Mel Spectrogram')
p1t.colorbar(format='%+2.0f dB')
```
Output:
![[Pasted image 20231212181946.png]]