Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the problem that pydub.playback() can't play 32bit audios with pyaudio correctly #781

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Mar 5, 2024

  1. Fix playback.py

    pydub.playback() can't play 32bit audios with pyaudio correctly because p.get_format_from_width(seg.sample_width) returns "paFloat32" when seg.sample_width is 4, but chunk._data is actually a bunch of 32bit ints, which contradicts the "paFloat32" that means that floats should be given.
    
    So, I fixed the problem by simply adding a judgment of seg.sample_width. If it's not 4, then use the original 
    method; If it is 4, then use "pyaudio._portaudio.paInt32" to output 32bit ints.
    hikali8 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    58d31a2 View commit details
    Browse the repository at this point in the history