Spike2 Scripts


Batch import "foreign" file formats (11/16)

Batch import "foreign" file formats


You can import many foreign data formats into Spike2. Individual files can be imported interactively via Import on the Spike2 File menu. However, this becomes tedious if you have many files of the same type to import. This script allows you to import all files of a user-defined type in a specified folder. Certain restrictions apply. For example, some formats can only be imported using the 32-bit version of Spike2. See the on-line help under "import foreign data file" for further information.

The script requires Spike2 v8.04 or later.


  • DSI importer now works
  • Ponemah and Xltek -Neuroworks importers have been added. (users of Spike2 8.08 and higher).

Hum Remove Express Improved! (01/18)

Hum Remove Express


This script is a streamlined hum removal script for use when you have recorded a reliable hum marker event channel using the CED Mains pulser or similar device. See a video demonstration.

If you need to derive a hum marker from a waveform channel that contains hum then you should use the original HumRemove script

The script requires Spike2 v7.20 or later.

Hum Remove Improved! (02/18)

Hum Remove


This script is designed to improve the signal-to-noise ratio of physiological recordings by removing mains-related interference. This is done, not by filtering, but by subtracting an estimate of the mains interference from the raw data and storing the results in a new channel.

This upgraded version of the script requires Spike2 v7.20 or later.

Waveforms should be recorded with a sampling rate of at least 500Hz and preferably 5kHz or higher. The best results will be obtained if you record a dedicated waveform channel that clearly shows the ongoing mains frequency oscillation in addition to your data channels. This could be simply the mains pick-up from an unshielded cable. The script can use this signal to generate an event channel of timing marks at the onset of each mains cycle. These time marks are then used to calculate the mains interference signal to subtract from each waveform to clean it up.

See the data sheet Hum Remove.pdf, included in the HumRemove.zip file, for full details.

Convert .smr files to 400 channel big file format (07/12)

Convert .smr files to 400 channel big file format


Normal Spike2 time views can have up to 400 channels and a size up to 2 GB. However, the default number of channels created by a sampling configuration is 32. This may not be enough if your data analysis involves creating many additional channels.

This script allows you to batch convert all the .smr files in a selected folder to 400 channel big file format so that you do not run out of free channels during analysis and can grow your file beyond the 2GB size limit. This script has been carefully tested. However, there are no guarantees. Back up your data before running it!

Annotate a data file Improved! (01/17)

Annotate a data file


This script allows you to add TextMarks to a time view, off-line. You can use it to add or delete TextMarks in an existing disk-based channel or create a new TextMark channel. The script creates a hotkey labelled Add Tmk on the Script Bar. Click on this button or its keyboard shortcut Alt+T to run the script. The main script dialog has a Help button. Click on it to display the script’s user guide.

The script requires Spike2 v6.18 or later.

Mark significant data with coloured bars (09/16)

Mark significant data with coloured bars


This script allows you to create a ‘state’ channel in a time view and use it to mark significant time ranges in your data with coloured, labelled bars. These bars can be added automatically to mark episodes when a waveform channel exceeds (or falls below) a user-define threshold. Alternatively, you can mark time ranges manually by clicking and dragging with the mouse.

Up to 6 different colours and labels can be used per State channel to mark different types of event. The script can generate a simple report of the onset times and durations of states and the order in which they occurred.

Tested with Spike2 v 7.18 and 8.10

Time shifting event data (04/10)

Time shifting event data


This script can be used to copy event or marker times from a currently selected data file to a new permanent channel in any open data file. The script creates two cursors to select the data range to copy and you can apply an optional time shift by setting the start time for the data in the new channel. A suitable example data file, Demo.smr is included in the Data folder of your Spike2 directory.

The script requires Spike2 v5.21 or later.

Insert event trains off-line (04/10)

Insert event trains off-line


This script allows the user to set a time range and frequency of stimulation for adding events into a new channel in a data file at the specified interval and time range. The script also allows the addition of multiple event trains into the same channel.

This script could also be used to create pulse trains at a set frequency for output. Once the events have been created as an event channel in the data file, you could load them into the output sequencer using the PlaySpikeTimes script.

The script requires Spike2 v5.21 or later.

Number events from 1 to n (04/10)

Number events from 1 to n


This script can be used to give an identifying number to stimulus events, spike shapes or markers. The script creates a new TextMark memory channel that holds text strings starting at 1 for the time of the first event in range. A suitable example data file, Demo.smr, is included in the Data folder of your Spike2 directory.

The script requires Spike2 v5.21 or later.

