Basic File Syntax

The input file must be stored as an ASCII text file. Data within <>s will be replaced by specific values in the input file.
The area outside the i-block header and the {}s is called the global or g-block.  This area may contain comments or global commands (rd, te, rs, etc.). The "i" below starts the instrument or i-block.  The {}s mark the boundaries of the instrument-block's body. The i-block header follows:

i<number> = <number_of_pfields>  <start time> <(+num = duration in beats-num) OR (-num = number of events)>
{
p2[(output_type)] [commands or data] REQUIRED: always start time intervals
p3[(output_type)] [commands or data] REQUIRED: always duration of each event
[p4[(output_type)] [commands or data] all p-fields above p3 are optional]
.
.
.
[pN[(output_type)] [commands or data] all p-fields above p3 are optional]
}

This area is again the global-block. The file may contain another i-block (in fact, there is no limit to this pattern).

N.B. P-fields may be listed in any order (but p2 must be first).

Below is an example input file:

  
/* 

An example nGen file.  This must be saved as ASCII text. You can
create this file using a simple text-editor (NotePad, Vi, Emacs,
SimpleText, etc.).

/*

te(120) ;tempo: quarter = 120 b.p.m
i1 = 4 0 20 ;the i-block header
{ 

  rs(3021)         ;set a random seed value of 3021
  rd(.05)          ; more humanistic rhythms 
  p2 rh <4/4/6/6/6 ;loop these 5 rhythms
  rd(0)            ;turn off random deviation

  p3 1.1           ;legato: use of a p3 code < 199.99>

  p4(hz)           /* output Hertz values 
                    but use note-name input   */ 

  ;weighted distribution of select pitches
  no ra(20 .1 c3, .1 df, .3 e,  .1 f,  .1 g,  .1 af, .2 b) 
  
}