Running Visual and Auditory Stimuli Simultaneously

Paul Groot pfc.groot at gmail.com
Mon Dec 10 23:03:00 UTC 2012


Hi,

I think David described the most straightforward method to do this, so you
should try that first. I know there is also an alternative method, which I
used a few years ago. I don't remember if I had to work around any problems
with the built-in sound objects, but here is what I did:

I inserted the following script in the global user script section. The
inserted script uses low-level windows functions to play an audio file.


' Sound suppport by using the windows multimedia library directly (i.e.
bypassing EPrime)
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal
lpszSoundName As String, ByVal uFlags As Long) As Long
Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

' Some constants for playing sounds
Const SND_LOOP = &H8        ' loop the sound until next sndPlaySound
Const SND_ASYNC = &H1       '  play asynchronously
Const SND_NOSTOP = &H10     '  don't stop any currently playing sound
Const SND_SYNC = &H0        '  play synchronously (default)
Const SND_NODEFAULT = &H2   '  silence not default, if sound not found
Const SND_PURGE = &H40      '  purge non-static events for task

' Remarks
' If the specified sound cannot be found, sndPlaySound plays the system
default sound.
' If there is no system default entry in the registry or WIN.INI file, or
if the
' default sound cannot be found, the function makes no sound and returns
FALSE.
'
' The specified sound must fit in available physical memory and be playable
' by an installed waveform-audio device driver. If sndPlaySound does not
find
' the sound in the current directory, the function searches for it using the
' standard directory-search order.

' Plays a sound from filename ans optionally wait until ready.
Function PlaySoundFile(ByVal filename As String, bWaitReady as boolean) as
Boolean
  PlaySoundFile = sndPlaySound(filename, iif(bWaitReady, SND_SYNC,
SND_ASYNC) )
End Function

' Plays a repeating sound from filename.
Function RepeatSoundFile(ByVal filename As String) as Boolean
  RepeatSoundFile = sndPlaySound(filename, (SND_LOOP Or SND_ASYNC) )
End Function

Sub StopSoundFile()
  dim ret as boolean
  ret = sndPlaySound(ebNullString, SND_SYNC)
End Sub

Then call one of the the Play functions somewhere in your script to start
playing the music:

if (Not PlaySoundFile("media\\classic.wav", false)) then
    MsgBox "Cannot play sound"
end if

And simply call StopSoundFile to stop at any point. Note that this was used
on a windows XP machine, so I'm not sure if it works on the latest Windows
releases.

Best
Paul



On 10 December 2012 20:42, Nicolette <nicolettenoonan at gmail.com> wrote:

> Hi,
>
> I am *very* new to EPrime, so I am looking for some guidance and have been
> unable to find an answer to my question in any tutorial I have come across.
>
> I am running an n-back task in EPrime 2.0 (no problems making that), but I
> would also like auditory stimuli to play "overhead" of the ongoing task. I
> have been unable to figure out how to do this. So, a 7-min audio file I
> want running continuously while my participant is engaged in doing the
> n-back. Almost like I don't want my "sound" to know what my "image" is
> doing.
>
> If anyone could offer me some guidance (and not make it *too*technical!), I'd really appreciate it.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "E-Prime" group.
> To post to this group, send email to e-prime at googlegroups.com.
> To unsubscribe from this group, send email to
> e-prime+unsubscribe at googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/e-prime/-/GRyKaY8V3oIJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20121211/dc53c6e3/attachment.htm>


More information about the Eprime mailing list