Spike2 Scripts


Play tone for ECG R-wave detection Improved! (01/17)

Play tone for ECG R-wave detection


This script plays a tone 'pip' from DAC 0 of the 1401 when the R-wave of an ECG complex is detected during sampling.

Sampling is controlled via the script toolbar and the user is asked to set the ECG channel to monitor and a hysteresis value for the R-wave peak detection. A horizontal cursor is then used to set a threshold for the detection of the R-wave. Each time the threshold is crossed the script monitors the level of the incoming data and, when a peak is found, waits for the data to fall by at least the level set by the hysteresis value before playing the tone to flag the R-wave detection.

This script requires Spike2 v6.00 or higher.

Force feedback display (09/08)

Force feedback display


This script is an example of displaying an on-line channel value in a separate window for use in a force feedback experiment. The script contains an idle routine that updates the bar display in response to incoming waveform data in channel 1.

This script requires Spike2 v4.24 or higher.

Analyse cricket song with burst analysis
Improved! (01/17)

Analyse cricket song with burst analysis


Analysis of cricket song into pulses and chirps, using the burst analysis feature of Spike2. A simple table of results is produced. Have your cricket song data-file open and visible before running this script.

Cardiac Action Potential Analysis System (03/09)

Cardiac Action Potential Analysis System


This extracts certain parameters from Cardiac Action Potential (CAP) data.

The user is first required select a suitable file for analysis, and to specify the CAP channel. They should then place a horizontal cursor on the data such that it crosses all the upstrokes of the data file.

This enables the script to place marks in a temporary event channel every time a CAP is located. The script then attempts to extract certain characteristics from the CAP; these values are written to the screen. The extracted characteristics include:

  • CAP start time
  • CAP end time
  • Baseline value
  • Peak value
  • Peak time
  • Upstroke gradient
  • Repolarisation gradient
  • 30, 50, 60, 90 % re-polarisation times.

The user may click the mouse on the text window and this will place a cursor on the data at the value indicated by the clicked position (easier done than said). All desired results are dumped to a text file.

Respiratory Sinus Arrythmia Improved! (01/17)

Respiratory Sinus Arrythmia


This script is designed to show respiratory sinus arrhythmia in EMG data.

A data-file is loaded which contains one channel of EMG activity and another of pressure waves. A threshold level is set on the pressure channel to mark the start and end points of each pressure wave. For each pressure wave interval the instantaneous heart rate is sampled at a given frequency and the instantaneous frequencies are logged to a text file.

Eye movement monitor (02/03)

Eye movement monitor


This script allows the user to plot eye movements in two dimensions and show positions of fixations and saccadic motions graphically.

Each experiment consists of a number of trials in which a subject is presented with a visual stimulus and the motion of the eye is tracked by suitable apparatus. This apparatus should output two voltages proportional to angular deflections in the X- and Y-directions respectively and these signals are the inputs to the CED 1401 connected to the PC running the script. When a trial is initiated the script displays an XY-plot of the motion of the subject's eye in real-time. Points of fixation are marked as the trace develops and saccadic motions are drawn at the end of the trial. A record of data concerning these features is kept in a log file.

A very simple sequencer file, eyemove.pls, is included which sends a digital output signal to the visual stimulus apparatus to trigger a trial of the required type.

A facility for scanning results and dumping data off-line is provided.

This script requires Spike2 v3.00 or higher along with a Power1401, a Micro1401 or a 1401plus; it cannot run with a standard 1401.

X-Y plot of eye movements (02/09)

X-Y plot of eye movements


This offline script displays eye movements relative to a target that is being tracked by replaying the data file and plotting the angular coordinates of each eye in an X-Y view.

The raw data is a time view of horizontal and vertical components of eye and (optionally) target movements, as recorded by a pupil-tracking camera system. This script then allows you to replay the data with a simultaneous display of the X-Y track followed by the eyes and the target. You can select the speed of the replay in the range 0.1x to 10x actual speed and select the duration of the tracks to display. Typically, you would choose to display the most recently replayed data, for example the last 0.5 seconds.

