
9

使用 pyaudio 播放音乐时碰到的一些奇奇怪怪的问题
source link: https://www.v2ex.com/t/802987
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

from pydub import AudioSegment
from pyaudio import PyAudio
segment = AudioSegment.from_file('test.flac')
PAIMON = PyAudio()
stream = PAIMON.open(format=PAIMON.get_format_from_width(segment.sample_width), channels=segment.channels, rate=segment.frame_rate, output=True)
for frame_index in range(int(segment.frame_count())):
stream.write(segment.get_frame(frame_index))
发现一些奇怪的问题:
- 播放时会间歇性的出现一些间隔极小的中断
- 24-bit ( pcm_s32le )的音频文件在播放时会有极为吵闹的杂音
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK