Audio and Video in E-Prime
Last modified by Iris Spruit on 2025/01/24 13:25
Contents
Introduction
Working with audio and/or video in E-Prime can present different challenges and errors. Following the Tips and Tricks below may help with setting up your experiment.
Tips & Tricks
- Audio and video format.
Not all media formats are playable in E-Prime. Even when your file is able to play with a media player application (such as VLC), there is no guarantee that E-Prime will be able to play it as well. In E-Prime the wmv format for video’s and wav format for audio seem to be the most reliable (but see DESIGN: Supported Audio file formats [30571] and INFO: Supported movie file formats [18325] for different formats). Note that even though a video has the .wmv extension, it does not necessarily have the wmv codec. Make sure that the audio codec is wma and the video codec is wmv. You can check which codecs your media file has in VLC media player when you go to Tools ⇒ Codec Information. To convert your media file to a different extension or different codecs, you can use a media editing program, such as ffmpeg for any media or Audacity for audio.
- Codec Config.
When using audio or video, always run the Codec Config to check whether E-Prime will be able to play your media file and to configure the codecs. You can find this application in E-Studio under Tools ⇒ Codec Config. Then go to: File ⇒ Render File and open your video or audio file. When you receive an error, E-Prime is unable to play the file. Converting the file to wmv or wav usually solves this issue. When you receive a warning, try rendering the file again. In some cases the warning will not disappear, but usually E-Prime will be able to play files that only receive a warning. When done, close Codec Config and save the configuration when asked to do so. See also: GETTING STARTED: Codec Config [22687] and INFO: CodecConfig Tutorial [18101].
- Error Codec Config.
When the Codec Config gives an error when you render a file, you could try the following: In Codec Config go to Tools ⇒ Create Default Mappings and click Yes, remove existing mappings first. Then, try rendering your file again.
- Test your task in the lab.
Test out the task on the computer that you will be running the task on. Different PCs have different video cards and while a task with audio or video might be able to run on one PC, it is possible it crashes on another.
- Sound API.
Audio loading can be reduced by changing the API (go to Edit ⇒ Experiment ⇒ Devices ⇒ Sound ⇒ API). Suggested is to use CoreAudio instead of DirectSound. Chronos provides the best timing, but a Chronos device is necessary in order to use this API. ASIO can only be used when certain drivers are installed on the computer (and this requires admin rights).
- Refer to attribute for Filename of SoundOut objects.
Do not use an absolute path for the SoundOut Filename as it may cause sound clipping. Instead, referring to an attribute which holds the Filename is recommended. See also: BUG: Sound clipping may occur when using an absolute path for the SoundOut/SlideSoundOut Filename [26066].
- Audio load error.
An audio load error can occur when trying to play a corrupted audio file, because E-Prime is unable to detect the end point in the media file. A solution would be to fix the audio file. Use a program like Audacity to edit your sound files.
- Problems with looping audio in E-Prime 3.
E-Prime 3 uses ffmpeg which does not support looping the audio. This can be fixed by doing one of the following:- Adjust/lengthen your sound file so that it includes the looping. This can be accomplished with for example Audacity.
- Use DirectShow with the DirectSound API. To change the Codec Config to use DirectShow:
- Open Codec Config in E-Studio by going to Tools ⇒ Codec Config.
- Select the file type under Extensions (e.g. .wav).
- Choose File Source (Async.).
- Click Choose Codec.
- Press x then Save.
- In E-Studio go to Edit ⇒ Experiment ⇒ Devices ⇒ Sound, and set the Sound API to DirectSound.
- Timing.
The following points can help in obtaining optimal timing when using sound:- Make the sound files as small as possible. This will really help reduce loading time. Use software like Audacity to edit your sound files.
- Run the task from the local ( C: ) drive and also put the stimuli on the local drive.
- It can be helpful to load a sound at a convenient time, and play it at the desired time. Loading a sound can be done with SoundBuffer.Load. After playing a sound, the sound buffer is emptied. The sound thus needs to be loaded each time it is played and it does not help to play the same sound multiple times after loading it once.