Audio Quality
chenbys opened this issue · comments
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.
BTY, is there any other setting for the best quality and smallest file size?
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.
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
Thank you very much!