Millisecond Forums

Inquisit crashes while trying to load large audio files

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

By LTK - 6/8/2021

I have an experiment that contains two mp3 files of roughly 15 minutes each, one 6 MB and another 16 MB. If I try to run the experiment with either one individually, it works fine, but if I add a branch that directs the participant to either the experimental or the control group, I get an "Internet timeout error. Files pending: 1". A few seconds later the program crashes entirely. Occasionally it does manage to run, even when I've made no changes to the script.

However, after I closed about a dozen browser tabs and open programs, it does work consistently. This freed up about 1 GB of memory, going from 2 to 3 GB available. It seems that if there's not enough memory available, Inquisit crashes, but I'm not sure about that, because when I run the experiment, memory usage goes up by 1 GB at most. But given that I had no problems loading either the 6 MB or the 16 MB audio file alone, that suggests that trying to load them both into memory is what's causing problems. So what's actually going on here?

The script is a modified version of a task from the Inquisit library. A test version that only plays a few seconds of the audio is running at https://mili2nd.eu/ln2b and the script is attached.
By Dave - 6/8/2021

LTK - 6/8/2021
I have an experiment that contains two mp3 files of roughly 15 minutes each, one 6 MB and another 16 MB. If I try to run the experiment with either one individually, it works fine, but if I add a branch that directs the participant to either the experimental or the control group, I get an "Internet timeout error. Files pending: 1". A few seconds later the program crashes entirely. Occasionally it does manage to run, even when I've made no changes to the script.

However, after I closed about a dozen browser tabs and open programs, it does work consistently. This freed up about 1 GB of memory, going from 2 to 3 GB available. It seems that if there's not enough memory available, Inquisit crashes, but I'm not sure about that, because when I run the experiment, memory usage goes up by 1 GB at most. But given that I had no problems loading either the 6 MB or the 16 MB audio file alone, that suggests that trying to load them both into memory is what's causing problems. So what's actually going on here?

The script is a modified version of a task from the Inquisit library. A test version that only plays a few seconds of the audio is running at https://mili2nd.eu/ln2b and the script is attached.

Quick thing you should try: Change the <sound> elements you use to play back the MP3s to <video> (see attached).

<sound> and <video> work and behave slightly differently. <sound> will attempt to stuff everything into memory, which is very demanding when the recordings are long. <video> will "stream" the audio file from disk, i.e. does not require it to fully reside in memory at all times.

(Note: The /file attributes in <data> and <summarydata> are commented out in the attached script, since I did not want to needlessly spam your data upload service.)
By LTK - 6/8/2021

Dave - 6/8/2021

Quick thing you should try: Change the <sound> elements you use to play back the MP3s to <video> (see attached).

<sound> and <video> work and behave slightly differently. <sound> will attempt to stuff everything into memory, which is very demanding when the recordings are long. <video> will "stream" the audio file from disk, i.e. does not require it to fully reside in memory at all times.

Ah thank you, that does make a huge difference. Cuts the load time from a minute to a few seconds. So it's definitely a memory problem, then? I'd expect Inquisit to handle this more gracefully than just crashing without a word.
By Dave - 6/8/2021

LTK - 6/8/2021
Dave - 6/8/2021

Quick thing you should try: Change the <sound> elements you use to play back the MP3s to <video> (see attached).

<sound> and <video> work and behave slightly differently. <sound> will attempt to stuff everything into memory, which is very demanding when the recordings are long. <video> will "stream" the audio file from disk, i.e. does not require it to fully reside in memory at all times.

Ah thank you, that does make a huge difference. Cuts the load time from a minute to a few seconds. So it's definitely a memory problem, then? I'd expect Inquisit to handle this more gracefully than just crashing without a word.

It's definitely a memory problem. As a rule of thumb:
- Use <sound> for short bits of uncompressed WAV files, when timing is critical (e.g. when doing auditory priming or dichotic listening work). All audio will be buffered into memory and is quickly accessible, thereby minimizing startup latency.
- Use <video> with compressed audio for everything else, such as spoken instructions or long pieces of audio running in the background.

I've added the crashing to our tracker, perhaps there is a way to bail out more gracefully. Ultimately, though, any application will crash if it or one of the components it relies on runs out of memory.