Welcome! Log In Create A New Profile

Advanced

analogoutput randomly sends wrong waveforms

Posted by Xuanyu 
analogoutput randomly sends wrong waveforms
May 12, 2025 01:14PM
Dear Jaewon:

I have encountered a very weird bug. In my timescript, I load four waveforms in the buffer via `putdata(ao, wf{i})`, and manually chose among them via `set(ao, 'ManualTriggerNextWF', c);`. I have set `ao.ManualTriggerWFOutput = 'Chosen';` In each loop, three WFs are sent in sequence in a for loop, with `idle(ICI)` in between them. The scripts run well, everything looks perfect...

Now comes the weird part, in about 1/20 of the trials, I spotted that one of the AO item would wrongly repeat the previous one that was triggered. Since I have 3 items every trial, this occurs around one out of 60 stimuli. I'm pretty sure that I passed the correct index to the functions as I printed them on the screen during the course. And the occurrence doesn't seem to follow any systematic pattern. Sometimes, two errors happen in adjacent trials, but mostly far apart and not limited to any particular item in the buffer.

I don't know if any other people have had similar issues before. It would be very problematic for auditory neuroscience ppl.

Best regards,
Xuanyu
Re: analogoutput randomly sends wrong waveforms
May 13, 2025 09:23PM
First of all, I do not recommend calling DAQ functions directly. I cannot guarantee the future compatibility of such a usage.

I do not know why you get that problem, but just wonder why it has to be complicated like that. Switching between WFs in a loop takes time and there is not so much advantage in doing so, in terms of timing accuracy. Do you have to decide on the fly which three should be played?

If you want to play three WFs with some intervals between them, load WF1, Silence1, WF2, Silence2 and WF3 and then play them all sequentially by setting ManualTriggerWFOutput to All. This can give a bit of advantage since DAQ knows which WF will be played next and does not need to switch. Or you can put them together as one WF before feeding to DAQ.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.