我正在寻找一种使用 Psychopy 播放白噪声的方法。我尝试了下面的代码,但它给了我一条错误消息。如果有人能教我如何纠正代码,我将不胜感激。非常感谢您的参与!
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()
我在下面收到一条错误消息。
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