"CHUNK" is the number of frames in the buffer. Each frame will have 2 samples as "CHANNELS=2". Size of each sample is 2 bytes, calculated using the function: pyaudio. get_sample_size(pyaudio.
What is frames per buffer in PyAudio?
To be able to stream audio to AssemblyAI, we first need to open up an audio stream with PyAudio. Creating a stream requires some parameters: The number of frames per buffer (3200). A buffer is a chunk of an arbitrary number of frames that is used to break the original signal into smaller pieces.
How does PyAudio work?
PyAudio provides Python bindings for PortAudio v19, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio on a variety of platforms, such as GNU/Linux, Microsoft Windows, and Apple macOS. PyAudio is distributed under the MIT License.