URL of experiment:
https://run.pavlovia.org/naomilee/2021abb
https://gitlab.pavlovia.org/naomilee/2021abb
Description of the problem:
In updating an experiment built in 2020.1.2 to 2021.2.3 (to take advantage of the textBox and Button components!), I am finding that repeating a single audio file across immediately adjacent trials no longer works. (This seems to only happen in one routine, and it happens at random, because the relevant loops over that routine are randomized. Also, repeating the same audio across adjacent trials still works completely fine offline!) Is there something that would prevent the same audio file from being played again too soon after a first play, only online?
Details:
I have 4 randomized loops that use the training_choice routine. A code component (at the beginning of the routine) references the conditions file to set up the name of the sound file, to be referenced in the Sound field of the routineās audio component. That audio component has a start time of 0.0, with an empty duration, and the Sound is set every repeat.
As an example, the loop trials_training_4 refers to the conditions file below. The relevant part of the code component references the verbID, verbSuffixID, and voice, and translates that into the correct audio file name with reference to a dictionary defined in a code component set at the beginning of the whole experiment. As you can see, there are only two audio files possibly being referenced within this loop: nika-biceku-laru.mp3 OR nika-bicete-laru.mp3. As a result, itās quite likely that, in any given loop with 4 repeats, the same file will be asked to play immediately after having just been played. ONLY when this is the case, the second instance (or any subsequent instances, as long as they are all in a row) will not play on Chrome (or Safari).
A particular mystery is why this issue does not seem to affect my trial routine. That is also randomized, also with an audio Sound dependent on the conditions file, also only with two possible Sounds, each of which often ends up played multiple times in a row. But there, the audio plays every time, as desired. The only difference I can discern in the way the code component and audio components are set up, is that the line in the code component that sets the audio file name is nested in an if statement in the affected (training_choice) routine, but not nested in the unaffected (trial) routine. Not sure why that should make a difference.
snippet of code component defining audio file:
if ((routine == "training4")) {
audio = ((((("stims/audio-mp3s/nika-" + vocabulary[verbID]) + vocabulary[verbSuffixID]) + "-") + voice) + ".mp3");
fruit = fruitImageID;
}
dictionary in initial code component at the beginning of the experiment:
vocabulary = {"sg": "cha", "du": "po", "pl": "fi", "A": "te", "B": "ku", "carrot": "pem", "pear": "seeg", "lemon": "dite", "cherry": "lun", "beamup": "bice", "throwaway": "pim", "banana": "deet", "apple": "feek"};
example conditions file
routine | verbID | fruitImageID | numberSuffixID | verbSuffixID | background | beam | foreground | leftImageNumber | midImageNumber | rightImageNumber | corrAnsT2 | voice |
---|---|---|---|---|---|---|---|---|---|---|---|---|
training4 | beamup | pear | 0 | A | empty | 0-nika-beam | 0-laru-phone | sg | empty | du | left | laru |
training4 | beamup | pear | 0 | A | empty | 0-nika-beam | 0-laru-phone | sg | empty | pl | left | laru |
training4 | beamup | pear | 0 | B | empty | 0-nika-beam | 0-laru-phone | du | empty | sg | left | laru |
training4 | beamup | pear | 0 | B | empty | 0-nika-beam | 0-laru-phone | pl | empty | sg | left | laru |
training4 | beamup | pear | 0 | A | empty | 0-nika-beam | 0-laru-phone | du | empty | sg | right | laru |
training4 | beamup | pear | 0 | A | empty | 0-nika-beam | 0-laru-phone | pl | empty | sg | right | laru |
training4 | beamup | pear | 0 | B | empty | 0-nika-beam | 0-laru-phone | sg | empty | du | right | laru |
training4 | beamup | pear | 0 | B | empty | 0-nika-beam | 0-laru-phone | sg | empty | pl | right | laru |
 |
Some ideas I have tried / will try:
- I believe audio latency preferences / changing audio library wonāt have an impact, since the offline version works fine and Iām only running into this online.
- Perhaps this is some limit from the browser on playing the same audio immediately after playing it once? Though Iāve only tried Chrome and Safari so far, the issue is the same on both browsers. Havenāt dug into how each handles audio yet, but that is one area I might pursue.
- Could setting a duration possibly help? Checking or unchecking āSync Start with screenā? (Itās currently checked.) Any other aspect of the audio component setting?
- How about adding a silent sound at the end of each routine, so that identical calls for the same audio file to be played wonāt be right next to each other?
- Is there something else I can put in the code component (under āEnd routineā) that will help make js happier about playing the same audio twice in a row?
I would greatly appreciate any thoughts!