Skip to content

Instantly share code, notes, and snippets.

View neverspillover's full-sized avatar
🎯
Focusing

Never Spill Over neverspillover

🎯
Focusing
  • 北京
View GitHub Profile
@neverspillover
neverspillover / voice.py
Last active November 21, 2025 10:27
读取 WAV 文件并绘制时域图、频域图、梅尔图
"""
命令行工具:读取 WAV 文件并绘制时域和频域图(全部注释为中文,包含详细说明)。
使用示例:
python voice.py --file /path/to/file.wav
python voice.py --file /path/to/file.wav --fft-size 4096 --duration 3.5
脚本要点:
- 自动将立体声(多通道)合成单声道(求平均),方便统一分析。
- 将整数 PCM 数据归一化到 [-1, 1] 的浮点数,避免不同位深比较时量纲不一致。