Editing    Analysis    Display    Archive Scripts    Useful Script Functions    Control

On-Line    Experiments    Examples of Method    Spectrum    User RequestedNew

On-line
Control output sequences with variables
Rectify and smooth a sampled EMG signal
Sample fast for a long time
Pulse from threshold crossing
Track recording levels always remain within recommended limits
Generate clicks tone bursts and noise for online playback
Simple auditory stimulation and recording script
Control output sequences with variables
spike\scripts\varex.s2s

This script demonstrates interaction between a script and the Spike2 output sequencer by means of variable values. It uses the VarEx.pls sequence file and is described in detail in the Scripts tutorial 1 page and requires version 3 or later.


Rectify and smooth a sampled EMG signal
spike\scripts\emgflter.s2s spike2:scripts:emgflter.scr

This rectifies and smoothes an EMG signal in real time, while sampling.


Sample fast for a long time
longsamp.zip 4,489 longsamp.sit 6,443

This script allows you to record data at high sampling rates for long periods of time by opening and saving a series of data-files. Each data-file records for a preset time and is automatically saved before the next file is opened.


Pulse from threshold crossing
threspul.zip 3,327

This on-line script is written for use with Spike2 for Windows version 3 and later.

It detects the time of threshold crossings on a waveform channel and marks these times in the file or outputs a TTL pulse upon detection. The threshold is set with a horizontal cursor which can be moved at any time during the recording.

Before running the script, you need to ensure a suitable sampling configuration is set. This must contain at least one waveform channel. If you select to output a TTL pulse upon threshold detection, you may choose to set up an event or level channel for testing purposes.

To run the script, go to the script menu and select Run script. If the script is already loaded, it will appear in the menu; otherwise select Load and run which will generate a file selection dialog from which you should find and load the threspul.s2s script.

When the script is run, a dialog will appear, from which you set the various required settings:

Input channelWaveform channel on which to base threshold crossing timing
ThresholdDirection of threshold crossing. Positive (rising) or negative (falling)
ActionTTL pulse and/or memory channel marker

When OK is pressed in this dialog the script will open a new data file, ready to sample, with a horizontal cursor positioned on the selected waveform channel. This should be positioned at a reasonable starting level for the threshold, and the OK button pressed to continue.

When ready to sample, a toolbar is displayed from which the data sampling is controlled.

QuitQuit the script and close down the toolbar
Sample startCommence data sampling
Sample stopStop sampling. This button is disabled until sampling begins
New fileClose current file and open a new file ready to sample

TTL output
The default TTL output gives a pulse of duration 1ms from digital output 0 (bit 8) of the 1401 interface. The overall speed of the sequence and the pulse duration and selection of output bit can be edited in the pulse.pls file if required.

If TTL output is selected, the script writes a Spike2 output sequence file which is stored with a default name (pulse.pls) in the sequence sub-directory of the main Spike2 directory where the application is stored (e.g. C:\Spike4\Sequence\pulse.pls).

Memory channel marker
If Memory channel marker is selected, a new temporary channel is created and displayed in the data file. Each time the threshold is crossed, markers are imported into this channel at a position as close as possible to the actual threshold crossing.

This channel is temporary and must be written to a permanent channel if it is to be saved with the recorded data file. To do this go to the Analysis menu and select Memory buffer then Write to channel. From the dialog you can select an empty channel into which this data will be written.


Track that recording levels always remain within recommended limits
lvlmeter.ZIP 6,000

In some types of experiment it may be necessary to adjust the gain and offset of external preamplifiers repeatedly during the course of a recording. It is important to keep track of these changes and to ensure that the recording levels always remain within recommended limits. The level meter script can help you fulfil these requirements. It generates a duplicate view of your incoming data with each channel displayed relative to the full input range of the 1401. It gives you audible and visual warnings if any of the traces approach the limits of the working range. The script also allows you to keep a record of gain, offset and other changes by annotating the data file with TextMarks.

This script requires Spike2 version 5 or higher.


Generate clicks tone bursts and noise for online playback.
wavemake.ZIP 8,277

This script enables you to create tone bursts, noise burst or clicks and store them in a sampling configuration. These waveforms are then available to be played via a 1401 DAC output as an auditory stimulus during subsequent recording sessions.

Click stimuli can be positive or negative going. The rising and falling phases of tone bursts can be of fixed duration or an exact number of cycles of the underlying waveform (tone pips). The script can also create sequences of identical tone bursts separated by fixed intervals. Thus you could create, for example, a synthesised cricket chirp with 4 equally spaced syllables.

You can store up to 10 auditory stimuli in a sample configuration. You can play them in ‘single-shot’ mode by pressing a button on the PlayWave toolbar during a recording session. Use the WavePlay script to play selected waveforms repetitively. Full user instructions are included in the comments section of the script file.

Software requirements: Spike2 version 5.14 or higher.

Hardware: not compatible with Standard 1401.


Simple auditory stimulation and recording script
waveplay.ZIP 12,799

This script enables you to play arbitrary waveforms (play-waves) repetitively via one or more DAC outputs while recording. A typical application might be to play repeating tone bursts, or clicks created with the WaveMake script while recording auditory responses. However, there are many other possibilities.

This script allows you to select a set of waveforms to play during the next recording session and set timing parameters such as repetition rate and number of repeats. Stimuli and responses can be then be displayed as triggered sweeps or in ‘chart recorder ‘ mode. The script also has the option to play two different stimuli alternately. A typical application would be alternate presentation of condensation and rarefaction clicks. A full user guide is included in the comments section of the script.

Software requirements: Spike2 version 5.14 or higher. The script works in conjunction with a text sequencer: PlayWaveform02.pls. This file must be stored in the folder named 'sequence' inside the main Spike2 directory.

Hardware requirements: Not compatible with standard 1401 interface



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 line, below. Then you can down-load them by clicking on the filename; please check the size received.