[Tutor] Converting audio samples from 16-bit signed int to float?

Joe Veldhuis electroblog at gmail.com
Mon Jun 21 00:52:14 CEST 2010


Hello all. I'm writing a program that needs to capture audio from a soundcard and run FFTs to determine peak frequency for further processing. The soundcard's native capture format is 16-bit little-endian signed integer samples (values 0-65535), and of course the FFT function requires floating-point values (-1.0 - +1.0).

So, what is the most efficient way to do the necessary conversion? I'm using the pyalsaaudio module to access the soundcard, if it matters.

-Joe Veldhuis


More information about the Tutor mailing list