mattap: a matlab toolbox for the control and analysis of movement synchronisation experiments

8
Journal of Neuroscience Methods 177 (2009) 250–257 Contents lists available at ScienceDirect Journal of Neuroscience Methods journal homepage: www.elsevier.com/locate/jneumeth MatTAP: A MATLAB toolbox for the control and analysis of movement synchronisation experiments Mark T. Elliott , Andrew E. Welchman, Alan M. Wing Behavioural Brain Sciences Centre, School of Psychology, University of Birmingham, Edgbaston B15 2TT, UK article info Article history: Received 25 March 2008 Received in revised form 29 September 2008 Accepted 1 October 2008 Keywords: MATLAB Timing Toolbox Synchronisation Tapping Metronome abstract Investigating movement timing and synchronisation at the sub-second range relies on an experimen- tal setup that has high temporal fidelity, is able to deliver output cues and can capture corresponding responses. Modern, multi-tasking operating systems make this increasingly challenging when using stan- dard PC hardware and programming languages. This paper describes a new free suite of tools (available from http://www.snipurl.com/mattap) for use within the MATLAB programming environment, com- patible with Microsoft Windows and a range of data acquisition hardware. The toolbox allows flexible generation of timing cues with high temporal accuracy, the capture and automatic storage of correspond- ing participant responses and an integrated analysis module for the rapid processing of results. A simple graphical user interface is used to navigate the toolbox and so can be operated easily by users not familiar with programming languages. However, it is also fully extensible and customisable, allowing adapta- tion for individual experiments and facilitating the addition of new modules in future releases. Here we discuss the relevance of the MatTAP (MATLAB Timing Analysis Package) toolbox to current timing exper- iments and compare its use to alternative methods. We validate the accuracy of the analysis module through comparison to manual observation methods and replicate a previous sensorimotor synchroni- sation experiment to demonstrate the versatility of the toolbox features demanded by such movement synchronisation paradigms. © 2008 Elsevier B.V. All rights reserved. 1. Introduction Producing rhythmic movements and actions is an everyday task that we can execute using our own internal pacing signals (e.g. walking or cycling), or in time with some external event (e.g. danc- ing with a partner (Gentry and Feron, 2004; Batalha and Macara, 2007) or playing in a musical ensemble (Keller et al., 2007)). Empir- ical investigations of the timing of rhythmic actions are often conducted by instructing participants to tap their index finger in time to an auditory, visual or tactile stimulus produced at regular intervals (a metronome), typically at rates above 1Hz. Following this, the metronome stimulus is often turned off while the par- ticipant continues to tap at the same pace for a further period of time. This procedure, which was first employed by Stevens (1886), is referred to as the synchronisation-continuation paradigm. Per- formance is typically described in terms of the disparity between the metronome pulse and finger tap response (asynchrony) in the synchronisation phase (Fig. 1). It is often noted that the tap precedes the metronome in an anticipatory manner (Vos et al., Corresponding author. Tel.: +44 121 414 9517; fax: +44 121 414 4897. E-mail address: [email protected] (M.T. Elliott). 1995; Aschersleben, 2002), with the resulting timing error gen- erally in the order of tens of milliseconds (standard notation is that a negative value indicates an anticipatory tap). Similarly, in the continuation phase, when the metronome is switched off, self-paced tapping can be analysed through the measurement of inter-response intervals (IRI)—the interval between the current and previous tap onset (Wing and Kristofferson, 1973; Billon et al., 1996; Collyer and Church, 1998; Inui et al., 2001). Detailed analysis of finger tapping timing accuracy in terms of mean and variability has given rise to a large literature that has shaped understanding of movement synchronisation (see Repp, 2005 for a comprehensive review). However, given the small tem- poral magnitude of these measurements (typically in the tens of milliseconds range), a considerable empirical challenge is to produce stimulus events with reliable timing while concurrently capturing the participant’s movements with high temporal fidelity using sensors appropriate to the movement (e.g. force-transducer, video-based motion tracking). Meeting this challenge requires an experimental setup that is able to (i) generate cues with a low level of temporal lag and uncertainty, (ii) capture responses with a high sampling accuracy and (iii) allow a true measurement of the participants’ timing error by aligning precisely the partici- pant’s movement with the cue event. Moreover, researchers often 0165-0270/$ – see front matter © 2008 Elsevier B.V. All rights reserved. doi:10.1016/j.jneumeth.2008.10.002

Upload: mark-t-elliott

Post on 26-Jun-2016

234 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: MatTAP: A MATLAB toolbox for the control and analysis of movement synchronisation experiments

Ms

MB

a

ARR2A

KMTTSTM

1

twi2ictitttifttp

0d

Journal of Neuroscience Methods 177 (2009) 250–257

Contents lists available at ScienceDirect

Journal of Neuroscience Methods

journa l homepage: www.e lsev ier .com/ locate / jneumeth

atTAP: A MATLAB toolbox for the control and analysis of movementynchronisation experiments

ark T. Elliott ∗, Andrew E. Welchman, Alan M. Wingehavioural Brain Sciences Centre, School of Psychology, University of Birmingham, Edgbaston B15 2TT, UK

r t i c l e i n f o

rticle history:eceived 25 March 2008eceived in revised form9 September 2008ccepted 1 October 2008

eywords:ATLAB

imingoolboxynchronisationappingetronome

a b s t r a c t

Investigating movement timing and synchronisation at the sub-second range relies on an experimen-tal setup that has high temporal fidelity, is able to deliver output cues and can capture correspondingresponses. Modern, multi-tasking operating systems make this increasingly challenging when using stan-dard PC hardware and programming languages. This paper describes a new free suite of tools (availablefrom http://www.snipurl.com/mattap) for use within the MATLAB programming environment, com-patible with Microsoft Windows and a range of data acquisition hardware. The toolbox allows flexiblegeneration of timing cues with high temporal accuracy, the capture and automatic storage of correspond-ing participant responses and an integrated analysis module for the rapid processing of results. A simplegraphical user interface is used to navigate the toolbox and so can be operated easily by users not familiarwith programming languages. However, it is also fully extensible and customisable, allowing adapta-tion for individual experiments and facilitating the addition of new modules in future releases. Here wediscuss the relevance of the MatTAP (MATLAB Timing Analysis Package) toolbox to current timing exper-

iments and compare its use to alternative methods. We validate the accuracy of the analysis modulethrough comparison to manual observation methods and replicate a previous sensorimotor synchroni-sation experiment to demonstrate the versatility of the toolbox features demanded by such movement

s.

1ettsipC

ms2pop

synchronisation paradigm

. Introduction

Producing rhythmic movements and actions is an everyday taskhat we can execute using our own internal pacing signals (e.g.alking or cycling), or in time with some external event (e.g. danc-

ng with a partner (Gentry and Feron, 2004; Batalha and Macara,007) or playing in a musical ensemble (Keller et al., 2007)). Empir-

cal investigations of the timing of rhythmic actions are oftenonducted by instructing participants to tap their index finger inime to an auditory, visual or tactile stimulus produced at regularntervals (a metronome), typically at rates above 1 Hz. Followinghis, the metronome stimulus is often turned off while the par-icipant continues to tap at the same pace for a further period ofime. This procedure, which was first employed by Stevens (1886),s referred to as the synchronisation-continuation paradigm. Per-

ormance is typically described in terms of the disparity betweenhe metronome pulse and finger tap response (asynchrony) inhe synchronisation phase (Fig. 1). It is often noted that the taprecedes the metronome in an anticipatory manner (Vos et al.,

∗ Corresponding author. Tel.: +44 121 414 9517; fax: +44 121 414 4897.E-mail address: [email protected] (M.T. Elliott).

cuvelatp

165-0270/$ – see front matter © 2008 Elsevier B.V. All rights reserved.oi:10.1016/j.jneumeth.2008.10.002

© 2008 Elsevier B.V. All rights reserved.

995; Aschersleben, 2002), with the resulting timing error gen-rally in the order of tens of milliseconds (standard notation ishat a negative value indicates an anticipatory tap). Similarly, inhe continuation phase, when the metronome is switched off,elf-paced tapping can be analysed through the measurement ofnter-response intervals (IRI)—the interval between the current andrevious tap onset (Wing and Kristofferson, 1973; Billon et al., 1996;ollyer and Church, 1998; Inui et al., 2001).

Detailed analysis of finger tapping timing accuracy in terms ofean and variability has given rise to a large literature that has

haped understanding of movement synchronisation (see Repp,005 for a comprehensive review). However, given the small tem-oral magnitude of these measurements (typically in the tensf milliseconds range), a considerable empirical challenge is toroduce stimulus events with reliable timing while concurrentlyapturing the participant’s movements with high temporal fidelitysing sensors appropriate to the movement (e.g. force-transducer,ideo-based motion tracking). Meeting this challenge requires an

xperimental setup that is able to (i) generate cues with a lowevel of temporal lag and uncertainty, (ii) capture responses with

high sampling accuracy and (iii) allow a true measurement ofhe participants’ timing error by aligning precisely the partici-ant’s movement with the cue event. Moreover, researchers often

Page 2: MatTAP: A MATLAB toolbox for the control and analysis of movement synchronisation experiments

M.T. Elliott et al. / Journal of Neuroscience Methods 177 (2009) 250–257 251

F the ed s indiv m the

rcaFeiehct2goaI

nDedh1imtbirirssfriumcwlc

yMraes

Tvtflpeif

1

iapMhtohs

MatTAP contains three main modules of operation. First, agraphical user interface is provided to allow full experimentalcontrol of the metronome events and the capture of participantmovements. Based on the diversity of previous experiments in thearea (see above), the interface allows the user to generate up to two

Fig. 2. A typical hardware configuration for cue generation and response captureusing MatTAP. The toolbox uses data acquisition hardware to achieve a high level oftiming accuracy. (1) Two outputs are generated to drive stimuli. One is an analoguewaveform, typically used to drive an audio speaker, but can also be applied to hapticor visual devices. The second output is a digital square pulse which can be used to

ig. 1. MatTAP captures both the metronome event and participant’s response toifference between the metronome onsets and the corresponding response onsets. Aalues. Similarly, the inter-response intervals of the responses can be calculated fro

equire more complex setups to the standard synchronisation-ontinuation paradigm in which the properties of the metronomend/or the properties of the produced movement might be varied.or example, the duration of individual tones has been varied (Vost al., 1995), while investigating syncopated synchronisation hasnvolved using two independently timed auditory tones at differ-nt pitches (Keller and Repp, 2005). Further, a number of studiesave involved controlling the metronome rate during a trial byhanging the period in a stepped manner (Thaut et al., 1998), con-inuously (Schulze et al., 2005) or as a single phase shift (Repp,000, 2001, 2002; Elliott et al., 2008). Other studies have investi-ated multi-effector responses such as bimanual synchronisationf right and left hands (Drewing and Aschersleben, 2003; Chen etl., 2005; Doumas and Wing, 2007) or hand and foot (Helmuth andvry, 1996).

Previous implementations for the accurate control of synchro-isation experiments have exploited MIDI (Musical Instrumentigital Interface) systems (e.g. Repp, 2000; Finney, 2001; Schulzet al., 2005). This system has been used as the MIDI interface usesedicated hardware to ensure a constant output data rate thatas high temporal accuracy (latencies of 3 ms and jitter of aroundms are typical, Heckroth, 2001) with similar accuracy reported for

nput events. In the context of movement synchronisation experi-ents this enables investigators to produce regular/rhythmic audio

ones whilst simultaneously detecting key strike events instigatedy the participants. The disadvantage of the MIDI standard is thatt is reliant on the use of digital musical instruments to captureesponses (such as a keyboard) imposing constraints on the exper-mental setup and making the implementation of multi-effectorecordings challenging. Further, there are few research-specificoftware tools that exploit the MIDI protocol, hence timing analy-is must be performed with separate software using data exportedrom the sampling equipment. To date, MIDI-based methods haveemained attractive through their use of hardware whose timings independent of the controlling computer workstation. In partic-lar, using an exclusively software-based solution under modern,ulti-tasking operating systems is difficult because the timing pro-

ess relies on the central computer clock (the CPU) that is sharedith a range of different processes. This often results in temporal

atency and jitter in both the production of a metronome and theapture of responses that cannot be controlled reliably.

Here we describe a dedicated solution for the control and anal-sis of synchronisation-continuation experiments. Written in the

ATLAB® (The MathWorks, Inc., MA, USA) programming envi-

onment, the MatTAP (MATLAB Timing Analysis Package) toolboxllows sub-millisecond accuracy for the production of metronomevents and the capture of participant responses (from a range ofensors) through the use of dedicated data acquisition hardware.

tbtaea

vent. Using this data, asynchronies can be calculated by measuring the temporalcated, responses typically precede the metronome resulting in negative asynchronytime between the current and preceding response.

he software incorporates a graphical user interface (GUI) to pro-ide users with high-level control in the generation of multipleimed output cues with a range of different parameters. This allowsexible experimental design without the necessity of writing newrogram scripts and hence reduces the likelihood of introducingrrors into a particular paradigm. On the other hand, the toolboxs fully extensible, allowing new modules to be added by thoseamiliar with the MATLAB programming language.

.1. Overview of the toolbox

MatTAP is a MATLAB toolbox written with the goal of simplify-ng the process of running synchronisation experiments with highlyccurate metronome signals and capturing the responses made byarticipants. It uses the MATLAB Data Acquisition Toolbox® (TheathWorks, Inc., MA, USA) to interface dedicated data acquisition

ardware. This removes the signal generation and data captureasks away from the PC, avoiding the problems of multi-taskingperating systems and allowing high temporal precision. A typicalardware configuration for an experimental setup using MatTAP ishown in Fig. 2.

rigger bespoke stimuli equipment. To increase accuracy further, this pulse is fedack into the system to compensate for processing delays in the hardware. (2) Upo two sensors can be utilised to capture responses. Any sensor which producesn analogue or digital voltage, typically in the range ±5 V can be used to recordvents. (3) The output signals and corresponding responses are captured and storedutomatically in individual, sequentially numbered .mat format files.

Page 3: MatTAP: A MATLAB toolbox for the control and analysis of movement synchronisation experiments

252 M.T. Elliott et al. / Journal of Neuroscience Methods 177 (2009) 250–257

F tTAPU the to

iftcmniticdoo

eda

pcatod

1

slswM

•••

fMiv

2

2

hioosamruBoic

atvna

ig. 3. A diagram showing the steps involved from setting up an experiment in Maser Action is where the user interacts with toolbox; Background Activity is where

ndependent metronomes, which are fully adjustable for intervalrequency, tone frequency, tone duration, length of synchronisa-ion period and length of continuation period. Additionally, jitteran be added to the metronome interval and a phase shift in theetronome can be inserted at individually chosen intervals. Exter-

al stimuli may be driven using the associated timing pulse outputn analogue form (sinusoidal wave, typically used to generate audioones or tactile vibrations) or digital form (0/1 V binary pulse, typ-cally used as a trigger signal for external stimuli). Up to two inputhannels can be configured to capture responses from any sensorevice able to produce analogue or digital voltages within the rangef the utilised data acquisition card. Typically this will be ±5 V at 12r 16 bits, representing a resolution of 2.44 or 0.15 mV respectively.

Second, a built in file manager saves the data captured fromach trial as separate, sequentially numbered .mat files in a pre-etermined directory structure, enabling easy post-processing andnalysis of the experimental data.

Finally, an analysis module is provided that can be used torocess the raw data files automatically, extract onset times andalculate inter-response intervals and asynchronies. Fig. 3 providesstep-based view of how the MatTAP modules are used collec-

ively to run a timing or synchronisation experiment. Section 2f this article discusses the operation of these modules in moreetail.

.2. Availability and requirements

MatTAP can be downloaded at no cost from http://www.nipurl.com/mattap. The software is released under the GNU Pub-ic License and is provided without warranty. The MatTAP GUI istarted by typing mattap vx xx in the MATLAB command windowhere the version number downloaded should replace the x xx.atTAP has the following system requirements:

MATLAB—Tested on versions 7.0 onwards (i.e. 2006a/b, 2007a/b).MATLAB Data Acquisition Toolbox.Data acquisition card supported by MATLAB Data AcquisitionToolbox (e.g. Advantech, Measurement Computing, and National

onrav

to running the analysis on the acquired data using the three provided modules. Aolbox automatically executes a task after a user action.

Instruments), with a minimum of two analogue output channelsand two analogue input channels.

The MATLAB Data Acquisition Toolbox is currently only availableor workstations running Microsoft Windows. Therefore the use of

atTAP on other platforms, such as Apple OS X or Linux machines,s dependent on the future development of a platform independentersion of Mathwork’s Data Acquisition Toolbox.

. Methods

.1. Metronome control

The diversity of timing experiments previously undertakenighlights the need for a tool that provides a high level of flexibility

n the parameters that define a metronome. The metronome sectionf MatTAP’s GUI (Fig. 4: “Metronome” page) allows the generationf up to two simultaneous metronomes defined by the parametershown in Table 1. Properties of the metronome can be controllednd customised on a per-trial basis by adjusting the parametersanually using the GUI (Fig. 4; A). Alternatively, MatTAP is able to

ead in a pre-determined set of parameters on a trial-by-trial basissing values stored in a comma separated variable (CSV) file (Fig. 4;). By doing so, an experimenter can create a protocol for each trialf the experiment using software such as Microsoft Excel and eas-ly import the data into MatTAP to automate randomisation whenonducting the experiment.

Using the defined parameters, MatTAP exploits MATLAB’s vectornd matrix manipulation abilities to produce an output sample vec-or containing the metronome definition for the whole trial. Eachector element represents an output sample (output at the desig-ated sampling rate) in binary form, i.e. square pulses set high at 1 Vnd low at 0 V. The pulses are set high to identify the metronome

nset and duration. This can be used as a trigger pulse for any exter-al stimulus being used. A secondary vector is generated in parallel,eplacing the square pulses with sinusoidal waveforms (−5 to 5 V)t the chosen tone frequency. This is typically output to a speakeria an amplifier to generate an auditory tone.
Page 4: MatTAP: A MATLAB toolbox for the control and analysis of movement synchronisation experiments

M.T. Elliott et al. / Journal of Neuroscience Methods 177 (2009) 250–257 253

F e. Them a newr ge (E).

dood(hosr

taa

TMM

P

ST

M

S

TNS

O

I

ig. 4. The user interacts with MatTAP using two GUI screens, File and Metronomanually (A) or via a trial control script (B). The File page allows the user to define

aw data from a chosen trial (D). The analysis module is also called from the File pa

The two vectors are converted to physical output signals usingata acquisition hardware. Data acquisition cards (DAQ) are capablef highly accurate input and output sampling that is independentf the PC hardware and software used to generate the vectors. Aefault script is supplied for use with National Instruments cards

NI Corporation, TX, USA). Devices used with MatTAP are required toave available a minimum of two analogue input and two analogueutput channels. To compensate for the independence between theampling of the output and input channels on DAQ hardware, it isecommended that the output timing pulse is fed back into one of

3

ip

able 1atTAP allows flexible metronome generation to allow a wide range of experimental proatTAP GUI.

arameter Description

ample frequency Controls the input and output sampling frequency of the data acquisone frequency The frequency of the tone emitted when using the analogue metron

frequency of a tactile stimulus.ean ISI The inter-stimulus interval (ISI), i.e. time between the onsets of the m

MatTAP allows variability in the timing of individual metronome pu.D. ISI In the case of a variable metronome, this parameter controls the stan

If the metronome is regular (fixed) this parameter is ignored.one duration The duration in milliseconds of each metronome pulse.o. of stimuli The number of metronome pulses to be output in the trial (the synchilence The duration (in seconds) of the continuation phase (metronome sup

analogue output is produced. If the continuation phase is set to greathis period to mark the end of the trial.

ffset to M1 The temporal offset (in milliseconds) between the first (M1) and secmetronomes have the same phase. A negative offset indicates that thM1 that leads M2.

nsert phase shift Insert a phase shift before one of the metronome pulses. This lets thcorresponding ISIs return to their standard period such that the met

Metronome page allows the user to fully define one or two metronomes, eitherexperiment, lists trials within an experiment (C) and provides a basic plot of the

he DAQ inputs to ensure the difference between metronome onsetsnd the associated responses are recorded with the highest level ofccuracy (see Fig. 2).

. Parameter scripts

With the exception of phase shift insertion, MatTAP is able tomport comma separated variable files to automatically set thearameters described in Table 1 on a trial-by-trial basis. This allows

tocols to be implemented. This table lists the parameters that can be set using the

ition card.ome output. This is typically used to set the pitch of an audio output or vibration

etronome tones. For a regular metronome this value is a constant. However,lses. In the latter case this value corresponds to the mean of the distribution.dard deviation of the normal distribution from which ISIs are randomly selected.

ronisation phase).pressed). Synchronisation pulses are still emitted during this period, however, no

ter than 0, then a high pitched tone (2× tone frequency) is emitted at the end of

ond (M2) metronome if a second metronome is used. 0 would mean thee mean ISI of M2 leads M1, whereas a positive offset would produce a mean ISI of

e experimenter increase or decrease a single ISI by a fixed amount. Allronome is phase shifted.

Page 5: MatTAP: A MATLAB toolbox for the control and analysis of movement synchronisation experiments

254 M.T. Elliott et al. / Journal of Neuroscience Methods 177 (2009) 250–257

F espont onom

testbah

3

rmtiaru

4

ssaccdrathdacdwoh

tspw

5

todomiosttcdecsuim

6

To calculate the inter-response intervals (IRI) or the inter-stimulus intervals the appropriate aligned onset vector is taken andsplit into two new vectors:

Vector A consists of onsets (1:end-1)Vector B consists of onsets (2:end)

ig. 5. MatTAP can calculate the asynchronies between the onset of a participant’s rhe response onsets such that there is always one response corresponding to a metr

rials to be randomised or presented in a chosen sequence. Param-ter scripts can be produced in simple table format using softwareuch as Microsoft Excel, with each row of the table representing arial and the column relating to the described parameters. Fields cane manually overwritten using the MatTAP GUI if required, and tri-ls can be freely navigated backwards and forwards once the scriptas been loaded.

.1. Analysis

MatTAP includes an analysis module (Fig. 4; E) to process theaw data from each trial in order to determine the onsets of (i) theetronome pulse and (ii) the participant’s response. Having iden-

ified movement onsets, the software calculates the inter-responsentervals (IRI) between successive movements of the participantnd the asynchronies (timing errors) between the participant’sesponses and the metronome. Below we describe the algorithmssed in the analysis module.

. Onset detection algorithm

The appropriate algorithm for onset detection can be very signalpecific, depending on the nature of the response and the type ofensor used to capture it. For this reason MatTAP allows bespokelgorithms to be developed for onset detection without requiringhanges to other parts of the MatTAP code. In particular, a self-ontained function is used to extract the onsets from the capturedata. This function takes the raw data as an input parameter andeturns a vector of onsets to the main MatTAP program. A defaultlgorithm is included in the package that provides a means of cap-uring finger taps from a surface-based sensor. However, MatTAPas successfully been used with more sophisticated algorithmsesigned to extract onsets from motion-captured arm movementsnd forces measured by a force-transducer. The default algorithm

lassifies an onset by first identifying a point where the currentata value exceeds a specified threshold voltage (default: 0.2 V),ith the previous value having been noted as below this thresh-

ld. To avoid false detections, baseline offsets are subtracted andysteresis techniques are used to stop effects of noise around the

pta

se and the metronome onset. The flowchart above shows how the algorithm alignse onset.

hreshold, while the detected onset is discarded if the time elapsedince a previous positive detection is less than half the metronomeeriod. In Section 8, we validate this method through comparisonith a manual observation approach.

. Asynchrony calculation

The asynchrony calculation employs an algorithm which findshe shortest distance between tap onsets and each metronomenset. A distance matrix is formed by calculating the squaredifference between each metronome onset and each responsenset. The algorithm shown in Fig. 5 is then used to align eachetronome onset to an appropriate response onset. The result-

ng output is a two column matrix which has an equal numberf rows as there are metronome onsets. The first column con-ists of the metronome onset times, the second column containshe associated response onset time. If a participant misses a tap,hen a NaN (Not a Number) value is inserted into the positionorresponding to that metronome onset. Similarly, multiple tapsuring a single interval are dealt with by only keeping the clos-st tap onset and discarding the remainders.1 Asynchronies arealculated by subtracting the response onset times from the corre-ponding metronome onset times. When multiple metronomes aresed and/or multiple responses are captured, then the asynchrony

s calculated for each response–metronome combination (up to aaximum of two metronomes and two responses).

. Interval calculation

1 In some cases this method can enhance the perceived performance of a partici-ant if they were producing many multiple taps or missing taps. However, for mostrials where missed or multiple taps occur rarely, the described algorithm providesn efficient method for aligning responses to the metronome beats.

Page 6: MatTAP: A MATLAB toolbox for the control and analysis of movement synchronisation experiments

oscien

Aaem

6

cMiteraaafipi

7

tcfituto(nt

ettrmbas

fifittsiIu

8

trsrtmm

tae

8

muwDhppurtaooca

tahlwtsr(

wfiafebcotmo

ucMcTretdmVt0at

M.T. Elliott et al. / Journal of Neur

The resulting interval vector is calculated as Vector B − Vector. By using the aligned onsets, missed and double taps are removednd only valid intervals are calculated. Intervals are calculated forach metronome used and each response captured (up to a maxi-um of two metronomes and two responses).

.1. File management

The file manager (Fig. 4; “File” page) enables the structuredontrol of the data files obtained from each experimental trial.atTAP automatically creates a new directory when a new exper-

ment is created by the user, placing this new directory underhe current selected file path. The directory is identified by thexperiment name entered prefixed by ‘ tt ’, allowing MatTAP toecognise its own generated file structures. Further sub-directoriesre created within the experimental directory to store raw datand onset/analysis data. Files generated within these directoriesre named identically to the experiment name post-fixed with ale type identifier (rd, raw data; ons, onsets) and a trial number. Allreviously defined experiments found on a chosen path are shown

n the Experiment/Subject list box (Fig. 4; C).

. File contents

Initially, MatTAP generates an individual file for each completedrial that is stored in the raw data folder, with each trial automati-ally numbered sequentially. Trial files are stored as MATLAB .matles that contain several variables. Primarily, the raw data cap-ured by the data acquisition card is held in this file. This is thenfiltered and unprocessed data from the primary metronome andhe data captured by the sensors recording subject responses. Sec-nd a struct variable is used to store all the metronome parametersTable 1) defined for the given trial. Finally, the generated synchro-isation pulse vectors are stored for both the primary and, if used,he secondary metronome.

Executing the analysis module generates another set of files,ach associated with the individual trials. These files are stored inhe onsets folder as .mat files. Each file contains the extracted onsetimes for both the metronome pulses and corresponding subjectesponses, the calculated asynchrony (timing error) between eachetronome and response onset and the inter-response intervals

etween consecutive subject responses. Akin to the raw data files,struct variable is provided containing the metronome parameters

et for the trial.Once all the trials of an experiment have been analysed, a further

le is produced containing summary statistics. Again, this is a .matle which contains two MATLAB struct variables: sp, data relatingo the synchronisation phase of the trials and cp, data relating tohe continuation phase of the trials. Each struct variable contains aet of variables providing summary statistics for each trial. Thesenclude mean and standard deviation values for asynchrony andRI together with important metronome parameters which may besed for comparison across trials.

. Results

Here we validate MatTAP’s ability to generate metronomes, cap-ure responses and analyse tap responses accurately by presentingesults from three validation experiments. We first examine the

ystem as a whole, comparing the values obtained using the algo-ithms described previously to a method that was independent ofhe hardware and software used by MatTAP. Second, we identify

etronome and tap onsets manually within MATLAB using a cursorethod on plots of the data. Finally, we replicate a published study

aroba

ce Methods 177 (2009) 250–257 255

hat requires the insertion of small perturbations in the metronomend accurate analysis of responses and asynchronies to observe theffect.

.1. System accuracy

The accuracy of the raw data capture and generation is deter-ined by the sampling rate used and ultimately the DAQ hardware

sed. For example, a sample rate of 10,000 samples per secondould provide a temporal accuracy of up to 0.1 ms. Most modernAQ hardware devices are capable of maximum sampling rates ofundreds of kilo-samples per second and hence it can be seen thatotentially MatTAP is many more times accurate than any otherrevious synchronisation research software available. Equally, these of analogue data acquisition to capture responses enables accu-ate amplitude measurements as well as temporal ones. Again,his is dependent on the DAQ hardware used, a 16-bit DAQ with

voltage range 0–10 V would provide an amplitude resolutionf around 153 �V, while a 12-bit DAQ would have a resolutionf 2.4 mV. Given the appropriate sensor, recording the amplitudeould, for example, be used to measure the level of force applied intap.

To validate the MatTAP system as a whole, a test was set upo compare the values obtained using the algorithms describedbove in comparison to a method that was independent of theardware and software used by MatTAP. Using an oscilloscope (Agi-

ent 54621D, Agilent Technologies Inc., CA, USA) simultaneouslyith MatTAP and National Instruments USB-6229 data acquisi-

ion hardware to capture real experimental data, the metronomeynchronisation pulse and the participant’s corresponding tapesponse were examined by splitting the signal to both the DAQMatTAP) and oscilloscope inputs.

Data from a typical synchronisation–continuation experimentere used in which participants were instructed to tap their indexnger in synchrony with an auditory metronome producing beatst regular 500 ms intervals. Single trials were chosen randomlyrom three participants’ datasets. Using five consecutive tap-pulsevents from the three trials, the asynchronies were calculatedy eye on the oscilloscope using the built in cursor function toalculate the difference between tap onset time and metronomenset time (3 volunteers; time-base: 20 ms/div; cursor resolu-ion: 0.1 ms). The same data were processed using the analysis

odule in MatTAP after being captured at a sampling frequencyf 10 kS/s.

The variability of the onset detection by the MatTAP mod-le was contrasted to that of three human observers asked tolassify movement onsets using the oscilloscope. To do this, theatTAP asynchrony values were subtracted from the mean asyn-

hrony measurements produced by the three human observers.he mean and standard deviation of the resulting residuals wereecorded. The same method was then used to calculate the differ-nces between each individual’s measurements and the mean ofhe measurements recorded by the other two observers. The stan-ard deviation of the differences between MatTAP (0.27 ms) and theanual measurements (Volunteer 1: 0.29 ms; Volunteer 2: 0.26 ms;

olunteer 3: 0.27 ms) is comparable to that found between volun-eers. There is a slight positive bias in the mean difference (MatTAP:.21 ms; Volunteers: 0.08, 0.10, −0.18 ms). This arises as MatTAP’slgorithm defines the onset threshold as 0.2 V above zero whereashe volunteers were likely to select the onset on the oscilloscope

t a point lower than this value. However, this bias is negligible inelation to the asynchrony measurements, which are typically tworders of magnitude larger (Aschersleben, 2002). Furthermore, thisias is systematic, meaning that relative measures of asynchronyre unaffected.
Page 7: MatTAP: A MATLAB toolbox for the control and analysis of movement synchronisation experiments

256 M.T. Elliott et al. / Journal of Neuroscience Methods 177 (2009) 250–257

Table 2Mean and S.D. of measurements between observers averaged over three trials.Observers used a cursor method to pick event onsets from plots of data capturedusing MatTAP and a National Instruments USB-6229 data acquisition card. Theresults were compared to the onsets calculated using the MatTAP analysis module(shown in italics).

Observer ISI IRI Asynchrony

Mean (ms) S.D. (ms) Mean (ms) S.D. (ms) Mean (ms) S.D. (ms)

1 0.00 1.33 −0.03 5.61 −1.66 4.132 0.00 2.18 −0.08 4.48 0.62 3.693 0.00 1.03 −0.05 4.62 −1.14 3.584

M

8

ctITtmei5ptfpmiatupatlrbmt

8

easa(mmewt

mtbiop

Fig. 6. Participants tapped in time to a regular metronome subjected to a singlephase shift (interval lengthened by either 6, 8, 10 or 25 ms). Relative asynchrony wascalculated by measuring the pre-shift mean asynchrony and subtracting this valuefrom all asynchrony values in a trial. The plots show relative asynchrony averagedacross participants for each phase shift condition. The effect of the phase shift and thectp

mt

mcpatr

0.00 1.19 0.16 4.79 2.17 3.72

atTAP 0.00 0.77 −0.04 3.44 −1.74 2.64

.2. Validating the analysis module

Having established the validity of the hardware and softwareonfiguration, we wished to evaluate MatTAP’s analysis module fur-her. In particular, we used a common hardware setup (Nationalnstruments USB-6229), and analysed the data captured via Mat-AP using both the MatTAP analysis module and a manual methodhat involved using a mouse cursor to indicate the location of move-

ent onsets (method implemented in MATLAB). As in the previousxperiment, experimental participants were required to tap theirndex finger to an auditory metronome producing regular beats at00 ms. Three raw data trial files were chosen at random from threearticipants. Four volunteers were then asked to identify the onsetimes of both the metronome and tap recordings using the cursorunction built into the MATLAB plotting window. The chosen onsetoints were used to calculate the inter-stimulus intervals (ISI; theetronome intervals which should remain constant across a trial),

nter-response intervals (IRI; the intervals between tap responses)nd the asynchronies. Having obtained these values, we consideredhe differences between observers and the MatTAP analysis mod-le (as described for the previous experiment), with the resultsresented in Table 2. The obtained data suggested that the MatTAPnalysis module performed better than any of the human volun-eers asked to classify movement onsets. In particular, humans hadarger asynchrony biases (means) and greater variability (S.D.). Theesults show that the MatTAP analysis does not generate any greaterias than using the cursor method and furthermore, the analysisodule has a lower variability than the observers for all calcula-

ions.

.3. Replication of a previous study

As a final test of MatTAP, we replicated a previously publishedxperiment that required fine control over both the metronomend accurate data acquisition to capture subtle changes in theynchronisation performance of human subjects tapping to anuditory metronome. This experiment was based on that by Repp2000), who investigated the ability of participants to correct their

ovement synchronisation following a subtle phase shift in theetronome that could be detectable or subliminal. Repp used MIDI

quipment to run the experiment. Here we used MatTAP alongith a National Instruments USB-6229 data acquisition and a force-

ransducer to capture the responses.Six participants were requested to tap in synchrony to a

etronome (beats, 30; interval, 500 ms; tone frequency, 700 Hz;one duration, 30 ms) but were not informed that a phase pertur-

ation would be inserted. Phase shifts of 6, 8, 10 and 25 ms were

nserted at a random point between the 10th and 20th metronomenset, resulting in a single interval that was longer than thosereviously presented, and requiring participants to adjust their

dtsw

orresponding corrections are clear from the results and confirm MatTAP’s abilityo generate accurate metronomes and concurrently record the responses with equalrecision.

ovement synchronisation. Participants completed a total of fortyrials (i.e. ten trials per phase shift condition) for the experiment.

The MatTAP analysis module was used to extract the tap andetronome onsets from the experimental data and from those,

alculate the asynchronies for each trial. To determine whetherarticipants corrected for the phase shift, we calculated relativesynchrony by subtracting the pre-shift mean asynchrony from allhe asynchrony values for a trial (Repp, 2000). Fig. 6 shows theesulting between-subject mean relative asynchrony for each con-

ition. The effect of the phase shift on participants’ asynchrony athe point of occurrence (referenced by the time 0) can be clearlyeen. Correction to the perturbations is evident across conditions,ith recovery occurring within the two proceeding taps, regardless
Page 8: MatTAP: A MATLAB toolbox for the control and analysis of movement synchronisation experiments

oscien

ootm

9

oaMunflautii(acvt2oaadsao

enf2b2darctunaaaobt

A

a

aoc

R

A

B

B

B

BC

C

D

D

E

F

F

G

H

H

I

K

K

K

M

R

R

R

R

R

R

S

ST

M.T. Elliott et al. / Journal of Neur

f the phase shift magnitude. The results show, from a methodol-gy aspect, that MatTAP can accurately produce phase shifts downo very small temporal magnitudes and record the response to the

anipulated stimulus with equal precision.

. Discussion

Research into sensorimotor synchronisation is an active areaf investigation that lacks a widely available software tool whichllows researchers flexibility in experimental control and analysis.atTAP has been provided as a free toolbox for MATLAB, a widely

sed and understood programming tool in the research commu-ity. The toolbox has been designed to provide a high level ofexibility in producing a metronome output, uses external datacquisition hardware to ensure timing accuracy is not impingedpon by PC multi-tasking operating systems and provides a struc-ured file management system. We have taken the protocols usedn previous studies to define a set of parameters that has resultedn a metronome generation tool that allows phase shift insertionRepp, 2000, 2001, 2002), adjustable tone duration (Vos et al., 1995),djustable tone pitch (Keller and Repp, 2005) and the option tohange the metronome reliability by adding ‘jitter’ to the inter-als (Repp and Penel, 2004). Furthermore, we provide the abilityo record up to two response channels (Drewing and Aschersleben,003; Chen et al., 2005; Doumas and Wing, 2007), as well theption to generate up to two simultaneous metronomes, whichllow presentation in either single or dual modalities (Bertelsonnd Aschersleben, 2003; Kato and Konishi, 2006). Finally, we haveemonstrated the validity of the MatTAP setup and in particularhown that the analysis module provided will produce reliablenalysis of the data to the required sub-millisecond accuracy with-ut adding any significant measurement noise.

MatTAP currently has a few limitations, that mainly reflect thextent to which the MATLAB Data Acquisition Toolbox can commu-icate with the acquisition hardware. Notably, real-time response

eedback (Mates and Aschersleben, 2000; Finney and Warren,002) is not currently implemented in MatTAP thus, it is not possi-le to adapt metronome pulses within a trial (Repp and Knoblich,007). MatTAP is also dependent on the investigator’s access toata acquisition hardware as the software cannot be run using a PClone. However, the cost of data acquisition hardware is currentlyelatively low in relation to other items of lab equipment, and isomparable to that of MIDI hardware and software investment. Fur-her, the flexibility of MatTAP allows a wide range of sensors to besed, from simple switches to high accuracy force-transducers. Theature of MATLAB means that in addition to the supplied function-lity, users can change anything from a single value to the wholenalysis module to suit their requirements. It is hoped that this willllow scalability of the toolbox, with the opportunity to interface tother appropriate MATLAB toolboxes (e.g. The Psychophysics Tool-ox, Brainard, 1997) or to develop further integrated modules inhe future.

cknowledgments

This work was supported by grants from the Biotechnologynd Biological Sciences Research Council [C520620, EO09565]. The

V

W

ce Methods 177 (2009) 250–257 257

uthors thank Dagmar Fraser for his technical input and testingf the toolbox and Leif Johannson for his suggestion for the asyn-hrony calculation algorithm.

eferences

schersleben G. Temporal control of movements in sensorimotor synchronization.Brain Cogn 2002;48:66–79.

atalha A, Macara A. Rhythm capacity: comparison between professional dancersand dance students. In: International Symposium on Performance Science; 2007.p. 29–34.

ertelson P, Aschersleben G. Temporal ventriloquism: crossmodal interaction on thetime dimension: 1. Evidence from auditory-visual temporal order judgment. IntJ Psychophysiol 2003;50:147–55.

illon M, Semjen A, Cole J, Gauthier G. The role of sensory information in the pro-duction of periodic finger-tapping sequences. Exp Brain Res 1996;110:117–30.

rainard DH. The Psychophysics Toolbox. Spat Vis 1997;10:433–6.hen JT, Lin YY, Shan DE, Wu ZA, Hallett M, Liao KK. Effect of transcranial magnetic

stimulation on bimanual movements. J Neurophysiol 2005;93:53–63.ollyer CE, Church RM. Interresponse intervals in continuation tapping. In: Rosen-

baum DA, Collyer CE, editors. Timing of behavior: neural, psychological, andcomputational. MIT Press; 1998.

oumas M, Wing AM. Timing and trajectory in rhythm production. J Exp PsycholHuman 2007;33:442–55.

rewing K, Aschersleben G. Reduced timing variability during bimanual coupling:a role for sensory information. Q J Exp Psychol-A 2003;56:329–50.

lliott MT, Welchman AE, Wing AM. Being discrete helps keep to the beat. Exp BrainRes 2008, doi:10.1007/s00221-008-1646-8, in Press.

inney SA. FTAP: A Linux-based program for tapping and music experiments. BehavRes Methods Res Ins C 2001;33:65–72.

inney SA, Warren WH. Delayed auditory feedback and rhythmic tapping: evidencefor a critical interval shift. Percept Psychophys 2002;64:896–908.

entry S, Feron E. Musicality experiments in lead and follow dance. In: Systems,Man and Cybernetics, 2004 IEEE International Conference; 2004. p. 984–8.

eckroth J. Tutorial on MIDI and music synthesis; 2001. http://www.midi.org/about-midi/tutorial/tutor.shtml. Visited 5 Nov 2008.

elmuth LL, Ivry RB. When two hands are better than one: reduced timing variabilityduring bimanual movements. J Exp Psychol Human 1996;22:278–93.

nui N, Ishida T, Katsura Y. Effects of sensory feedback on variations on intertapinterval and force in finger-tapping sequences. Percept Motor Skill 2001;92:795–802.

ato M, Konishi Y. Auditory dominance in the error correction process: a synchro-nized tapping study. Brain Res 2006;1084:115–22.

eller PE, Knoblich G, Repp BH. Pianists duet better when they play with themselves:on the possible role of action simulation in synchronization. Conscious Cogn2007;16:102–11.

eller PE, Repp BH. Staying offbeat: sensorimotor syncopation with structured andunstructured auditory sequences. Psychol Res 2005;69:292–309.

ates J, Aschersleben G. Sensorimotor synchronization: the impact of temporallydisplaced auditory feedback. Acta Psychol 2000;104:29–44.

epp BH. Compensation for subliminal timing perturbations in perceptual-motorsynchronization. Psychol Res 2000;63:106.

epp BH. Phase correction, phase resetting, and phase shifts after subliminaltiming perturbations in sensorimotor synchronization. J Exp Psychol Human2001;27:600–21.

epp BH. Phase correction in sensorimotor synchronization: nonlinearities in vol-untary and involuntary responses to perturbations. Hum Mov Sci 2002;21:1–37.

epp BH. Sensorimotor synchronization: a review of the tapping literature. PsychonB Rev 2005;12:969–92.

epp BH, Knoblich G. Toward a psychophysics of agency: detecting gain and loss ofcontrol over auditory action effects. J Exp Psychol Human 2007;33:469–82.

epp BH, Penel A. Rhythmic movement is attracted more strongly to auditory thanto visual rhythms. Psychol Res 2004;68:252–70.

chulze HH, Cordes A, Vorberg D. Keeping synchrony while tempo changes:accelerando and ritardando. Music Percept 2005;22:461–77.

tevens LT. On the time sense. Mind 1886;11:393–404.haut MH, Miller RA, Schauer LM. Multiple synchronization strategies in rhythmic

sensorimotor tasks: phase vs period correction. Biol Cybern 1998;79:241–50.os PG, Mates J, van Kruysbergen NW. The perceptual centre of a stimulus as the

cue for synchronization to a metronome: evidence from asynchronies. Q J ExpPsychol-A 1995;48:1024–40.

ing AM, Kristofferson AB. The timing of interresponse intervals. Percept Psy-chophys 1973;13:455–60.