-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Allow triggering after onset #419
Conversation
Codecov Report
@@ Coverage Diff @@
## main #419 +/- ##
==========================================
+ Coverage 86.85% 88.20% +1.35%
==========================================
Files 50 50
Lines 6673 6683 +10
Branches 1097 1099 +2
==========================================
+ Hits 5796 5895 +99
+ Misses 621 530 -91
- Partials 256 258 +2 |
We've used this in a couple experiments now. It seems to be working very well. We are having a couple weird audio issues that started around the time we began using this, but we don't think are related:
Both of these problems are very intermittent and not likely related, but seem worth mentioning since they are happening in scripts using this branch. |
The I don't know where we would start to debug these, which is not great since they seem like pressing problems. Maybe we can make some minimal example using plain Maybe a first attempt at MWE is to absolutely kill your CPU with some other processes (is SETI@home still a thing?) while running an experiment to see if it easily replicates, then we can work on whittling it down... |
Pegging the CPU with other stuff is a good idea. It just doesn't make much sense. We give our process high priority in win, and CPU and RAM are both not even close to fully utilized when this happens, though it could be a single core getting hit for some reason. |
@@ -765,10 +767,13 @@ def _wait_secs(secs, ec=None): | |||
while (clock() - t0) < secs: | |||
ec._dispatch_events() | |||
ec.check_force_quit() | |||
time.sleep(0.0001) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkmaddox maybe somehow this is the problematic change? It's easy enough to revert if need be.
Also do you do ec.wait_secs
or from expyfun.utils import wait_secs
? The former uses this code path, the latter uses the code path below.
Using |
@rkmaddox and I are pretty confident the issues we mentioned previously are not from changes in this branch. We've reverted the changes to Bombing the CPU didn't seem to do anything, although I'm not sure the best way to test it. I ran the batch file below a bunch of times simultaneously (at least as many times as there are cores), but the CPU usage always hovered around 90%. Setting the python script to below normal priority made no difference.
|
One more thing I can think of is, during some point you're going to wait anyway (ISI maybe?) try adding a:
This will force garbage collection. Python garbage collects at unknown times, and maybe at some point you're getting hit by a garbage collection that takes a really long time for some reason. I have no idea why this would hang -- and Also, have you checked the logs to see when the hangup occurs? In particular I would Ultimately, though, I think this is probably some python-rtmixer bug. I wonder if we're hitting some variant of spatialaudio/python-rtmixer#9 (comment). But the problem is that it's not deterministic and takes a long time to hit, so it's terrible to debug! |
... in the meantime I'm inclined to merge this as-is. I'll close and reopen to make sure CIs are still happy |
81a1cb3
to
37c56ef
Compare
Thanks @larsoner |
SOUND_CARD_TRIGGER_ID_AFTER_ONSET
config var to allow stamping the TTL IDs after the 1 trigger so that a single sound can be played. Should help with rtmixer/portaudio fragility when sounds are stopped and started in close proximity.stamp_triggers
for the sound controller to return as quickly as possible whenwait_for_last=False
. We had made it wait until all but the last trigger was stamped to be consistent with TDT and parallel triggers. It seems better not to do this if we don't need to -- it decreases the uniformity of our approach across platforms, but makes the sound card platform (probably the way of the future) work better.wait_secs
when not used in anec
context. Probably doesn't matter but I noticed this bug was introduced in MRG, ENH: Joystick control and Pyglet 1.4 #399.