使用Psychtoolbox播放音频和图形刺激时偶尔会出现问题

时间:2017-12-06 06:52:36

标签: matlab psychtoolbox

我正在实施一项行为任务,只有图像和音频刺激。一切都很好,除了一些偶尔的滞后。有时,特别是在测试过程中,音频刺激以拉伸的方式播放(假设我的音频刺激是'Turtle',持续时间为1秒,但它的作用类似于:'Tuuuurrrrrtttttleeee',持续时间为2或3秒)。在这个拉伸的音频播放过程中,我觉得图形也有些滞后。对于一些连续的刺激会发生这种情况,并且在几秒钟之后(在一些屏幕翻转和音频刺激改变之后)它再次变得正常。因此,我觉得额外的CPU负载会导致这种情况。也许我必须删除并重新创建一些缓冲区或句柄。我已经尝试删除并重新创建音频播放器句柄,但它会导致Matlab崩溃! (这是一个可重现的错误!)。在下文中,我提供了有关我编写实验的方式的一些详细信息。如果有人能帮我解决这个问题,我将非常感激。

计划详情:
我使用音频播放器,图形播放器,鼠标和键盘轮询以及GetSecs类和函数。我创建了相应的对象,并在实验结束时继续使用它们。我的程序是以面向对象的方式实现的。

我使用Screen('Flip'),Screen('MakeTexture')和Screen('DrawTexture')函数来显示我的图像。我用这些命令创建了一个窗口:

[window, windowRect] =PsychImaging('OpenWindow', Obj.Screen_Prop.Screen_Num,... Obj.Screen_Prop.Background_Color); 

[screenXpixels, screenYpixels] = Screen('WindowSize', window);

[xCenter, yCenter] = RectCenter(windowRect); Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');

我不会关闭窗户而只是翻转它。此外,有时我使用不同的Flip命令模式来显示某些内容,同时使用翻转保持前一个屏幕或清除屏幕并显示新内容。

此外,我使用Psychtoolbox的音频播放器来播放我的音频刺激。我通过以下命令初始化了音频播放器。 InitializePsychSound(1); nrchannels = 2;

pahandle = PsychPortAudio('Open', [], 1, 1, Fs, nrchannels);

此外,我尝试了以下选项来加载音频播放器,避免此问题没有区别:

pahandle = PsychPortAudio('Open', [], [], 0, Fs, nrchannels);

我总是用这个命令重新加载音频缓冲区,用不同的刺激填充它:

PsychPortAudio('FillBuffer', Obj.Parameters.Handle, AudioData);

重新加载了超过256倍的音频缓冲区,并且我在屏幕上翻了300多次。

我在Windows 10 Pro 64bit上使用Matlab 2017a 64bit,内存为12 Gb,Intel Core i5-3337U为1.8-2.6GHz。我测试另一台具有更好性能和相同操作系统的笔记本电脑,但问题没有解决。我已将所有驱动程序和PTB更新为最新版本。

PTB在每次会话期间和之后产生的信息和警告列表:

PTB-INFO: Using specially modified PortAudio engine, based on offical version: PortAudio V19-devel WITH-DIM

Will use ASIO enhanced Portaudio driver DLL. See Psychtoolbox/PsychSound/PortAudioLICENSE.txt
for the exact terms of use for this dll.


Disclaimer: "ASIO is a trademark and software of Steinberg Media Technologies GmbH."
PTB-Warning: Although using the ASIO enabled Psychtoolbox sound driver,
PTB-Warning: could not find any ASIO capable soundcard in your system.
PTB-Warning: If you think you should have an ASIO card, please check your
PTB-Warning: system for properly installed and configured drivers and retry.
PTB-Warning: Read "help InitializePsychSound" for more info about ASIO et al.
PTB-INFO: New audio device -1 with handle 0 opened as PortAudio stream:
PTB-INFO: For 2 channels Playback: Audio subsystem is Windows DirectSound, Audio device name is Primary Sound Driver
PTB-INFO: Real samplerate 44100.000000 Hz. Input latency 0.000000 msecs, Output latency 39.977324 msecs.


Will use ASIO enhanced Portaudio driver DLL. See Psychtoolbox/PsychSound/PortAudioLICENSE.txt
for the exact terms of use for this dll.


Disclaimer: "ASIO is a trademark and software of Steinberg Media Technologies GmbH."
PTB-Warning: Although using the ASIO enabled Psychtoolbox sound driver,
PTB-Warning: could not find any ASIO capable soundcard in your system.
PTB-Warning: If you think you should have an ASIO card, please check your
PTB-Warning: system for properly installed and configured drivers and retry.
PTB-Warning: Read "help InitializePsychSound" for more info about ASIO et al.
PTB-INFO: New audio device -1 with handle 1 opened as PortAudio stream:
PTB-INFO: For 2 channels Playback: Audio subsystem is Windows DirectSound, Audio device name is Primary Sound Driver
PTB-INFO: Real samplerate 44100.000000 Hz. Input latency 0.000000 msecs, Output latency 39.977324 msecs.



PTB-INFO: This is Psychtoolbox-3 for Microsoft Windows, under Matlab 64-Bit (Version 3.0.14 - Build date: Oct  3 2017).
PTB-INFO: Support status on this operating system release: Windows version 10.0 supported and tested to some limited degree.
PTB-INFO: Type 'PsychtoolboxVersion' for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file 'License.txt' in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: The detected endline of the vertical blank interval is equal or lower than the startline. This indicates
PTB-INFO: that i couldn't detect the duration of the vertical blank interval and won't be able to correct timestamps
PTB-INFO: for it. This will introduce a very small and constant offset (typically << 1 msec). Read 'help BeampositionQueries'
PTB-INFO: for how to correct this, should you really require that last few microseconds of precision.
PTB-INFO: Btw. this can also mean that your systems beamposition queries are slightly broken. It may help timing precision to
PTB-INFO: enable the beamposition workaround, as explained in 'help ConserveVRAMSettings', section 'kPsychUseBeampositionQueryWorkaround'.


PTB-INFO: OpenGL-Renderer is Intel :: Intel(R) HD Graphics 5300 :: 4.3.0 - Build 10.18.15.4256
PTB-INFO: VBL startline = 1080 , VBL Endline = 1080
PTB-INFO: Measured monitor refresh interval from beamposition = 16.681891 ms [59.945244 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.684565 ms [59.935637 Hz]. (50 valid samples taken, stddev=0.069477 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 16.949153 ms [59.000000 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: ==============================================================================================================================
PTB-INFO: WINDOWS DWM DESKTOP COMPOSITOR IS ACTIVE. On this Windows-10 or later system, Psychtoolbox can no longer reliably detect if
PTB-INFO: this will cause trouble for timing and integrity of visual stimuli or not. You might be just fine, or you could be in trouble.
PTB-INFO: Use external measurement equipment and independent procedures to verify reliability of timing if you care about proper timing.
PTB-INFO: ==============================================================================================================================


PTB-INFO: This is Psychtoolbox-3 for Microsoft Windows, under Matlab 64-Bit (Version 3.0.14 - Build date: Oct  3 2017).
PTB-INFO: Support status on this operating system release: Windows version 10.0 supported and tested to some limited degree.
PTB-INFO: Type 'PsychtoolboxVersion' for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file 'License.txt' in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: The detected endline of the vertical blank interval is equal or lower than the startline. This indicates
PTB-INFO: that i couldn't detect the duration of the vertical blank interval and won't be able to correct timestamps
PTB-INFO: for it. This will introduce a very small and constant offset (typically << 1 msec). Read 'help BeampositionQueries'
PTB-INFO: for how to correct this, should you really require that last few microseconds of precision.
PTB-INFO: Btw. this can also mean that your systems beamposition queries are slightly broken. It may help timing precision to
PTB-INFO: enable the beamposition workaround, as explained in 'help ConserveVRAMSettings', section 'kPsychUseBeampositionQueryWorkaround'.


PTB-INFO: OpenGL-Renderer is Intel :: Intel(R) HD Graphics 5300 :: 4.3.0 - Build 10.18.15.4256
PTB-INFO: VBL startline = 1080 , VBL Endline = 1080
PTB-INFO: Measured monitor refresh interval from beamposition = 16.682040 ms [59.944706 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.683846 ms [59.938218 Hz]. (50 valid samples taken, stddev=0.083440 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 16.949153 ms [59.000000 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: ==============================================================================================================================
PTB-INFO: WINDOWS DWM DESKTOP COMPOSITOR IS ACTIVE. On this Windows-10 or later system, Psychtoolbox can no longer reliably detect if
PTB-INFO: this will cause trouble for timing and integrity of visual stimuli or not. You might be just fine, or you could be in trouble.
PTB-INFO: Use external measurement equipment and independent procedures to verify reliability of timing if you care about proper timing.
PTB-INFO: ==============================================================================================================================


INFO: PTB's Screen('Flip', 10) command seems to have missed the requested stimulus presentation deadline
INFO: a total of 304 times out of a total of 1566 flips during this session.

INFO: This number is fairly accurate (and indicative of real timing problems in your own code or your system)
INFO: if you provided requested stimulus onset times with the 'when' argument of Screen('Flip', window [, when]);
INFO: If you called Screen('Flip', window); without the 'when' argument, this count is more of a ''mild'' indicator
INFO: of timing behaviour than a hard reliable measurement. Large numbers may indicate problems and should at least
INFO: deserve your closer attention. Cfe. 'help SyncTrouble', the FAQ section at www.psychtoolbox.org and the
INFO: examples in the PDF presentation in PsychDocumentation/Psychtoolbox3-Slides.pdf for more info and timing tips.

0 个答案:

没有答案