I am looking for a way to play a white noise using Psychopy. I tried the code below but it gives me an error message. I would very much appreciate it if anyone could teach me how to rectify the code. Thank you so much for your time!
from __future__ import division # so that 1/3=0.333 instead of 1/3=0
from psychopy import visual, core, data, event, logging, sound, gui
import numpy as np
data = np.random.uniform(-1,1,44100)
white_noise = sound.Sound(0.99*data)
data.play()
I get an error message below.
Traceback (most recent call last):
File "white_noise.py", line 7, in <module>
data.play()
AttributeError: 'numpy.ndarray' object has no attribute 'play'
Exception TypeError: "'NoneType' object is not callable" in <bound method
Server.__del__ of <pyolib.server.Server object at 0x0E54DD30>> ignored