ai_test/wav.py

9 lines
372 B
Python

import wave
with wave.open("./wav/7.wav", "rb") as wav_file:
print(f"采样率: {wav_file.getframerate()} Hz")
print(f"声道数: {wav_file.getnchannels()}")
print(f"位深度: {wav_file.getsampwidth() * 8} bits") # 字节转比特
print(f"帧数: {wav_file.getnframes()}")
print(f"时长: {wav_file.getnframes() / wav_file.getframerate():.2f}")