0

I use pyaudio library to read sound from audiocard. I use the following code

stream = pyaudio.PyAudio().open(format=pyaudio.paInt16, channels=2,
                                rate=44100, input=True,
                                frames_per_buffer=1024)

CHUNK = 1024
frames = []
for i in range(0, int(44100 / 1024 * seconds)):
    data = stream.read(CHUNK)
    frames.append(data)

I want to know what is one frame, what is one chunk and what is their format. It seems like there's no such info in the library description.

Dimitrius
  • 564
  • 6
  • 21

1 Answers1

0

For anybody hopping in later:

A sample is a single float32 value that represents the value of the audio stream at each specific point in time, in a specific channel (left or right, if in the case of stereo).

A frame, is the set of all values for all channels that will play at a specific point in time.

Taken from : Mozilla webaudio description

Format: paInt16 is a format to store those sample data as a 16-bit integer value.

DATA: It is the number of frames specified by CHUNK value you are taking at one time from the stream. Think of stream as collection of frames.

waterbyte
  • 241
  • 1
  • 16