TakwayBoard/tools/audio_ayalize.py

11 lines
393 B
Python
Raw 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.

import wave
# 读取wave文件并打印采样率、量化位数、声道数
# 读取wave文件并打印data长度
with wave.open('output_1708083097.9604511.wav', 'rb') as f:
data = f.readframes(f.getnframes())
print(len(data))
print(type(data))
nchannels, sampwidth, framerate, nframes, comptype, compname = f.getparams()
print(framerate, sampwidth, nchannels)