Readframes return 2 bytes in python

When readframes() used in python, the online documentation says that the sampling rate is returning, it returns 2 bytes. I think there are 4 bytes on each frame:

 left = 2 bytes right = 2 bytes 

Do I need to check if it is monaural or stereo, and if it is stereo, read 2 frames at a time, and if it is mono, read one frame at a time?

+6
source share
1 answer

The wave file has:

Each time you execute Wave_read.getframes(N) , you get bytes N * sample_width * n_channels .

So, if you read 2048 frames from 44100Hz, a 16-bit stereo file, you will get 8192 bytes as a result.

+5
source

Source: https://habr.com/ru/post/889185/


All Articles