A04 recJs Script Record Format

Content outdated

We are in the process of migrating all content to impulse version 2.0.

RecJs files are wave files build on scripts. You might prepare signal references, define test vectors for your design or script a custom reader. Everything is based on the same simple api that is used in signal scripts and serializers.

Screen Cast: A04 recJs Script
Record Format

How to create a recJs script ?

Just create a file/resource with the file ending "recJs" (e.g. my_wave.recJs) and put the following text into the header of the file ("//-recjs" is important to get the file identified) :

//-recjs (keep this line)
// generator: of type ISingleDomainRecordGenerator
// file: this file of type File
// progress: progress handler of type TimeoutProgress
// p0..p9: parameters of type String (to be modified in serializer configuration)  

Instead of writing from scratch you may use existing examples to work with. Just get to Import->impulse->Import example wave files and select a folder to import.

Using the build-in java script editor

You may use the built-in recJs editor or any other eclipse java script editor. Right click on the resource and select "Open With -> impulse recJs Editor". As soon as you save the file, its signals will be updated and changes get visible in a parallel impulse viewer. If there are errors in the script, log messages will be send to the console view.

The impulse JDK

No matter if you develop a reader, a recJs script, a search expression or a Signal Script production, impulse provides you always with the same interfaces to read, compare, analyze or generate signal data.

[widgetkit id=60]

Open JavaDoc Reference Show recJs Script examples

More about scripting impulse

How to create a record ?

Looking at the of the recJs-file you can get a first impression about the interface to impulse:

Record generator object of type ISingleDomainRecordGenerator. Its interface allow you to create scopes and signals.
File object of the executed recJs file.
Progress indication object of type TimeoutProgress. This object allows you to indicate the current progress and to control the timeout.
Parameters of type String that can be modified in serializer configuration.
Console output of type MessageConsoleStream.
To create a record , the following steps are required:
  • Initialize the record
  • Add the record content (scopes, signals and proxies)
    • Open the writer
    • Write samples
    • Close the writer

Below you find a short example for a recJs file.

// Init the record
generator.initRecord("Example Record",TimeBase.ns);
// Create a record with scopes and some signals
var signals = generator.addScope(null, "Signals");
var int = generator.addSignal(signals, "Sin", "An integer", ProcessType.Discrete, SignalType.Integer, SignalDescriptor.DEFAULT);

// We start at 0 ns
var t = 0; // 0 ns

// int signal
var writer = generator.getWriter(int);
writer.writeInt(t, false, 0);
writer.writeInt(t, false, 0);
for (; t < 94000; t ++) {

    // write integer
    writer.writeInt(t, false,  (100 * Math.sin(t/1000.0)));
writer.writeInt(t, false, 0);
writer.writeInt(100000, false, 0);

// And close finally


technical software and tooling


Contact Us

This email address is being protected from spambots. You need JavaScript enabled to view it.