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?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
import scipy.io.wavfile as sio data = sio.read(FILENAME) data = data.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()
If the file is PCM-encoded then you can use Python's
wave module to read the samples in the file, and then fold the values into the range.
I have created true random number file using AM radio waves or what is popularly called white noise. I've done it in Linux, so if you want that, follow these steps.
After you installed sox, place your microphone to the speakers so they can record "white noise" and use this command:
rec -c 1 -r 8000 -t wav -e signed-integer randomWAVfile
You will have a file with random noise that is "formated" as wav file (it holds wav header of 14bits - if I am not mistaken).
To strip down the header and "remove" potential duplicates, use this program written in C by Rick Van Reinn.
It is not a big issue, but be aware that castings in this program is not correct and your gcc will start to complain.
Source code link: Openfortress source code
By pushing down the file through the program:
cat randomWAVfile | ./noise-filter > randomBits
you will get the TRNG file.
I have learned that by using this link. The only thing the guy who created the original tutorial were using ancient versions of Linux that operated with OSS (open sound sys) and not alsa.
Original post: Openfortress original link