Problems getting OSC receiver audio feedback example working

Post Reply
Dom
Posts: 5
Joined: Fri Jan 17, 2025 7:58 am

Problems getting OSC receiver audio feedback example working

Post by Dom »

Hi all,

I thought I'd try out James' OSC receiver example scripts but have run into an issue with the audio feedback one. The plot pops up briefly then disappears, but the script still seems to be running and reporting headband fit. The 2 other OSC scripts work perfectly so there doesn't seem to be any issue streaming EEG data over OSC as such, I think the issue is with matplotlib. Here's what I'm getting when I try to run the audio feedback script:

Listening on UDP port 5000
Muse Fit Good
C:\Users\Cyberpowerpc\Desktop\PhD\MUSE SDK\libmuse_windows_7.1.1\OSC Receiver Audio Feedback.py:118: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.
ani = FuncAnimation(plt.gcf(), plot_update, interval=100)
C:\Users\Cyberpowerpc\Desktop\PhD\MUSE SDK\libmuse_windows_7.1.1\OSC Receiver Audio Feedback.py:118: UserWarning: frames=None which we can infer the length of, did not pass an explicit *save_count* and passed cache_frame_data=True. To avoid a possibly unbounded cache, frame data caching has been disabled. To suppress this warning either pass `cache_frame_data=False` or `save_count=MAX_FRAMES`.
ani = FuncAnimation(plt.gcf(), plot_update, interval=100)
C:\Users\Cyberpowerpc\Desktop\PhD\MUSE SDK\libmuse_windows_7.1.1\OSC Receiver Audio Feedback.py:120: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.
plt.show()
Exception in thread Thread-1 (init_plot):
Traceback (most recent call last):
File "C:\Users\Cyberpowerpc\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
File "C:\Users\Cyberpowerpc\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Cyberpowerpc\Desktop\PhD\MUSE SDK\libmuse_windows_7.1.1\OSC Receiver Audio Feedback.py", line 120, in init_plot
plt.show()
File "C:\Users\Cyberpowerpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\pyplot.py", line 614, in show
return _get_backend_mod().show(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cyberpowerpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\backend_bases.py", line 3547, in show
cls.mainloop()
File "C:\Users\Cyberpowerpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\backends\backend_qt.py", line 640, in start_main_loop
with _allow_interrupt_qt(qapp):
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cyberpowerpc\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "C:\Users\Cyberpowerpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\backend_bases.py", line 1641, in _allow_interrupt
old_wakeup_fd = signal.set_wakeup_fd(wsock.fileno())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: set_wakeup_fd only works in main thread of the main interpreter
C:\Users\Cyberpowerpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\matplotlib\animation.py:908: UserWarning: Animation was deleted without rendering anything. This is most likely not intended. To prevent deletion, assign the Animation to a variable, e.g. `anim`, that exists until you output the Animation using `plt.show()` or `anim.save()`.
warnings.warn(



Any suggestions how to fix this? :)
Dom
Posts: 5
Joined: Fri Jan 17, 2025 7:58 am

Re: Problems getting OSC receiver audio feedback example working

Post by Dom »

I've got this working now but would like to use gyro data to make sure the bell can't be triggered unless you're keeping still. I don't suppose anyone has an example of doing this already? :)
Dom
Posts: 5
Joined: Fri Jan 17, 2025 7:58 am

Re: Problems getting OSC receiver audio feedback example working

Post by Dom »

I'm a bit stuck on figuring out at good gyro handler. If anyone has any bright ideas they'd be much appreciated. :D
Liasso
Posts: 4
Joined: Fri Mar 29, 2024 7:17 am

Re: Problems getting OSC receiver audio feedback example working

Post by Liasso »

I haven't worked with EEG data specifically, but I’ve handled gyro data in other projects. A good approach is to set a threshold for movement and ignore data when motion exceeds that limit. Filtering out small jitters with a moving average or a low-pass filter can be helpful as well. You might also consider using a weighted rolling average to smooth things out.

If you're dealing with video files in your project and need to switch formats, check out https://www.movavi.com/video-converter/vob-converter.html. It’s been really handy for me when converting files quickly without losing quality.
zaek87
Posts: 4
Joined: Mon Mar 24, 2025 10:47 am

Re: Problems getting OSC receiver audio feedback example working

Post by zaek87 »

For gyro data, try to set a threshold to ignore motion when greater than some value. You could also apply a low-pass filter or a moving avergage to filter out small movements. This will also help prevent the bell from ringing unless you are completely still.
Post Reply