Gated trigger from MWorks to STG

vthirupp's Avatar

vthirupp

21 Dec, 2020 07:10 PM

Hello MWorks,

I am designing a transcranial direct current stimulation (tDCS) experiment in MWorks using xBI. I need to send a gated trigger from MWorks to a device called STG (https://www.multichannelsystems.com/products/stg4004-16ma). What would be the best possible way to send information like current intensity & pulse duration? Would you recommend me to use 'Pulse variable'? If so, which variable should I use so that I can send a rectangular pulse to STG? Any advice is greatly appreciated. Looking forward to your response!

Regards,
Vighnesh.

  1. Support Staff 1 Posted by Christopher Sta... on 22 Dec, 2020 02:33 PM

    Christopher Stawarz's Avatar

    Hi Vighnesh,

    MWorks' Pulse Variable action does nothing other than set a specified variable to 1 for a duration then reset it to 0. Whether it would be appropriate for controlling your stimulation hardware depends entirely on the interface (hardware and software) used to connect MWorks to the device.

    If you're using an XBI system, then I presume you'll be making use of its general-purpose I/O capabilities. If so, I recommend seeking the advice of someone familiar with the MWorks XBI interface. (The XBI interface is not a standard part of MWorks, and I have no knowledge of or experience with it.)

    Regards,
    Chris Stawarz

  2. 2 Posted by vthirupp on 22 Dec, 2020 03:59 PM

    vthirupp's Avatar

    Hi Chris,

    Thank you very much for your prompt response. I will contact our xBI expert Ralf Brockhausen.

    I have another question, I train my animals on auditory tasks using xBI. To present auditory stimuli in xBI, I generate them on Matlab & save them as .wav files. During the experiment, MWorks loads .wav files & plays them during a trial. As a result, there is a latency of 16 milliseconds. I was wondering if you know a way to work around this issue. If not, do you plan to make any new plugins in the future that would let me define the sound frequency in a given trial & then MWorks presents the pre-defined tone without any time lag? Looking forward to your response!

    Regards,
    Vighnesh.

  3. Support Staff 3 Posted by Christopher Sta... on 23 Dec, 2020 09:40 PM

    Christopher Stawarz's Avatar

    Hi Vighnesh,

    I don't know the source of the 16ms latency you're experiencing.

    MWorks' current audio playback capabilities are very limited. At some point, I would love to rework things so that audio stimuli are comparable to visual stimuli, in terms of both flexibility of stimulus definition and accuracy in presentation timing. However, I don't think I'll be able to take on such a project in the immediate future (i.e. the next 3-4 months).

    If you're interested in attempting to develop a new audio plugin yourself, it looks like AVAudioEngine is Apple's currently-recommended interface for low-latency audio playback.

    Cheers,
    Chris

  4. 4 Posted by vthirupp on 04 Jan, 2021 03:21 PM

    vthirupp's Avatar

    Hi Chris,

    Thanks again for your response. I load my Matlab-generated wav files on MWorks in the 'Sounds' directory & then use the built-in function 'Play sound' to play a sound in a given trial. Please let me know if this is the right way to do it. To look for latency issues, I used a click train & found that if the first click starts after 16 or 20 ms from the click train onset (please see the figure) then I can hear all the 3 clicks when played on MWorks.

    It would be great if MWorks can present audio stimuli to the level of visual stimuli. I will look into AVAudioEngine.

    Regards,
    Vighnesh.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac