G-Area and I-Blocks

Like Csound score files, nGen files contain two main data areas -- the global area (g-area) and the instrument block (i-block).   Anything not in an i-block is in the g-area. The g-area is used for global declarations (any global level statements or functions such as tempo statements or macro definitions, etc.) and the i-block for anything relevant to the particular note-list being generated.  An obligatory feature of the i-block is the use of "p-fields" (parameter fields).  P-fields are analogous to those used in a Csound score file; however, while Csound parses an event at a time, nGen (like Score11) parses by the p-field -- the entire "score" for p2 is read then the entire "score" for p3, etc..  This allows for shortcuts to be used while specifying what will happen to the data throughout the duration of the current i-block. For example, you could specify that the p-field is to "move" over the duration of the entire i-block from a specific starting value to a specific ending value using exponential interpolation.  In this manner, you only have to specify the staring and ending value perhaps having several thousand values calculated by the program!

P-fields and MIDI files
If you are going to be creating MIDI files, only 4 p-fields apply:

All p-fields above p5 will be ignored when creating MIDI files.

I-Block Header
Each i-block must contain a header in the following format:


      i<number> = <# of p-fields> <start time> <X>
      {
      ...p-field data...
      }
  

where:

I-Block Body
Each i-block must also contain a body, after the header; the body is enclosed in {}s.  There are only two obligatory p-fields in the i-block's body: P2 (start times) and P3 (durations).  The current limit on the number of p-fields that can be contained within a single i-block is 256 (but this may be significantly more than Csound can realistically accept). The only limitation on the size of an expanded i-block or the number of i-blocks in a file is machine specific memory.