Millisecond Forums

Choosing between two audio files at random

https://forums.millisecond.com/Topic25572.aspx

By YCANLab - 9/21/2018

Hello,

I’ve encountered two issues with the task I am programming.  In this task, I want to first randomly assign the participant to one of two audio conditions before they complete a second part of the task that's the same for both conditions (A Flanker task). 

I’ve modified the Flanker task to meet my desired specifications, though I’m having difficulty integrating the audio files into the script. I’ve also struggled to figure out how to randomize the participant to listen to one of the two audio files. Do you have any tips on how to integrate the audio files and randomize participants?

Thanks in advance for any help you give!
By Dave - 9/21/2018

YCANLab - Friday, September 21, 2018
Hello,

I’ve encountered two issues with the task I am programming.  In this task, I want to first randomly assign the participant to one of two audio conditions before they complete a second part of the task that's the same for both conditions (A Flanker task). 

I’ve modified the Flanker task to meet my desired specifications, though I’m having difficulty integrating the audio files into the script. I’ve also struggled to figure out how to randomize the participant to listen to one of the two audio files. Do you have any tips on how to integrate the audio files and randomize participants?

Thanks in advance for any help you give!

Generally, to (randomly) assign participants to different conditions, you want to make use of several <expt> elements in your script, one per condition. If you run separate scripts, you do the same using several <batch> elements, as in

// stuff to do and run for condition #1
<expt>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
....
</expt>

// stuff to do and run for condition #2
<expt>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
....
</expt>

or

// scripts to run for condition #1
<batch>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/ file = "condition1.iqx"
/ file = "flanker.iqx"
</batch>

// scripts to run for condition #2
<batch>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/ file = "condition2.iqx"
/ file = "flanker.iqx"
</batch>

respectively.

Now, for the audio part, you could simply do something like this

// scripts to run for condition #1

<values>
/ audioitem = 1
</values>

// uses the 1st audio item
<expt>
/ onexptbegin = [values.audioitem = 1]
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/ blocks = [1=myblock]
</expt>

// uses the 2nd audio item
<expt>
/ onexptbegin = [values.audioitem = 2]
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=audiotrial]
</block>

<trial audiotrial>
/ stimulusframes = [1=myaudio]
/ validresponse = (57)
</trial>

<video myaudio>
/ items = audioitems
/ select = values.audioitem
</video>

<item audioitems>
/ 1 = "a.mp3"
/ 2 = "b.mp3"
</item>
By meganhendrich - 9/28/2018

Dave - Friday, September 21, 2018
YCANLab - Friday, September 21, 2018
Hello,

I’ve encountered two issues with the task I am programming.  In this task, I want to first randomly assign the participant to one of two audio conditions before they complete a second part of the task that's the same for both conditions (A Flanker task). 

I’ve modified the Flanker task to meet my desired specifications, though I’m having difficulty integrating the audio files into the script. I’ve also struggled to figure out how to randomize the participant to listen to one of the two audio files. Do you have any tips on how to integrate the audio files and randomize participants?

Thanks in advance for any help you give!

Generally, to (randomly) assign participants to different conditions, you want to make use of several <expt> elements in your script, one per condition. If you run separate scripts, you do the same using several <batch> elements, as in

// stuff to do and run for condition #1
<expt>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
....
</expt>

// stuff to do and run for condition #2
<expt>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
....
</expt>

or

// scripts to run for condition #1
<batch>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/ file = "condition1.iqx"
/ file = "flanker.iqx"
</batch>

// scripts to run for condition #2
<batch>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/ file = "condition2.iqx"
/ file = "flanker.iqx"
</batch>

respectively.

Now, for the audio part, you could simply do something like this

// scripts to run for condition #1

<values>
/ audioitem = 1
</values>

// uses the 1st audio item
<expt>
/ onexptbegin = [values.audioitem = 1]
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/ blocks = [1=myblock]
</expt>

// uses the 2nd audio item
<expt>
/ onexptbegin = [values.audioitem = 2]
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=audiotrial]
</block>

<trial audiotrial>
/ stimulusframes = [1=myaudio]
/ validresponse = (57)
</trial>

