import numpy as np
from scipy.io.wavfile import write
data = np.random.uniform(-1, 1, 44100)
scaled = np.int16(data / np.max(np.abs(data)) * 32767)
write('test.wav', 44100, scaled)
How to generate audio from a numpy array?