The .zip file contains an example data file that you can use to try out the script.

A full user guide is included in the comments section of the script file.

The script requires Spike2 version 6.09 or higher.

Skinner box (01/04)

Skinner box


This script allows you to record of one or more channels of physiological data while a rat learns to press levers in a Skinner box. The times of each lever press are recorded as events (on ports 0 and 1) and the 1401 delivers TTL output pulses to trigger the release of a food pellet when the rat gives the required response. The timing of rewards is recorded on event port 2. You can set the duration of a refractory period after a reward during which no further rewards are given even if the correct lever is pressed.

Three experimental paradigms are available:

  1. Pressing either of two levers is rewarded (training).
  2. Pressing the left lever is rewarded.
  3. Reversal learning. Pressing the left lever is rewarded a set number of times and subsequently, only pressing the right lever is rewarded.

The .zip file contains an example data file that you can use to try out the script.

A full user guide is included in the comments section of the script file.

The script requires Spike2 version 3.00 or higher.

Auditory Stimulation and Single Unit Recordings

Auditory Stimulation and Single Unit Recordings


This package of scripts allows you to generate acoustic and/or vibratory stimuli on one or two channels, record neural single-unit responses and perform online analysis of window discriminated spikes. These scripts were developed for research on the auditory system and lateral line organs of fish but should be suitable for a wide range of auditory studies on both vertebrates and insects.

This package enables you to generate acoustic or vibratory stimuli of known intensity and record intra- or extra-cellular single unit responses to these stimuli. Available stimuli include tone pips and symmetrical or asymmetrical tonebursts with frequencies ranging from 1Hz to 10kHz. It is also possible to stimulate with stored arbitrary waveforms (for example, pre-recorded sounds) or to trigger an external stimulator. The script can also generate pre-defined sequences of stimuli at a range of frequencies and intensities for rapid automated collection of the responses needed to generate threshold response curves.

The recording system includes a virtual window discriminator for spike detection. Online analysis of incoming data includes post-stimulus time, interval and phase histograms. Circular statistics are used to quantify the degree of phase -locking of spikes to the stimulus waveform. See the user guides for further details.

System Requirements:

Hardware: Power 1401, CED3505 Programmable attenuator
Software: Spike2 v7.11 or higher
Scripts: AudioStimRecSU.s2s, SoundCalSU.s2s
Sampling configuration: SU.s2c
Sequencer: SU4.pls
Other files: MScaldataSU.txt, SpkcaldataSU.txt, SUSettings.txt
User guides: AudioStimRec SU.pdf, SoundCalSU.pdf, 3505_V2spec.pdf

Simple Auditory Brainstem Responses (08/15)

Simple Auditory Brainstem Responses


This Spike2 script package is suitable for recording auditory brainstem responses (ABR) to tone pip stimuli. It was developed for research on responses of fish to underwater sounds but may be equally useful for investigating the responses of other vertebrates to airborne sound.

The script generates symmetrical tone pips with a linear rise and fall phase and filled with carrier frequencies ranging from 20Hz to 10kHz via DAC0. The user can set up the shape of the tone pip, select its polarity (or choose alternating polarity), stimulus repetition rate and number of sweeps to include in the average. Stimulus intensity can be set in steps of 5dB over a range of 75dB using the CED program controlled attenuator. A calibration curve to correct for variations in intensity with stimulus frequency is applied automatically.

Pre-amplified neural responses recorded via ADC0 are processed by signal averaging. The averaged responses at each stimulus frequency are displayed in descending order of stimulus intensity for easy estimation of thresholds. The script builds up and displays threshold -response curve as the experiment proceeds.

System Requirements:

Hardware: Power 1401 or Micro1401 Mk2, CED3505 attenuator
Software: Spike2 v7.00 or higher
Scripts: FishABR v1.15.s2s, SoundCal v1.15.s2s
Sampling configuration: Fishabr v1.15.s2c
Sequencer: Fishabr v1.15.pls
Other files: MScaldataSU.txt, SpkcaldataSU.txt, SUSettings.txt
User guides: FishABR v1.15.pdf, SoundCal.pdf, 3505_V2spec.pdf

