Playing different background sound in block based on participant response


Author
Message
ndil01
ndil01
Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)
Group: Forum Members
Posts: 6, Visits: 35
Hi there, 

I have two pieces of music, and I would like to present one of them as background sound in a block based on a participants previous response in a trial. 

I already know that I can use the /bgstim to play background sound in block (see block.self_referent). But I don't know how to select which piece of music to play based on a participants previous response. That is, in trial.final_choice participants are instructed to press the "a" key to listen to the first piece of music, or the "b" key to listen to the second piece of music. If they press the "a" key I'd like them to hear "Beethoven_PianoConcerto Op58.wav" and if they press the "b" key I'd like them to hear "Mozart_Serenade No13 KV525.wav" (see video.backgroundmusic). 

One way I thought about achieving this was by adding 1 to values.musicchoice if they select "a" and adding 2 if they select "b", and then using the value of values.musicchoice to determine which song is played during block.self_referent. The problem is I don't know how to map values.musicchoice to the different songs (video.backgroundmusic) and then how to map this to /bgstim in block.self_referent. I'm not even sure it is possible to achieve this at all. 

Please see the script below, and let me know if there is any more information you need. 

Many thanks in advanced, 
ndil01

***experiment

<expt mood_positive>
/ blocks = [1 = Instructions; 2 = Mood_ratings; 3 = music_choice; 4 = Music_selection; 5 = Self_referent]
</expt>

***block where background sound is played

<block Self_referent>
/ trials = [1-4 = self_referent]
/screencolor = (yellow)
/ bgstim = (backgroundmusic)
</block>

***the trials with block.self_referent

<trial Self_referent>
/stimulustimes = [1 = Self_referent; 12000 = nextbutton]
/validresponse = (" ")
/ recorddata = false
</trial>

***sound I would like to use

<video backgroundmusic>
/ loop = true
/ items = ("Beethoven_PianoConcerto Op58.wav", "Mozart_Serenade No13 KV525.wav")
</video>

***trial where participant makes a response (or choice of music)

<trial final_choice>
/stimulustimes = [1 = final_choice]
/validresponse = ("a", "b")
/recorddata = true
/ontrialend = [if (trial.final_choice.response == "a") values.musicchoice + 1;
                      if (trial.final_choice.response == "b") values.musicchoice +2]
</trial>

***values I would like to use to map on particular background sound

<values>
/musicchoice = 0
</values>
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
ndil01 - 8 Years Ago
Dave - 8 Years Ago
ndil01 - 8 Years Ago
ndil01 - 8 Years Ago
                     + x [quote] [b] ndil01 - Tuesday, April 25, 2017 [/b]...
Dave - 8 Years Ago
                         + x [quote] [b] Dave - Tuesday, April 25, 2017 [/b] +...
ndil01 - 8 Years Ago

Reading This Topic

Explore
Messages
Mentions
Search