<video myaudio>
/ items = audioitems
/ select = values.audioitem
</video>

<item audioitems>
/ 1 = "a.mp3"
/ 2 = "b.mp3"
</item>

What is the advantage of using "groupassignment" for conditions rather than using something like "noreplace" to randomize the conditions?

I am using the misinformation paradigm in both visual (V) and auditory (A) versions. Participants will see pictures depicting an event or hear the event described twice throughout the study. Therefore, I will have four between-subjects conditions: VV, AA, VA, and AV. I currently have my expt set up like this:

<expt >
/ preinstructions = (informedconsent)
/ blocks = [
1 = noreplace(VisualEncoding, AuditoryEncoding);
2 = BMIS;
3 = demographics;
4 = noreplace(VisualMisinfo, AuditoryMisinfo);
5 = BMIS;
6 = Recall;
7 = InstructRecognition;
8 = Recognition
]
/ postinstructions = (debrief)
</expt>

Is there a more effective way to do this?
By Dave - 9/30/2018

meganhendrich - Friday, September 28, 2018
Dave - Friday, September 21, 2018
YCANLab - Friday, September 21, 2018
Hello,

I’ve encountered two issues with the task I am programming.  In this task, I want to first randomly assign the participant to one of two audio conditions before they complete a second part of the task that's the same for both conditions (A Flanker task). 

I’ve modified the Flanker task to meet my desired specifications, though I’m having difficulty integrating the audio files into the script. I’ve also struggled to figure out how to randomize the participant to listen to one of the two audio files. Do you have any tips on how to integrate the audio files and randomize participants?

Thanks in advance for any help you give!

Generally, to (randomly) assign participants to different conditions, you want to make use of several <expt> elements in your script, one per condition. If you run separate scripts, you do the same using several <batch> elements, as in

// stuff to do and run for condition #1
<expt>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
....
</expt>

// stuff to do and run for condition #2
<expt>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
....
</expt>

or

// scripts to run for condition #1
<batch>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/ file = "condition1.iqx"
/ file = "flanker.iqx"
</batch>

// scripts to run for condition #2
<batch>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/ file = "condition2.iqx"
/ file = "flanker.iqx"
</batch>

respectively.

Now, for the audio part, you could simply do something like this

// scripts to run for condition #1

<values>
/ audioitem = 1
</values>

// uses the 1st audio item
<expt>
/ onexptbegin = [values.audioitem = 1]
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/ blocks = [1=myblock]
</expt>

// uses the 2nd audio item
<expt>
/ onexptbegin = [values.audioitem = 2]
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=audiotrial]
</block>

<trial audiotrial>
/ stimulusframes = [1=myaudio]
/ validresponse = (57)
</trial>

<video myaudio>
/ items = audioitems
/ select = values.audioitem
</video>

<item audioitems>
/ 1 = "a.mp3"
/ 2 = "b.mp3"
</item>

What is the advantage of using "groupassignment" for conditions rather than using something like "noreplace" to randomize the conditions?

I am using the misinformation paradigm in both visual (V) and auditory (A) versions. Participants will see pictures depicting an event or hear the event described twice throughout the study. Therefore, I will have four between-subjects conditions: VV, AA, VA, and AV. I currently have my expt set up like this:

<expt >
/ preinstructions = (informedconsent)
/ blocks = [
1 = noreplace(VisualEncoding, AuditoryEncoding);
2 = BMIS;
3 = demographics;
4 = noreplace(VisualMisinfo, AuditoryMisinfo);
5 = BMIS;
6 = Recall;
7 = InstructRecognition;
8 = Recognition
]
/ postinstructions = (debrief)
</expt>

Is there a more effective way to do this?

The advantage of using separate <expt>s / between-subjects conditions is that it gives you more control over how / how many participants are assigned to each condition. Normally, you'll want to ensure that you have a similar number of participants in each condition, and that would not be guaranteed if you merely choose one block out of two blocks at random via noreplace(). Whether that is a problem or not would depend on your design and the approximate number of total participants you plan to run. If that N is large, then you would probably end up with approximately equal Ns across conditions in the long run. If your participant pool is more limited, though, you should be better off with defining between-subjects conditions explicitly.