Loading a large number of audio files in runtime

0 votes
asked Apr 26, 2016 by anonymous
Hi, I’m creating an experiment in which each subject will listen to a different set of 200 words. Each word is saved in a different audio file, let’s say word001.wav, word002.wav, ..., word200.wav. All these files are kept in the subject01 folder. Is it possible to add these 200 files to an Audio Player element in runtime? I was thinking on using System.Media.SoundPlayer(“wordNNN.wav”) instead of an Audio Player element, is that a good option?

1 Answer

0 votes
answered Apr 26, 2016 by Maria Molodova (8,320 points)
selected May 12, 2016 by Ilia Korjoukov
Best answer
Using the .Net SoundPlayer class and loading external files via snippets is possible, however, there is a better way to accomplish the same task.

First, all wave files can be loaded into the experiment’s Library. In this case, they will be stored inside of the experiment file. To do it, simply drag and drop the subject01 folder into the Library panel. The files stored in the Library are loaded only by demand and, therefore, their number and size should not affect performance, except for a delay on loading experiment into EventIDE, when all Library content is classified. I believe that 200 small wave files will be handled relatively fast.

Then, you can create an audio stimulus set by assigning all wave files in the Library to a new Audio Player element. To do this, drag the wave file and drop them over the Audio Player element. The element makes an internal list, where one selected item is played at runtime. The index of the selected item is controlled by element’s [Item Index] property and can be changed at runtime in snippets. The Audio Player element is a wrapper over the SoundPlayer class, so using it reduces an amount of coding necessary for manual handling of wave files.

However, there is another element, DirectSound, which is recommended specifically for playback of the wave files. The DirectSound element allows fine hardware tuning, operates faster and have better playback accuracy than Audio Player element. It also supports a list of Library items. For stimulus delivery I would advise always to use DirectSound and select the Audio Player for other audio formats, like mp3, or when playback accuracy is not critical.

Welcome to EventIDE Q&A forum where you can ask questions about EventIDE software and receive answers from other members of the community

FAQ questions

Installation and License



EEG Analysis

Visual Stimuli

Runtime and Data Collection