s0d3s / PyAudioWPatch

🐍 PyAudio | PortAudio fork with WASAPI loopback support 🔊 Record audio from speakers on Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Audio Quality

chenbys opened this issue · comments

commented

Thanks for the awesome codes. But I wonder how to record with the best quality.

I notice that we could set format=pyaudio.paInt32 or format=p.get_format_from_width(wf.getsampwidth()), and what's the difference?
Is the pyaudio.paFloat32 optimal?

Is the recorded quality also limited by the speaker device? If so, use pyaudio.paFloat32 may be unnecessary for some inferior speaker.

Therefore, how can I record my speaker with the best quality and smallest file size?
Thanks in advance.

commented

BTY, is there any other setting for the best quality and smallest file size?

commented

Hello🖐

Theoretically - yes, if you take a more capacious data type, then it can accommodate a better record. But in practice, you will not feel much difference in sound. They are just different formats for presenting data. The choice of format depends mainly on what it will be more convenient for you to work with during further processing of the recording.

source

About the file size:
This library provides a pure, uncompressed data stream. If you need to reduce the final recording size, you can manually pass the recording through codecs yourself. For example, using flac.
pyFLAC
Example. The article uses the sounddevice library, but the code can easily be rewritten for PyAudio

commented

Thank you very much!