Created
November 14, 2014 01:21
-
-
Save dcalacci/39de37ed993f23c86b55 to your computer and use it in GitHub Desktop.
resampling PCM audio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.signal import resample | |
def resample_pcm(samplerate, channels, resample_rate=RESAMPLE_RATE): | |
"""Resamples the given PCM stream to resample_rate. | |
""" | |
new_length = resample_rate * (len(channels) / samplerate) | |
# convert to int so we have more exact matches | |
return resample(channels, new_length).astype(int) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment