Windows – How to generate random numbers with a .wav file

random number generatorwavwindows 7

I want to generate random numbers within a certain range (1 to 26) using a .wav file with only static noise.

The results need to be repeatable.

Is there any service/program/method of accomplishing this in Windows 7?

Best Answer

Try Python's scipy module,

import scipy.io.wavfile as sio

data = sio.read(FILENAME)
data = data[1].astype('float')
data -= data.min()
data *= 25.0*data.max()
data += 1

The data is now a vector and can be saved or used for further processing etc.

If, for example, you just want to save the output as a csv (comma separated values) file, you could then use

import csv
fout = open('output.csv', 'w')
wrt = csv.writer(fout)
wrt.writerow(data)
fout.close()
Related Question