Align comments in a script (08/15)

Align comments in a script


This script is a utility for script writers. It improves the layout of a script by aligning the comments on lines containing code to a common, user-defined offset.

This script requires Spike2 version 6.04 or higher.

Tidy up the layout of a script (04/08)

Tidy up the layout of a script


This script is a utility for script writers. It can improve the readability of scripts especially longer ones with many functions and procedures.

Available options include: removing constants and variables that were declared but not used and sorting functions and procedures into an alphabetical list after the main program. The most convenient way to run this script is via a button on the Script Bar.

This script requires Spike2 version 6.04 or higher. It also makes use of functions in the script file GHutils.s2s (included in the download). This file must be located in a folder called include located inside the directory holding your copy of Spike2.

Merge Files Improved! (01/17)

Merge Files


This utility script allows you to:

  • Merge all the time views in a selected folder into a single data file
  • Copy and paste data between open time views
  • Delete data from selected time ranges in a time view

Full user instructions are included in the comments at the start of the script. This script works with the latest Spike2 version 5. A “de luxe” version (MergeFiles7.s2s) that works in Spike2 v6 and v7 is also included.

Concatenate Files (02/16)

Concatenate Files


This script is intended for merging batches of data files that were recorded in a time sequence with the same sampling configuration. Files are joined end-to-end and gaps are inserted when there is a delay between the end of one recording and the start of the next. This means that an accurate time axis is maintained. This is especially important when concatenating long-term recordings where time of day and duration of gaps is important.

The script applies the resource file of the first file in a batch in order to retain Virtual channels, channel processes, channel display order etc. in the destination file.

Further information is contained in the comments at the start of the script itself.

Tested with Spike2 v8.05. Compatible with Spik2 v7.07 or higher.

Delete Ranges Improved! (11/17)

Delete Ranges


This script requires Spike2 v7.07 or higher. It allows you to delete marked time ranges from a Spike2 time view. Mark the time ranges to cut out using the TimeRanges.s2s script in your Spike2 scripts folder. Then run this script to create a new edited data file.

The original data is untouched. You could use this script to generate ‘edited highlights’ of your data or to remove stimulus artefacts.

Remove artefacts from an event channel (07/09)

Remove artefacts from an event channel


This simple script cleans-up an event channel by copying to another event channel, leaving out all events occurring too soon after the last event.

Remove ECG artefacts from EMG channels

Remove ECG artefacts from EMG channels


This script reduces the size of ECG artefacts in EMG recordings by reference noise subtraction. You will need to record a dedicated ECG channel alongside your data as a source for Events marking the position of the artefacts unless the artefacts on the emg channels themselves are sufficiently large for reliable triggering.

The zip file includes 2 scripts, ECGdelete01.s2s suitable for use with Spike2 v7.07 or higher and ECGdelete v5.s2s for use with Spike2 v5.21 and v6.

Remove stimulus artefacts 03/16

Remove stimulus artefacts


Removes stimulus artefacts from data channels, replacing the artefact with a straight line to preserve continuity. Artefacts can be identified by timing from a trigger channel, or by cursor positions.

The download now includes an updated version for users of Spike2 v6 and higher. The basic version is still available for users of earlier versions of Spike2.

Fix Glitches (10/11)

Fix Glitches


This version 7 script replaces glitches or artefacts on a Waveform or RealWave channel using linear prediction. Put simply, the script replaces segments of “bad” data with a wavefom of similar spectral content to the “good” data on either side of the glitch.

Convert a result file to a data file (06/02)

Convert a result file to a data file


Converts result file data back into a data file to allow data file specific use. This requires Spike2 version 4 or later.

Process event channels in a time view Improved! (01/17)

Process event channels in a time view


This is a general purpose script that is useful for creating and editing Event, Level, Marker, TextMark, RealMark and WaveMark channels in a time view.

Using this script you can:

  • Create a new marker channel holding the times of peaks, troughs and level crossings in a waveform or RealWave channel
  • Set up a virtual window discriminator to detect peaks or troughs in a waveform channel that lie within a user-defined amplitude range
  • Create a new marker channel and add markers manually, using a cursor to set the time and dialogs to enter additional information, e.g. Marker codes, Text- or Real-Mark values
  • Create a new channel by combining groups of items copied from several other channels
  • Edit pre-existing marker channels, either by adding new markers, deleting them or by changing the Marker codes, Text- or Real-Mark values associated with existing markers
  • Easily eliminate spurious markers caused by switch bounce

This script requires Spike 2 version 5 or higher.

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. ×