Skip to content

Instantly share code, notes, and snippets.

@jamesb93
Created September 14, 2021 14:18
Show Gist options
  • Save jamesb93/0a247a8fc230b3611de7e45fa796cfe8 to your computer and use it in GitHub Desktop.
Save jamesb93/0a247a8fc230b3611de7e45fa796cfe8 to your computer and use it in GitHub Desktop.
import numpy as np
NUM_CHUNKS = 4 # or this could be a ratio of original data
raw_audio = np.array([1, 2, 3, 4, 5, 6, 7, 8])
chunks = np.split(raw_audio, NUM_CHUNKS)
downsampled = [max(chunk) for chunk in chunks]
print(downsampled)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment