推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
MiketsuSmasher
V2EX  ›  Python

使用 pyaudio 播放音乐时碰到的一些奇奇怪怪的问题

  •  
  •   MiketsuSmasher · Sep 19, 2021 · 2253 views
    This topic created in 1840 days ago, the information mentioned may be changed or developed.
    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))
    

    发现一些奇怪的问题:

    1. 播放时会间歇性的出现一些间隔极小的中断
    2. 24-bit ( pcm_s32le )的音频文件在播放时会有极为吵闹的杂音
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   941 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 23:40 · PVG 07:40 · LAX 16:40 · JFK 19:40
    ♥ Do have faith in what you're doing.