Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
1  
What do you want to do with the random numbers? The answer to this question affects which method will be best to do this. –  jmetz Aug 1 '12 at 14:29
    
First of all, do you know any programming languages? I assume not but that doesn't change the fact that random generated numbers that are repeatable are not random at all. That said, you may consider hashing the file with MD5 and use the hash as a seed. That will guarantee that the seed is unique to that sound snipped can reproduce predictable sequence of numbers. However, this is NOT random. –  anber Feb 7 at 5:54
    
@anber Yes, I have experience from a couple programming languages. From what you wrote, I will keep that in mind. Thanks! ;) –  zeldarulez Feb 8 at 5:34

2 Answers 2

up vote 6 down vote accepted

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()
share|improve this answer
    
i unfortunatly dont program/know python. How could i use this snippit of code? –  zeldarulez Jul 31 '12 at 23:01
2  
@zeldarulez: As long as you can think logically, Python is one of the easiest programming languages to learn. –  Ignacio Vazquez-Abrams Jul 31 '12 at 23:11
    
@zeldarulez - what do you want to do with the random numbers? –  jmetz Aug 1 '12 at 14:12
    
i would like to use the use the random numbers to create a one-time pad key. I know about random.org, but i want to use a method to create it myself –  zeldarulez Aug 1 '12 at 16:33
    
@IgnacioVazquez-Abrams learning a new language will be ok ;) –  zeldarulez Aug 1 '12 at 16:39

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.

share|improve this answer
4  
The wave module reads the data as a string - I would recommend using scipy.io.wavfile instead as I posted in my answer - it makes the data much more manageable for the subsequent rescaling. –  jmetz Jul 31 '12 at 21:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.