SpikeGLX contains easy to use tools for stimulus waveform output.
Use the SpikeGLX 'Wave Planner' dialog under the 'Windows' menu, to create 'wave' files that you can then load, trigger and control using our remote scripting API.
Wave files can be executed using either OneBox, or NI devices with waveform capable analog output features.
A 'wave' is a pair of descriptor files:
[WaveMeta]
sample_frequency_Hz_dbl=10000
wave_Vpp_dbl=2
device_Vpp_dbl=5.0
data_type_txt_i16_f32=txt
num_samples_i32=0
IMPORTANT:
All wave descriptors should live in the _Waves
subfolder within the SpikeGLX application folder.
API functions that take a wave name should be given just the wave base-name itself, stripped of any path or file extension. For example, if your metafile full path was 'C:/SpikeGLX_stuff/SpikeGLX/_Waves/mysinwave.meta', then you should refer to this simply as 'mysinwave'.
The binary formats are provided to allow maximum flexibility to generate samples using your own external tools. Valid binary data follow these rules:
The scaled values are forced to range [-32768,32767].
Although you must generate the .bin file and its samples yourself, you can use the SpikeGLX Wave Planner dialog to edit the frequency and voltage scales in the .meta file.
Use the Wave Planner 'Data' text box to write your generator script.
Our wave mini-language uses four commands that can be strung together in any combination:
level( V, t_ms ) : Generate samples of amplitude V (float) in range [-1.0,1.0] for time span t_ms (float) milliseconds.
ramp( V1, V2, t_ms ) : Generate samples with linearly ramping amplitude from V1 to V2 (floats) each in range [-1.0,1.0] for time span t_ms (float) milliseconds.
sin( A, B, f_Hz, t_ms ) : Generate a sine wave with amplitude A (float), baseline B (float), where (A + B) is in range [-1.0,1.0]. The sine wave has frequency f_Hz (float) and total time span t_ms (float) milliseconds.
do N { } : Repeat whatever is included in curly braces N (integer) times. Nesting of do-loops is permitted.
White-space (returns, spaces, tabs) are completely ignored. Use space freely to make a script readable.
At load-time your script is compiled into scaled samples; scale factor: (32767 * wave_Vpp_dbl / device_Vpp_dbl).
Example
do 10 {
level( 0, 50 )
ramp( 0, 0.5, 10 )
level( 0.5, 100 )
ramp( 0.5, 0, 10 )
}
fin