array
Compact arrays of a single numeric type (much smaller than lists of ints).
Easy
from array import array
samples = array("h", [0, 512, -512]) # signed 16-bit
samples.tobytes()
For maths on arrays, use NumPy instead.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.