Playing sound with low latency and jitter in OpenSesame

OpenSesame is probably the greatest software for creating experiments for psychology, neuroscience, etc. It has a graphical interface for the most useful components, such as playing a sound file (sampler) or creating own tone (synth). However, the way these components are implemented (using PyGame) may not provide good temporal accuracy (latency), meaning the sound can be delayed, which might not be that bad. What can be very bad (for things like ERPs, etc.) is potentially bad temporal precision (jitter), meaning that the delay may vary from trial to trial. You should read about these matters here.

In this post I want to show how I managed to significantly improve the timing of my auditory stimuli using inline code, PyAudio and ASIO API, even using onboard sound card in Windows 7.

Continue reading

E-Prime tips and tricks

Personal E-Prime knowledge base of one experimental psychology PhD student, or, what I’ve found useful to know during my learning experience with E-Prime… If you find something that is wrong or want to add more tips, please absolutely do that (in the comments below)!

Contents:

Continue reading

Transcranial Magnetic Stimulation as a Research Tool in Cognitive Neuroscience

Originally a report for the course “Clinical neuro-cognitive research: Transcranial Magnetic Stimulation” given by Paul Taylor in the WS of 2012/2013 at the LMU in Munich. After spending quite a lot of time writing it I thought it would be a pity not to at least publish it at my blog and at Academia.edu🙂

Introduction

Transcranial magnetic stimulation (TMS) is a neurostimulation and neuromodulation technique that induces electric field in the brain based on Faraday’s principle of electro-magnetic induction and thus interferes with the neural processing. Although its roots stem to the first half of the 19th century, the first successful stimulation of the human cortex was performed in 1985 by Barker (Barker, Jalinous, & Freeston, 1985). Since then, the number of published papers reporting the use of TMS has been increasing rapidly (Rossi, Hallett, Rossini, & Pascual-Leone, 2009). Despite the growing popularity of the method, the mechanisms by which it influences brain activity are not completely understood. This review gives a brief overview of the recent theories and the supporting evidence. However, the main focus of this review is the use of TMS as a research tool in cognitive neuroscience and neuropsychology. I will try to illustrate the broad possibilities of application of TMS in these fields, what questions it could answer, how this technique could be combined with neuroimaging, and discuss the safety considerations related to the use of TMS in non-clinical settings.

Continue reading

Posner cueing task: online demonstration

I have tried searching for a nice online demonstration of the classic Posner’s cueing paradigm without much success. A pretty good one can be found at the APA Online Psychology Laboratory. It is nice in the way that it allows adjustment of the visual angle for individual conditions. But the experimental procedure for example lacked a blank ITI (inter-trial interval), which made it very difficult to prepare for the upcoming trial (thus virtually unusable), and in the end the app crashed so I did not get my results. Importantly, it does not allow you to tweak the parameters of the task.

So I’ve decided to create my own online demo! It allows you to choose between a central (endogenous) arrow cue, central symbolic cue, and a peripheral (exogenous) cue, you can set the ratio of valid to invalid to neutral cue trials, and you can adjust the SOA (stimulus onset asynchrony) between the cue and the target. Hope someone will find it useful.

It is not meant for real data acquisition, but solely as a demonstration for educational purposes. No warranties.

You can run it from this separate page, which also provides the description on how to use it, what to try, etc, including the whole source code. A nice general explanation what the Posner task is about can be found on Wikipedia or at the APA website.

posner-online-preview

Click the image to open the experiment

It is implemented as a Java applet in NetLogo, which is not really suited for such things (it is a simulation tool, where precise real-world timing usually is not a concern), but still it works remarkably well, I must say.

You are likely to get security warnings because the app does not have a digital signature. But you can trust me that it won’t do anything bad to your PC, so just accept and allow everything and it should run just fine. Some browsers may refuse to run it anyway (security reasons) if you do not have the latest Java version. You can find it here. Note that even if you have a 64bit system, your browser can be a 32bit application, so get both versions to be sure. Some browsers, like my Firefox, still refused to run it, so I had to manually add an exception in the Java control panel. It is simple: In Windows, open the Control Panel (in the Start menu) > Java icon > Security tab > button “Edit Site List…” > button “Add” > enter “http://www.ondrejhavlicek.com” > Ok buttons.

If you like it, drop a comment, if not, do that as well please!

Hello world!

This site is meant to serve as my personal profile and occasionally as a space for those of my disorganized ideas that are (hopefully) safe for public display. Language of the posts will probably oscillate between Czech and English, depending on the target audience, topic, and my mood: The purpose of the Czech articles is mostly to popularize the various topics of cognitive sciences and philosophy in my home country, i.e., to help the Czech Rep catch up with the rest of the world, which is why I came up with the idea of having a blog anyway. My mind could also from time to time produce something that could be of interest to the English-speaking world as well. So, let’s see how it develops…

(And yes, my background is in IT..;-))