Repetitive Sound Presentation and Trigger Issues
Paul Gr
pauls_postbus at hotmail.com
Sat Jan 20 10:00:15 UTC 2007
Hello Pamela,
I currently don’t have enough time for a proper analysis of your code and setup, but there are few things to think about:
1) Try to preload the sound files into different Sound objects at the start of the experiment. This will prevent unpredictable delays caused by loading the audio files during a trial. Preloading should be possible by adding properly configured SoundOut objects to the ‘unreferenced E-Objects’ section. This should be done for each sound. You can simple start such sound objects by calling the Play or Run methods.
2) Note that some soundcards have problems playing very short tracks. This problem seems to be related with the internal buffering mechanism of the sound card (or the DirectX drivers.) In our lab we once had a situation where sometimes the tail of track A was replayed at the start of track B. We solved this issue by adding some silence at the start and end of each WAV-file. Another option is to create a single WAV-file which contains all the audio you would like to play. (We even developed a small library for this which can be used by EPrime to generate WAV-files at runtime by adding existing WAV files into one large audio stream.)
3) Because it is not always easy to check the exact onsets of the sound stimuli, it is sometimes desirable to be able to record the sound output itself along with the EEG. The easiest way would be to record the attenuated audio signal itself on a bipolar input. However, because galvanic connection of external equipment with the EEG amplifier is not allowed, you will require special isolation electronics to be able to do this safely. Another option would be some dedicated electronics that translates the audio signal into a digital trigger pulse, which can be recorded on the trigger input. In some cases this will eliminate the need of creating the digital triggers in EPrime.
hope this helps.
best,
Paul Groot
VU University Amsterdam
Date: Thu, 18 Jan 2007 09:20:50 -0600From: pamela.n.carton at gmail.comTo: eprime at mail.talkbank.orgSubject: Repetitive Sound Presentation and Trigger IssuesHello-We are currently doing a study in which we will present pictures followed by a fixation point. During the pictures and the fixation points, we want to present clicks spaced at 100 ms repetitively. Also, we want to implement a startle probe that will play once randomly throughout the image presentation. Similarly, we want the clicks to resume after the startle probe presentation. Finally, a fixation point should appear when the image presentation is completed. During the fixation point, the clicks should simultaneously be presented. This will be done for 48 pictures.To clarify, the program should look as follows:-picture presentation with simultaneous 100 ms clicks-random startle probe once during the picture presentation-resume 100 ms clicks for the remainder of the picture presentation-present a fixation point on the screen with simultaneous 100 ms click presentation-repeatSeveral items to note before reading on:-We are using a NeuroScan SynAmps 2-The way we have our study designed on E-Prime, we are using slide objects with different active states. Specifically, we have inline coding initializing the Stimulus slide object. The Stimulus slide object has two active states: an image state that presents the image and a sound out (on the state) for the clicks, and a fixation state that presents the fixation point and another sound out (on the state as well) for the startle probe. We also have some more inline code to switch the Stimulus states following that slide object, and that is then followed by another slide object with two different active states. The first of those states is a fixation point with a sound out on it that plays the clicks. The second state of that object does not display any images, but it is supposed to present the startle probe.Now that the general set up of our program is out of the way, here's the trouble we are having:Firstly, when we try to get the clicks to play while we have WritePorts and triggers in the inline code, we are able to see triggers properly executed, but we cannot get the clicks to play in the correct, repetitive 100 ms manner. Specifically, it will sound as though the clicks are spaced out inconsistently and unevenly. This does not seem to have an effect on the startle probe, however, which is presented as it should be. When we expect to hear the clicks again post-startle probe presentation (but before the fixation point and clicks presentation), we get one or two unevenly spaced out clicks. Then, at the fixation point, the 100 ms clicks resume at a faster pace than how they should be presented. The pictures and the fixation points are displayed correctly during this set up, thank goodness.Here's some of the code we have tried using in our SwitchStimStates: ' Switches ActiveState to Startle, then waits until' startle is scheduled to playWhile StimDur < Cdbl(c.GetAttrib("StimStartleOffset"))*1000StimDur = Clock.ReadMicrosec - ClockReadClickTrig = StimDur\(ClickBin*1000)Writeport Triggerport, c.getattrib("StimTrigger") + ClickTrig + 1Stim.playSleep SleepDurLoopDur = 0ClockRead2 = Clock.ReadMicrosec'Click TriggerWhile LoopDur < ClickDur*500LoopDur = Clock.ReadMicrosec - ClockRead2WendWritePort TriggerPort, HoldValueSleep SleepDurWhile LoopDur < ClickDur*1000LoopDur = Clock.ReadMicrosec - ClockRead2WendWend'Set sound volume for startle probe and play itIf CInt(c.GetAttrib("StimStartleOffset")) <> 0 ThentheSound.Buffers(1).Volume = 0theSound.Buffers(1).filename = "E:\\Experiment Stimuli\\Startles\\startle_44100.wav"theSound.Buffers(1).loadStim.play'Trigger Startle ProbeWriteport Triggerport, c.getattrib("StimStartleTrigger")Sleep SleepDurWritePort TriggerPort, HoldValueSleep c.getattrib("StartleDuration") - SleepDur End If'Set sound volume back to baselinetheSound.Buffers(1).Volume = CInt(c.GetAttrib("SoundVolume"))theSound.Buffers(1).filename = "E:\\Experiment Stimuli\\Startles\\click_44100_100ms.wav"theSound.Buffers(1).load' Waits until stimulus is finishedWhile StimDur < CDbl(c.GetAttrib("StimDuration"))*1000 - ClickDur*1000StimDur = Clock.ReadMicrosec - ClockReadStim.playLoopDur = 0ClockRead2 = Clock.ReadMicrosec'Click TriggerClickTrig = StimDur\(ClickBin*1000)Writeport Triggerport, c.getattrib("StimTrigger") + ClickTrig + 1Sleep SleepDurWritePort TriggerPort, HoldValueSleep SleepDur 'Wait remainder of ClickDurWhile LoopDur < ClickDur*1000 LoopDur = Clock.ReadMicrosec - ClockRead2WendWendWe then tried to comment out the the Click Trigger section of code - thus, we were hoping that the program would present the sound stimuli properly when we eliminated certain triggers. Indeed, the clicks prior to the startle probe were presented as we hoped and the startle probe itself was presented as we would expect. In addition, the clicks during the fixation point were presented properly. The images were also presented correctly, the same as before. However, we face two problems in the set up of the program this way: 1) There were no triggers, obviously, and we need to find a way to get this program running correctly, both in sound presentation and in triggers, 2) We do NOT get the clicks presented at all after the startle probe. That is to say, we do get clicks presented properly during the fixation point and prior to the startle probe, just not immediately after the startle probe.We have tried to remedy these problems in several ways. We ensured that in our code, we use double back slashes in listing the directories for the sound files – we know that E-Prime often has trouble interpreting where to find the sounds from a specific drive without the double back slashes. Also, we had upgraded E-Prime from version 1.1.4.1 to version 1.2. This did not seem to make difference at all in either way we attempted the program. In addition, we have tried using E-Prime Beta versions 2.0.1.52 and 2.0.1.57 to no avail. Finally, we tried recreating this program without images. Instead, we have tried to use the clicks and startle probe with Sound Out objects instead of on slide objects. More specifically, we created a PreStim slide object with a fixation point. This was followed by a Sound Out object that presents the 100 ms clicks. After that code, we added another Sound Out object with the startle probe sound. Finally, we added the PostStim slide object with two different active states. The first of those states is a fixation point with a sound out on it that plays the clicks. The second state of that object does not display any images, but it is supposed to present the startle probe.When we attempted this basic set up, it failed to perform as we hoped. The clicks and startles were presented, but the spacing of the clicks was not 100 ms – they were spaced unevenly and in random chunks.So, again, we cannot get our program to successfully do the following:-play clicks at 100 ms intervals repetitively-simultaneously get the triggers working-get the clicks to play post-startle probe (but before the fixation point with clicks)If you have any suggestions as to how we might resolve these issues, which seem to be of a fundamental nature for E-Prime, please do not hesitate in responding.Thanks for reading this post. If you are confused or would like more clarification as to what we are trying to do in this program, I'll be happy to answer any questions.-Pam Carton
------------------------------------------Pamela N. Carton, Research AnalystVanderbilt University 301 Wilson Hall111 21st Ave SouthNashville, TN 37203office: (615) 343-5452cell: (914) 522-3905
_________________________________________________________________
Probeer Live.com: je eigen persoonlijke opstartpagina met alleen de dingen die jij belangrijk vindt op één plek.
http://www.live.com/getstarted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20070120/ed8c16d9/attachment.htm>
More information about the Eprime
mailing list