Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Wait for sound to stop by itself, block until then:
startTime, endPositionSecs, xruns, estStopTime = stream.stop()
print('StartTime', startTime, 'secs. Stop time', estStopTime, 'secs.\n');
# as before but 1.5*note_freq
a = np.sin(np.linspace(0, 2 * pi * f * 1.5 * n_samples / Fs))
# Replicated into two rows - One row for each stereo-channel, ie.
# m'th row == m'th channel, n'th column = n'th sample frame:
stereowav2 = [a, a]
stereowav2 = np.transpose(stereowav2)
stereowav2 = stereowav2.astype('float32')
t1 = GetSecs()
b1 = audio.buffer(stream=stream, data=stereowav2) # PsychPortAudio('CreateBuffer', pahandle, stereowav2);
t2 = GetSecs()
d2 = (1000 * (t2 - t1))
print('CreateBuffer Duration', d2, ' msecs.')
t1 = GetSecs()
b1.fill_buffer(stereowav2) # PsychPortAudio('FillBuffer', pahandle, b1)
t2 = GetSecs()
print('FillBuffer Duration', (1000 * (t2 - t1)), ' msecs.')
print('d2 / d1 = ', d2 / d1)
# PsychPortAudio('Start', pahandle, 1, GetSecs() + 1, 1)
stream.start(when=GetSecs()+1, wait_for_start=1)
# [startTime, endPositionSecs, xruns, estStopTime] = PsychPortAudio('Stop', pahandle, 1);
startTime, endPositionSecs, xruns, estStopTime = stream.stop()
print('StartTime', startTime, 'secs. Stop time', estStopTime, 'secs.\n');
# Close sound device: