Emotiv Local Experiment is crashing

OS (e.g. Win10): Win11
PsychoPy version (e.g. 2024.2.4 Py 3.8): 2024.2.5 Py 3.9
Standard Standalone Installation? (y/n) If not then what?: Y
Do you want it to also run online? (y/n) Y
What are you trying to achieve?:

I have an EEG experiment consisting of a video and some picture tasks. I successfully ran the experiment multiple times locally with Emotiv Pro and collected my data. Last time, I added some sound components to the baseline measurement phase, which occurs before the video. When I connected to the EEG device, the baseline phase successfully played with sound. However, the video played at an extremely fast speed without audio, and the experiment crashed. I received the following warning:

Traceback (most recent call last):
File “C:\Users\OOkumus\EEG Studies\EEG_1\EEG_lastrun.py”, line 5827, in
run(
File “C:\Users\OOkumus\EEG Studies\EEG_1\EEG_lastrun.py”, line 465, in run
cortex_obj = emotiv.Cortex(subject=expInfo[‘participant’])
File “C:\Users\OOkumus\AppData\Roaming\psychopy3\packages\Python310\site-packages\psychopy_emotiv\emotiv.py”, line 92, in init
self.authorize()
File “C:\Users\OOkumus\AppData\Roaming\psychopy3\packages\Python310\site-packages\psychopy_emotiv\emotiv.py”, line 363, in authorize
self.auth_token = resp[‘result’][‘cortexToken’]
KeyError: ‘result’
ioHub Server Process Completed With Code: 0
What did you try to make it work?:

I asked ChatGPT for some solutions. First, I tried using taskkill in CMD, but the problem persisted. Then, I realized that the computer’s audio was completely gone. I restarted the computer and attempted to run the experiment again by deactivating the sound components I had added. The video played at normal speed with audio, but at the end of the video, the experiment crashed again.

As a workaround, I uploaded the experiment to Emotiv Builder and tried running it a few times after synchronizing it with Pavlovia. In Pavlovia, the experiment is currently in piloting mode. During the image task stage, where I have my markers, the experiment produced the following error: TypeError: Cannot read properties of undefined (reading ‘startDatetime’).

Finally, I deactivated the EEG markers, and for now, the experiment is running without issues. However, I really need these markers for my analysis, and I am concerned about encountering the same issues with Pavlovia’s pilot mode. I would greatly appreciate your support.

For now, I have secured a solution by removing the sound components. Having both sound component and the video in the same EEG experiment seems like causing a bug.

Have a look at this post for a possible solution.

Hi, thanks for the reply. That solution worked by removing the video sound, in my case, the video needs to have the sound. I was using the sound component not as an experimental stimulus, but as a part of the closed-eye baseline recording to signal participants to open their eyes, so I will find another solution for that.

How about having the video sound as a separate audio component? You should be able to combine a silent video with two audios.

Aha, that would be very interesting actually. Let me try it out and come back here with the results.

1 Like

Alright, so I tried different combinations. It works when the sound component and silent video are in different routines. But whenever they are in the same routine, either the audio changes to a different pitch & runs faster, or it completely fails and results in the following error: PTB-ERROR: Failed to open audio device -1. PortAudio reports this error: Invalid device
PTB-ERROR: Desired audio parameters likely unsupported by audio device.
PTB-ERROR: This could be, e.g., due to an unsupported combination of timing, sample rate, audio channel count/allocation, or sample format.
Error in function Open: Usage error
Failed to open PortAudio audio device due to some unsupported combination of audio parameters.
PsychPortAudio:Open: Usage:

pahandle = PsychPortAudio(‘Open’ [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][, suggestedLatency][, selectchannels][, specialFlags=0]);

Now I need to restart my computer because audio is gone everywhere, like there is no sound coming from Youtube videos.