Audio Resampling in Python

Tue, May 10, 2011 One-minute read

Here I present a little Python script I wrote to resample 48kHz audio files to 44.1kHz (16 bits).

The script uses a Kaiser Window instead of a Rectangular Window to better filter out the aliasing. Here it is the Kaiser Windowed Impulse Response used in this script:

As you can see, the lower ribs are smoothed out compared to just a impulse response (rectangularly windowed), so that the aliasing will be much more silenced using this Keiser Window. More information in the great article by Julius O. Smith on resampling.

To apply the filter, I used an algorithm based on the “efficient polyphase filter bank with resampling” found on page 129 (Figure 4.3-8d) of the book “Multirate Systems and Filter Banks” by Vaidyanathan.

The code is fully documented. If you have any comments or questions, or find any bug, please let me know.

Oh, and just to let you know: Python is the next and much better version of Matlab.
Alright.