Some of these scripts have come from users rather than the CED team. If you have a script that you would like to offer to fellow users via this page, please tell Simon Gray. We provide some scripts for Signal too.

These scripts are stored as WinZip files, myscript.zip, except where they are shown as spike\scripts\myscript.s2s. Those latter files were installed with Spike2 and spike stands for the directory in which you installed Spike2. See the summaries by clicking on the description in the side menu. Then you can down-load them by clicking on the filename.


Mains ‘hum’ is often complex and composed of odd harmonics of the mains frequency, making it very difficult to remove or suppress using simple high pass or notch filters. HumRemoveExpress.s2s is a Spike2 version 7 script that you can use offline to strip out much of this residual mains interference, making your data much more presentable and easier to analyse. This video tutorial shows how to use the script to remove mains hum.

  • Alpha MED Sciences
  • Alpha Omega Engineering
  • Axon Instruments
  • Binary data
  • Bionic/Cyberkinetics
  • Biopac
  • CED SON (Macintosh)
  • CONSAM (D. Colquhuon)
  • DATAQ Instruments (Codas)
  • DataWave
  • Data Sciences International
  • Delsys Files
  • European Data Format(+)
  • Grass-Telefactor (PolyView)
  • HLR Data Format
  • Heka Data Format
  • Multi Channel System (Mc_Rack)
  • MindSet (16/24) data Files
  • MindWare data files
  • Motion Labs Systems Files .c3d
  • NeuroScan
  • Neuralynx
  • Plexon
  • RC Electronics
  • Text files
  • TMS International
  • Tucker-Davis Technologies
  • WAV (Microsoft)
  • WaveMetrics Igor Pro (PC/Mac)
  • Xltek Neuroworks

Cambridge Electronic Design Limited

Registered in England: 972132

Registered office:

  • Cambridge Electronic Design Limited,
  • Technical Centre,
  • 139 Cambridge Road,
  • Milton,
  • Cambridge CB24 6AZ

VAT: GB 214 2617 96

Producer Registration number: WEE/BD0050TZ

Terms and Conditions of Sale

For our US customers, we can provide tax form W-8BEN, that identifies us as a UK company.

DUNS: 219151016
NAICS: 423490
Commodity codes
Hardware: 84716070
Software: 85234945

By email:


By post:
  • Cambridge Electronic Design Limited,
  • Technical Centre,
  • 139 Cambridge Road,
  • Milton,
  • Cambridge CB24 6AZ
By telephone:

(Int.+44) (0)1223 420186

From North America (Toll Free):

1 800 345 7794


Privacy policy

CED, through this site, does two things that relate to privacy. We would like to explain them.

Emails from down-loads

We offer free down-loads of many files on our site, from test programs to complete install files for updated versions of major packages like Spike2 and Signal.

When customers wish to take a down-load of a major package, we ask a few questions, including their name, email address, the serial number of the software for which they seek an upgrade and whether they would like an automatic email whenever we update the product. This information is emailed back to CED when they access the final down-load screen. Within this email, your browser transmits the type and version of browser you are using, and the screen resolution you are running.

The reasons why we take and keep this information are that it is useful for our software development team to know who has taken the latest versions, and it is useful for our web site development team to know which browsers people are using to view our site, and what resolution they have their screens set to.


When people down-load a major package, we try to write a cookie, a small file in your computer, that records your name, serial number of the software package, and the version you are down-loading. These files have a lifetime of one year.

The reasons for storing this information are firstly that if you ask for another down-load some other time, your details are read from the cookie and are pre-written into the form, to save you looking them up again. The other reason is that next time you access our site, your browser looks through your CED cookies and compares the versions down-loaded with the latest version numbers read from our site. If there is a later version of a product you have already down-loaded, we tell you on the home page screen, so you know that it is worth going to the down-load page again.

None of this information is ever given to anyone outside CED. ×