Change the slide sound with respect to the response of the subject

David McFarlane mcfarla9 at msu.edu
Tue Mar 12 15:40:07 UTC 2013


A few thoughts:

- First, make a *global* variable in the global User Script area to 
store the ACC score of the previous slide.

- Next, use inline code at the appropriate place to store ACC into 
your global variable, e.g.,

     g_AccPrev = StimSlide.ACC

- Then, instead of manipulating properties directly, set an attribute 
in code and use an attribute reference for the File name in your 
sound object (see my essay at 
http://groups.google.com/group/e-prime/browse_thread/thread/441c14e960dd946f 
).  E.g., in inline code, do

     If g_AccPrev Then
         c.SetAttrib "SoundFile", "Correct.wav"
     Else
         c.SetAttrib "SoundFile", "Incorrect.wav"
     End If

(or, if you prefer concise code like I do, use

     c.SetAttrib "SoundFile", Iif( g_AccPrev, "Correct.wav", "Incorrect.wav" )

)

and then use attribute reference "[SoundFile]" for File name in your 
sound object.

(Extra credit:  Rearrange this so that you do not need to put ".wav" 
in the inline code.)

-----
David McFarlane
E-Prime training 
online:  http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter:  @EPrimeMaster (https://twitter.com/EPrimeMaster)

/----
Stock reminder:  1) I do not work for PST.  2) PST's trained staff 
take any and all questions at 
http://support.pstnet.com/e%2Dprime/support/login.asp , and they 
strive to respond to all requests in 24-48 hours, so make full use of 
it.  3) In addition, PST offers several instructional videos on their 
YouTube channel (http://www.youtube.com/user/PSTNET ).  4) If you do 
get an answer from PST staff, please extend the courtesy of posting 
their reply back here for the sake of others.
\----


At 3/10/2013 08:08 AM Sunday, Valerio Biscione wrote:
>Hi, I am a good programmer in visual basic, but I am totally new to 
>e-prime so I'm having some difficulties in writing a simple 
>experiment. What I want to do is a slide with a sound object and 
>this sound object con play 2 different file. File 1 is played when 
>the subject made a correct response on the PREVIOUS slide, File 2 is 
>played if the response was wrong.
>
>I tried a lot of different ways: I created an attribute for the 
>sound-file directory, so when the subject give a response I change 
>the attribute of the NEXT slide. But it seems to me that when the 
>software finish the slide and it read the attribute on the next 
>slide, it will found the attribute value empty (like I didn't change it).
>I tried to save the result on a variable and to change the 
>sound-file directory in the NEXT slide, without using any attribute. 
>I used this method:
>
>
>'Set theAudio = 
>CSlideSoundOut(Slide2.States(Slide2.ActiveState).Objects("SoundOut1"))
>
>'Dim theBuffer As SoundBuffer
>'Set theBuffer= theAudio.Buffers(1)
>'theBuffer.Filename="C:\\Users\\vbiscione\\Documents\\My 
>Experiments\\SoundRewardP.wav"
>'theAudio.loadProperties
>
>But it doesn't work at all.
>I don't know what to do.. do you have any help? Thank you!

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



More information about the Eprime mailing list