Revision 6:fd0f9d0615b2 6-synthesize-mono-noise-with-numpy.py

View differences:

6-synthesize-mono-noise-with-numpy.py
1 1
import numpy as np
2 2
from scikits.audiolab import Sndfile
3 3
from scikits.audiolab import Format
4
import pylab as plt
4 5

  
5 6

  
6 7
#################################################
......
18 19
    # generate random value and turn it down!
19 20
    noise[i] = np.random.random()*0.2
20 21

  
21

  
22 22
#################################################
23 23
########## WRITING NOISE TO AUDIO FILE ##########
24 24
#################################################
......
36 36
# close the audio file
37 37
f.close()
38 38

  
39

  
40
#################################################
41
############### PLOTTING THE NOISE ##############
42
#################################################
43

  
44
plt.plot(noise[0:512])
45
plt.show()

Also available in: Unified diff