Items, takes, envelopes and FX chains are nested blocks inside a
track. The source for this page is the
Cockos wiki’s “State Chunk Definitions” page (last edited 24 January 2018), read in full
as the Internet Archive’s copy of 14 November 2024
(wiki.cockos.com/wiki/index.php/State_Chunk_Definitions); Cockos’s own address now
redirects to the Cockos home page, and the wiki page is not linked from reaper.fm’s SDK
pages. The wiki says it records “what is known” and marks fields it could not explain
with ??; those are repeated here as not documented. Its comments, empty lines
and indentation are for illustration only, and it shortened long float values.
ITEM
An <ITEM block holds one media item. Its position and length are
POSITION and LENGTH, in seconds. The keywords up to
IGUID belong to the item as a whole; from NAME on, “values
mostly relate to the first take”, except field 1 of VOLPAN, which is the
item trim. The first take’s <SOURCE block closes that group; further
takes follow, each starting with a TAKE line (see below).
Boolean fields (shown here as 0 or 1) are written as the integers 0 and 1.
| Keyword | Fields | Meaning |
|---|---|---|
POSITION | num | Position on the timeline, in seconds |
SNAPOFFS | num | Snap offset, in seconds |
LENGTH | num | Item length, in seconds |
LOOP | int | Loop the source, 0 or 1 |
ALLTAKES | int | Play all takes, 0 or 1 |
COLOR | int | Item colour. Not present if not set. (The wiki does not give the encoding; the track PEAKCOL colour format is documented on the tracks page.) |
BEAT | int | Item timebase. Not present if not set; −1 uses the track timebase |
SEL | int | Whether the item is selected, 0 or 1 |
FADEIN | int, num, num, and further fields | Fade-in settings. Field 1: curve type (0 linear, “etc.”); field 2: fade time in seconds; field 3: auto-crossfade length; field 4: described only as “? (bool)”; field 5: auto-crossfade is on; field 6: fade shape. The wiki’s own example shows three fields. |
FADEOUT | as FADEIN | Fade-out settings, “same as fade in above” |
MUTE | int | Whether the item is muted, 0 or 1 |
FADEFLAG | int | Not documented (marked ??); may not be present |
IGUID | str | The item’s GUID. The Cockos wiki says to leave it alone. |
NAME | str | First take name |
VOLPAN | num × 4 | Field 1: item trim (1.00 is 0 dB, 16.00 is +24 dB, 0.50 is −6 dB); field 2: first take pan (−1.00 left, 1.00 right); field 3: first take volume (other takes use TAKEVOLPAN); field 4: first take pan law |
SOFFS | num | First take slip offset, in seconds. A MIDI item’s example has two fields, the second “always twice the first” |
PLAYRATE | num, int, num, int | Field 1: play rate; field 2: preserve pitch while changing rate, 0 or 1; field 3: pitch adjustment in semitones.cents; field 4: pitch-shift or time-stretch mode and preset (see below) |
CHANMODE | int | First take channel mode: 0 normal, 1 reverse stereo, 2 mono (downmix), 3 mono (left), 4 mono (right) |
GUID | str | The first take’s ID. The wiki says to leave it alone. |
PLAYRATE field 4: stretch mode and preset
| Value | Meaning |
|---|---|
| −1 | Project default |
| 0 to 2 | Sound Touch (3 presets) |
| 65536 to 65567 | Dirac LE (32 presets) |
| 131072 to 131119 | Low quality windowed (48 presets) |
| 196608 to 196639 | élastique Pro (32 presets) |
| 262144 to 262147 | élastique Efficient (4 presets) |
| 327680 to 327683 | élastique SOLOIST (4 presets) |
| 393216 to 393247 | élastique 2.1 Pro (32 presets) |
| 458752 to 458755 | élastique 2.1 Efficient (4 presets) |
| 524288 to 524291 | élastique 2.1 SOLOIST (4 presets) |
The wiki’s MIDI item example writes −65536 in this field; the wiki does not explain that value.
Takes
A take after the first begins with TAKE, followed by SEL only
if that take is the selected one. Its keywords then follow in this order in the wiki’s
example. The first take has no TAKE line; its fields are the item-level ones above.
| Keyword | Fields | Meaning |
|---|---|---|
TAKE | optional SEL | Starts a further take; SEL marks it selected |
NAME | str | Take name |
TAKEVOLPAN | num × 3 | Field 1: take pan; field 2: take volume; field 3: take pan law. (Note the pan comes before the volume here, the reverse of VOLPAN.) |
SOFFS | num | Take slip offset, in seconds |
PLAYRATE | as above | As the item’s PLAYRATE |
CHANMODE | int | As the item’s CHANMODE |
GUID | str | The take’s ID; leave alone |
<SOURCE … | block | The take’s source |
SOURCE
The block’s header gives the type, for example <SOURCE WAVE, and it
contains FILE with a path, such as FILE "Audio/vocals.wav"
(the wiki’s example shows a Windows path). Other source types, such as MIDI, have
other contents; the wiki’s own to-do list says item source properties and other item
types still need a page of their own.
SOURCE SECTION
When a section of the source is chosen in the item properties, the source is wrapped:
<SOURCE SECTION contains the keywords below and then the ordinary
<SOURCE WAVE block. Without a section, the inner block appears alone.
| Keyword | Fields | Meaning |
|---|---|---|
LENGTH | num | Section length |
MODE | int | 2 is section and reverse, 3 is reverse. Other values are not documented. |
STARTPOS | num | Section start offset, in seconds |
OVERLAP | num | Section crossfade, in seconds |
SOURCE MIDI
A MIDI item’s source holds its events as text lines. The wiki gives one example and refers to a separate page, “State Chunk And RPP MIDI Format”, which the Internet Archive did not have.
| Keyword | Fields | Meaning |
|---|---|---|
HASDATA | int, int, str | Whether the item has any data, then the resolution in ticks per quarter note (960 in the example), then QN |
e or E | int, hex, hex, hex | A standard MIDI message. e is selected, E not selected. Field 2: ticks since the previous event, or since the item start for the first (the wiki’s text; its table says “msg start offset”); field 3: status byte (message type plus channel, for example 0x80 note off channel 0, 0x9F note on channel 15, 0xB4 control change channel 4); fields 4 and 5: Data1 and Data2, such as note number and velocity. Example e 300 90 2b 60. |
<X or <x | int, int, then base64 lines | A system exclusive message of variable length; x selected, X not. The two numeric fields are not documented. The data is base64. |
GUID | str | Take ID |
IGNTEMPO | int, num, int, int | Ignore the project tempo: on/off, the tempo that overrides it, then the time signature numerator and denominator |
VELLANE | int, int, int | Lane type, height in MIDI editor mode, height in inline editor mode. Lane types: −1 velocity; 0 to 119 CC 0 to 119; 128 pitch bend; 129 program; 130 channel pressure; 131 bank/program select; 132 text events; 133 sysex |
BANKPROGRAMFILE | str | Path to the ReaBank file used by the item |
CFGEDITVIEW | 7 values | “Somehow related to” horizontal and vertical zoom and scrollbar positions; fields not documented |
CFGEDIT | 23 values | MIDI editor window configuration, see below. The wiki’s example breaks the line after 14 values and continues on the next line. |
EVTFILTER | 7 values | Event filter, see below |
CFGEDIT fields
| Field | Meaning |
|---|---|
| 1 | Not documented |
| 2 | Sync the editor transport to the project transport (0 or 1) |
| 3 | Not documented |
| 4 | Show velocity handles (0 or 1) |
| 5 | Show note names (0 or 1) |
| 6 | View mode: 0 piano roll rectangle; 1 named notes rectangle; 5 event list rectangle; 8 piano roll triangle; 9 named notes triangle; 13 event list triangle; 16 piano roll diamond; 17 named notes diamond; 21 event list diamond |
| 7 | Not documented |
| 8 | Move CCs with notes (0 or 1) |
| 9 | Not documented |
| 10 | Snap to grid (0 or 1) |
| 11 | Show grid (0 or 1) |
| 12 | Grid division unit, in beats.ticks |
| 13, 14 | X and Y of the editor window’s upper left corner |
| 15, 16 | X and Y of its bottom right corner |
| 17 | Dock the editor window (0 or 1) |
| 18 | Note row view: 0 all rows, 1 hide unused rows, 2 hide unused and unnamed rows |
| 19 | Timebase: 0 project beats, 1 project sync, 2 project time, 4 source beats |
| 20 | Colour mode: 0 velocity, 1 channel, 2 pitch, 4 source |
| 21 | Length of the last drawn note, in beats.ticks |
| 22 | Re-use editor window: 0 off, 1 re-use, 2 re-use keeping the current item secondary |
| 23 | Show velocity numbers (0 or 1) |
EVTFILTER fields
| Field | Meaning |
|---|---|
| 1 | 16-bit mask of the channel checkboxes: 0 means “All” is checked and 1 to 16 are not; the wiki writes 65536 for all ones (a 16-bit mask’s maximum is 65535, so that value is probably a slip); 32769 is channels 1 and 16 |
| 2 | Event type: −1 all; 144 note; 160 polyphonic aftertouch; 176 control change; 192 program change; 208 channel aftertouch; 224 pitch; 240 sysex or meta |
| 3 | Parameter field, 0 to 127 |
| 4 | Value low, 0 to 127 |
| 5 | Value high, 0 to 127 |
| 6 | Draw events on channel, 0 to 15 |
| 7 | Filter enabled (0 or 1) |
FXCHAIN
A track’s <FXCHAIN block holds its plug-ins. The Cockos wiki says plug-in
chains “appear to be the same” for tracks and item takes, except that the block of a take
is named <TAKEFX. A real file shows
SHOW, LASTSEL, DOCKED and BYPASS
keywords, then a nested block per plug-in, named after its type (for example
<AU or <VST), whose body is base64 state.
| Keyword | Fields | Meaning |
|---|---|---|
WNDRECT | int × 4 | FX window position: the wiki labels the fields top, left, width, height |
SHOW | int | Show the FX window, 0 or 1 |
LASTSEL | int | Zero-based index of the selected plug-in |
DOCKED | int | FX window is docked, 0 or 1 |
BYPASS | int × 3 | Per plug-in, before its block. Field 1: bypassed; field 2: offline; field 3: set if the plug-in is offline and should be floated when brought back online |
<VST …, <JS … | block | The plug-in data, see below |
FLOATPOS | int × 4 | Plug-in floating window position: top, left, width, height |
FXID | str | Plug-in ID; leave it alone |
<PARMENV … | block | One block per non-empty parameter envelope of this plug-in; see envelopes |
PARM_TCP | list of int | Parameter indexes visible on the TCP/MCP, separated by spaces |
WAK | int | Not documented (marked ??) |
<COMMENT | block | Plug-in comment, absent if none. Base64; the wiki advises leaving it alone |
Plug-in blocks
| Block | Header fields | Body |
|---|---|---|
<VST | Field 1: default name; field 2: filename; field 3: not documented; field 4: display name (the default is used if empty) | Base64 binary data over a variable number of lines. Leave it alone. |
<JS | Field 1: filename; field 2: display name (the filename is used if empty) | 64 fields, each a float or -, separated by spaces |
The wiki says several other plug-in formats “are completely undocumented”; AU
and the other types seen in real files are therefore described only as base64 state.
Envelopes
The wiki says envelopes “appear to share most of their characteristics” and that how point values are used may differ; it asks for more testing. Envelope types it lists:
| Block | Envelope |
|---|---|
VOLENV | Track (pre FX) or take volume, 0.0 to 2.0 |
VOLENV2 | Track (post FX) volume, 0.0 to 2.0 |
PANENV | Track (pre FX) or take pan, −1.0 to 1.0 |
PANENV2 | Track (post FX) pan, −1.0 to 1.0 |
MUTEENV | Track mute, 0.0 to 1.0 |
AUXVOLENV | Receive volume, “0.0 to 2.0?” |
AUXPANENV | Receive pan, −1.0 to 1.0 |
AUXMUTEENV | Receive mute, 0.0 to 1.0 |
PARMENV | Plug-in parameter; the range is given by extra fields on the header line |
TEMPOENVEX | Master tempo |
Other envelope blocks, such as MASTERPLAYSPEEDENV, appear in real files but
are not covered by the wiki page.
| Keyword | Fields | Meaning |
|---|---|---|
ACT | int | Active, 0 or 1 |
VIS | int, int, num | Field 1: visible; field 2: show in lane; field 3: not documented |
LANEHEIGHT | int, int | Field 1: height in pixels; field 2: not documented |
ARM | int | Armed, 0 or 1 |
DEFSHAPE | int | Default point shape: 0 linear, 1 square, 2 slow start/end, 3 fast start, 4 fast end, 5 bezier |
PT | up to 7 fields | One envelope point, for example PT 3.000000 -0.2 5 0 0 0 -0.7. Field 1: position in seconds; field 2: value; field 3: shape (the wiki queries whether −1 means the envelope default); field 4: optional, not documented (the wiki wonders whether it is the TEMPOENVEX time signature); field 5: selected, 0 or 1, optional; field 6: optional, not documented; field 7: bezier tension, optional. |
The wiki does not say whether the PT shape numbers are the same as the
DEFSHAPE ones, so that is not confirmed here.
PARMENV header
<PARMENV 1 0.0 1469.0 734.5: field 1, the zero-based parameter index from
top to bottom (REAPER adds bypass and wet parameters on the end, in that order); field 2,
the minimum value; field 3, the maximum; field 4, the centre or default value.
Not confirmed
- Fields the Cockos wiki itself marks unknown:
FADEINfield 4,FADEFLAG,VISfield 3,LANEHEIGHTfield 2,PTfields 4 and 6,WAK, the thirdVSTheader field,CFGEDITfields 1, 3, 7 and 9,CFGEDITVIEW, and the two numbers after a<Xsysex event. - Keywords in real files that the wiki page does not list, such as
IID,TAKEFXcontents beyond the chain keywords, and source types other thanWAVE,SECTIONandMIDI(for exampleAUplug-in blocks, which the wiki calls undocumented). - The separate wiki page “State Chunk And RPP MIDI Format” (note and event encoding in more detail), which could not be retrieved.
- The value −65536 in a MIDI item’s
PLAYRATE, and the encoding of the itemCOLOR.