# Logging onset/offset of sound stimuli

**URL:** https://discourse.psychopy.org/t/logging-onset-offset-of-sound-stimuli/7247
**Category:** Builder
**Tags:** logfiles, sound
**Created:** [April 1, 2019, 11:05pm UTC](https://discourse.psychopy.org/t/logging-onset-offset-of-sound-stimuli/7247 "2019-04-01T23:05:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dyeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dyeo/32/4342_2.png) [@dyeo](https://discourse.psychopy.org/u/dyeo)
#### Post date: [April 1, 2019, 11:05pm UTC](https://discourse.psychopy.org/t/logging-onset-offset-of-sound-stimuli/7247/1 "2019-04-01T23:05:24Z")

</div>

Hi everyone,

I have a cross-modal (visual-auditory) experiment that I built using Builder in version 3.0.6 (standalone) on a Windows machine (Windows 7 and 10). Sound files are in .wav format and each lasts for 500 ms. Everything runs smoothly, but when I was auditing the logfiles to check the stimulus onset and offset to verify that they have been presented for the intended duration, I realized that the auditory events are not logged.

I used the default settings for the audio hardware:  
 ![sound](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/d/6/d670394f301ab81f530451197520004b8a5b89fb.jpeg)

I then created a stripped down version where I only present a fixation cross and two successive auditory stimuli, followed by a keyboard response, just to make sure that it was not specific to the experiment that I created:

 ![soundroutine](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/7/f/7f1c8d2519dbcc678d596fde9ad95c41e13145a7.jpeg)

The logfile shows this:

| 5.6200 | EXP | Created window1 = Window(allowGUI=False, allowStencil=False, args=UNKNOWN, autoLog=True, bitsMode=UNKNOWN, blendMode=‘avg’, color=array([0., 0., 0.]), colorSpace=‘rgb’, fullscr=\<method-wrapper ‘ **getattribute** ’ of attributeSetter object at 0x0EA460B0\>, gamma=None, kwargs=UNKNOWN, lms=UNKNOWN, monitor=\<psychopy.monitors.calibTools.Monitor object at 0x1110DB50\>, multiSample=False, name=‘window1’, numSamples=2, pos=[0.0, 0.0], screen=0, size=array([1920, 1200]), stereo=False, units=‘height’, useFBO=True, useRetina=False, viewOri=0.0, viewPos=None, viewScale=None, waitBlanking=True, winType=‘pyglet’) |
| --- | --- | --- |
| 5.6200 | EXP | window1: recordFrameIntervals = False |
| 5.7857 | EXP | window1: recordFrameIntervals = True |
| 5.9693 | EXP | window1: recordFrameIntervals = False |
| 6.0419 | EXP | Created text = TextStim( **class** =\<class ‘psychopy.visual.text.TextStim’\>, alignHoriz=‘center’, alignVert=‘center’, antialias=True, autoLog=True, bold=False, color=‘white’, colorSpace=‘named’, contrast=1.0, depth=0.0, flipHoriz=False, flipVert=False, font=‘Arial’, fontFiles=, height=0.1, italic=False, languageStyle=‘LTR’, name=‘text’, opacity=1.0, ori=0, pos=array([0., 0.]), rgb=array([255., 255., 255.]), text=’+’, units=‘height’, win=Window(…), wrapWidth=1) |
| 6.0596 | EXP | Sound set volume 0.600 |
| 6.0602 | EXP | Sound set volume 0.600 |
| 6.0682 | EXP | text: autoDraw = True |

\<-------- there should be timestamps for the two sound files here --------\>

|7.9044 |DATA |Keypress: space|  
|7.9185 |EXP |window1: mouseVisible = True|

It seems like sound onsets and offsets are not automatically logged. Is there a way I can include a code to log these events, or include them in the data file?

Thanks!

Darren

[soundtest.psyexp](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/2X/6/6d9344bbb50cd7dd4a01574653229c2ddd3c460b.psyexp) (6.6 KB)  
[https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/2X/a/a873b40d33f8e3ee20673dc643c7ab90aad2e0be.wav](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/2X/a/a873b40d33f8e3ee20673dc643c7ab90aad2e0be.wav) [https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/2X/f/f95b0585ea6eb205d28e3e681603f88209502302.wav](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/2X/f/f95b0585ea6eb205d28e3e681603f88209502302.wav)

---

<div class="post-metadata">

### Author: ![Lauren\_Louise](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/lauren_louise/32/10481_2.png) [@Lauren\_Louise](https://discourse.psychopy.org/u/Lauren_Louise)
#### Post date: [September 17, 2020, 7:20am UTC](https://discourse.psychopy.org/t/logging-onset-offset-of-sound-stimuli/7247/2 "2020-09-17T07:20:59Z")

</div>

Hi Darren,

Did you end up figuring out a solution to this problem?

Lauren

---

<div class="post-metadata">

### Author: ![dyeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dyeo/32/4342_2.png) [@dyeo](https://discourse.psychopy.org/u/dyeo)
#### Post date: [September 29, 2020, 7:35pm UTC](https://discourse.psychopy.org/t/logging-onset-offset-of-sound-stimuli/7247/3 "2020-09-29T19:35:57Z")

</div>

Hi Lauren,

I did not manage to figure out before I abandoned the audio stimuli. Sorry that I couldn’t be of help.

Best,  
Darren
