'Randomly select page in YAML file?

I'm using the webMUSHRA package to implement some listening tests. Here is some code in the YAML file that implements 3 simple pages of the experiment (named page1, page2, page3):

testname: MUSHRA with custom Questionaire
testId: mushra_customquestionaire
bufferSize: 2048
stopOnErrors: true
showButtonPreviousPage: true
remoteService: service/write.

pages:
 - type: generic
   id: page1
   name: All listening tests
   content: <p>This example for a listening test shows all available tests. Some in random order and some not. They all use the same test item and filtered versions of it as conditions. </p> <br/><p> Before the test starts you can set the volume to your convenience and after the test you get an overview over your results!</p>
 - type: volume
   id: page2
   name: Volume settings
   content: Please adjust the volume!
   stimulus: configs/resources/audio/mono_c1.wav
   defaultVolume: 0.5
 - type: generic
   id: page3
   name: Random
   content: The next tests appear in randomized order.

Is there some way I can two of these three pages at random? For example, for some participants, they'd see page1 and page3, whereas other respondents might see page2 and page3.

Any pointers on how to do this?



Solution 1:[1]

The official documentation of webMUSHRA says that you can specify the first string as "random" in the pages array and then the content of the pages will be picked on random basis.

This is the reference to the documentation: https://github.com/audiolabs/webMUSHRA/blob/master/doc/experimenter.md#random

So, you can change your code to something like:

testname: MUSHRA with custom Questionaire
testId: mushra_customquestionaire
bufferSize: 2048
stopOnErrors: true
showButtonPreviousPage: true
remoteService: service/write.

pages:
 - random
 - type: generic
   id: page1
   name: All listening tests
   content: <p>This example for a listening test shows all available tests. Some in random order and some not. They all use the same test item and filtered versions of it as conditions. </p> <br/><p> Before the test starts you can set the volume to your convenience and after the test you get an overview over your results!</p>
 - type: volume
   id: page2
   name: Volume settings
   content: Please adjust the volume!
   stimulus: configs/resources/audio/mono_c1.wav
   defaultVolume: 0.5
 - type: generic
   id: page3
   name: Random
   content: The next tests appear in randomized order.

You may refer to the default yaml for usage details: https://github.com/audiolabs/webMUSHRA/blob/99bcf206564949bcce74d9795ab36ef32e1b99cd/configs/default.yaml

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aman