Making recordings with OpenSesame, the first 500ms is blank
I tried to make recordings in OpenSesame. I display word on the screen, start the recording, end recording until key press, and head to the next word. I find that I am able to make recordings, but the first 500ms of all sound files is blank.
Can anyone help? That 500ms is really important to me. Thank you so much!
In what follows is the code I use.
recording_path = 'C:\\Users\\Jia\\Desktop\\recording\\'
FORMAT = pyaudio.paInt16
WAVE_OUTPUT_FILENAME= "%d_%d.wav" % (self.get('subject_nr'), var.item_num)
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,
channels = CHANNELS,
rate = RATE,
input = True,
frames_per_buffer = chunk)
print "* record until keypress"
my_keyboard = keyboard(exp,timeout=2)
all = 
data = stream.read(chunk)
print "* done recording"
# write data to WAVE file
data = ''.join(all)
wf = wave.open(recording_path+WAVE_OUTPUT_FILENAME, 'wb')