Original document found here: https://web.archive.org/web/20250227145458/https://wiki.cockos.com/wiki/index.php/State_Chunk_Definitions # State Chunk Definitions ### From CockosWiki This page details what is known about various state chunk definitions such as are returned by API functions `GetSetTrackState()`, `GetSetItemState()` and `GetSetEnvelopeState()`. There are still some question marks (gaps) in the definitions and several plugin formats are completely undocumented so please fill in any gaps you can. Thanks to all who have spent time poking around these things. It's a tedious business. *Please note that comments, empty lines and indentation are for illustration only.* *For the sake of formatting, the following changes have been made:* - *Float values with fourteen decimal places have been condensed to three decimal places.* - *Float values with ten decimal places have been condensed to two decimal places.* - *Float values with six decimal places have been condensed to one decimal place.* - *The shorthand "int (bool)" has been used to denote "0 = False, 1 = True"* *TODO:* - *Separate item source properties (including other item types) into their own block.* - *Split this page into separate pages keep this one as the chunk index* - *Link to this page from GetSetWhateverState() pages and remove chunk definitions from those pages* --- ## Track The Track state chunk contains all the settings for a track and all of it's items, envelopes, receives, plugins etc. ```text // FX 1 // FX state, int, 0=bypassed, 1=active TRACKID {5619EDC5-E743-4BE8-AE9F-3B3469A111B5} // REAPER track id, leave it alone PERF 0 // Performance options, int (bitwise) // val & 1 = prevent media buffering // val & 2 = prevent anticipative fx // --- Start of receive data --- // One for each receive or not present if no receives AUXRECV 2 1 1.000 0.000 0 0 0 2 0 1.000 80 1 // First receive // field 1, int, source track index (zero based) // field 2, int, mode // 0 = Post Fader (Post Pan) // 1 = Pre FX // 3 = Pre Fader (Post FX) // field 3, float, volume // field 4, float, pan // field 5, int (bool), mute // field 6, int (bool), mono sum // field 7, int (bool), invert phase // field 8, int, source audio channels // -1 = none, 0 = 1+2, 1 = 2+3, 2 = 3+4 etc. // probably different if non-standard pairs aren't allowed // field 9, int, dest audio channels (as source but no -1) // field 10, float, panlaw // field 11, int, midi channels // source = val & 0x1F (0=None), dest = floor(val / 32) // field 12, int, automation mode (-1 = use track mode) // --- Start of envelope definitions for the above receive // One definition block for each non-empty envelope. // See GetSetEnvelopeState() for full envelope definition. // End of first receive envelope // End of second receive envelope // --- End of envelopes for first receive AUXRECV 3 0 1.000 0.000 0 0 0 0 0 -1.000 0 -1 // Second track receive settings (as above but no envelopes) // --- End of receive data --- MIDIOUT -1 // MIDI hardware output settings. int (bitwise) // device = floor(val / 32) // index of device (inc. ignored devices) // -1 for no MIDI hardware output // channel = val & 0x1F // channel number or 0 for 'use original' // val = device * 32 + channel (device 2, ch 4 == 68) MAINSEND 1 // Master/parent send, int (bool) // --- Start of track envelopes --- // One definition block for each non-empty envelope. // See GetSetEnvelopeState() for full envelope definition. // End of first track envelope // --- End of track envelopes // --- Start of FX section ---- // --- End of FX section // --- Start of item definitions --- // End of first item // --- End of item definitions > // End ``` ## Audio Item ```text // Source details end > // Source section end TAKE SEL // Second take start. SEL only appears if this take is selected NAME "The second take" // Take name TAKEVOLPAN 0.0 1.0 -1.0 // Take volume and pan settings // field 1, float, take pan // field 2, float, take volume // field 3, float, take pan law SOFFS 0.000 // Take slip offset (in seconds) PLAYRATE 1.000 1 0.000 -1 // see PLAYRATE above CHANMODE 1 // see CHANMODE above GUID {4EB7779B-D570-4CCF-8739-161D2D32C154} // Take id. Leave it alone // Source section end > // Item section end ``` ## MIDI Item ```text One example is below, but more info can be found in the [[StateChunkAndRppMidiFormat]] page.
                                               // SysEx section end
        E 540 b0 7b 00                                  // unselected msg, offset 540, Control Change , all notes off (cc123)
        GUID {9DAB52C8-6257-4A4E-9E60-323514C0DB9B}     // Take id
        IGNTEMPO 0 120.00000000 4 4                     // Ignore project tempo, override with new settings
                                                        //  field 1, int, ignore on/off
                                                        //  field 2, float, tempo used to override project tempo
                                                        //  field 3-4, int, time signature to override project time signature
        VELLANE 128 97 0                                // Velocity/CC lane settings
                                                        //  field 1, int, lane type
                                                        //    -1 = velocity
                                                        //    0-119 = CC #0 - CC #119
                                                        //    128 = pitch bend
                                                        //    129 = program
                                                        //    130 = channel pressure
                                                        //    131 = bank/program select
                                                        //    132 = text events
                                                        //    133 = sysex
                                                        //  field 2, int, height of the lane in MIDI editor mode
                                                        //  field 3, int, height of the lane in inline editor mode
        BANKPROGRAMFILE "C:\Path\To\GM.reabank"         // Path to ReaBank file used by the current item
        CFGEDITVIEW 3787.8 0.1 0 48 0 0 0               // Somehow related to H/V zoom levels and scrollbar positions
        CFGEDIT 1 1 0 1 1 16 1 1 1 1 1 0.06250000 0 0   // MIDI editor window configuration data
        1024 768 0 2 0 0 0.00000000 0 0                 //  field 1, int, ??
                                                        //  field 2, int (bool), sync editor transport to project transport
                                                        //  field 3, int, ??
                                                        //  field 4, int (bool), show velocity handles
                                                        //  field 5, int (bool), show note names
                                                        //  field 6, int, MIDI editor 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
                                                        //  field 7, int, ??
                                                        //  field 8, int (bool), move CCs with notes
                                                        //  field 9, int, ??
                                                        //  field 10, int (bool), snap to grid
                                                        //  field 11, int (bool), show grid
                                                        //  field 12, float, grid division unit, in beats.ticks
                                                        //  field 13, field 14, int, X and Y coords of upper left corner of ME window
                                                        //  field 15, field 16, int, X and Y coords of bottom right corner of ME window
                                                        //  field 17, int (bool), dock editor window
                                                        //  field 18, int, note row view modes
                                                        //    0 = show all rows
                                                        //    1 = hide unused rows
                                                        //    2 = hide unused and unnamed rows
                                                        //  field 19, int, state of Timebase setting
                                                        //    0 = project beats
                                                        //    1 = project sync
                                                        //    2 = project time
                                                        //    4 = source beats
                                                        //  field 20, int, state of Color mode setting
                                                        //    0 = velocity
                                                        //    1 = channel
                                                        //    2 = pitch
                                                        //    4 = source
                                                        //  field 21, float, length of last drawn note in beats.ticks
                                                        //  field 22, int, re-use editor window
                                                        //    0 = off
                                                        //    1 = re-use MIDI editor window
                                                        //    2 = re-use MIDI editor window, keeping current item secondary
                                                        //  field 23, int (bool), show velocity numbers
        EVTFILTER 0 -1 -1 -1 -1 0 1                     // Event filter settings
                                                        //  field 1, int (16-bit mask), state of channel checkboxes
                                                        //    0000000000000000 (0)     - "All" is checked, 1-16 unchecked
                                                        //    1111111111111111 (65536) - "All" is checked along with 1-16
                                                        //    1000000000000001 (32769) -  1 (LSB) and 16 (MSB) are selected
                                                        //    etc.
                                                        //  field 2, int, Event type
                                                        //    -1  = 
                                                        //    144 = Note
                                                        //    160 = Poly Aftertouch
                                                        //    176 = Control Change (CC)
                                                        //    192 = Program Change (PC)
                                                        //    208 = Channel Aftertouch
                                                        //    224 = Pitch
                                                        //    240 = Sysex/Meta
                                                        //  field 3, int, parameter field (range: 0-127)
                                                        //  field 4, int, value Low field (range: 0-127)
                                                        //  field 5, int, value High field (range: 0-127)
                                                        //  field 6, int, draw events on channel setting (range: 0-15)
                                                        //  field 7, int (bool), enable filter
    >                                                   // Source section end
>                                                       // Item section end
```

MIDI Event -> field 2 above... This is the number of ticks (it's ok, I'll tell you in a minute) since the last event or (if this is the first MIDI Event) the start of the Item.

Ticks then. A tick is a small slice of a beat, so the number of Ticks per second varies with the BPM (Beats Per Minute) of the music.

1 beat = 2.6041666666666666666666666666667e-4 \times 240 \times 16

1 beat = 2.6041666666666666666666666666667e-4 * 240 * 16

The MIDI format used in REAPER State Chunks and .rpp files is documented here State Chunk And RPP MIDI Format.




## Envelope

Envelopes appear to share most of their characteristics though there may be some differences in how point values are used. Needs more testing

Envelope types include:

- VOLENV - Track (pre FX)/Take volume (0.0 to 2.0)
- VOLENV2 - Track (post FX) volume (0.0 to 2.0)
- PANENV - Track (pre FX)/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 - Plugin parameter (value range defined by additional parameters after type tag)
- TEMPOENVEX - Master tempo


```text
```

PARMENV contains extra data denoting which plugin parameter is controlled and what the minimum, maximum and default values are.

```text

```


## Track/Take FX

Plugin chains appear to be the same for both tracks and item takes, with the exception that the chunk name is different.

```text
                                                             //
    FLOATPOS 0 0 0 0                                          //  Plugin floating window pos, int (top, left, width, height)
    FXID {1191A7FE-F583-477E-8416-D9F0F58226CD}               //  Plugin id, leave it alone

                                                              //  --- Start of parameter envelopes for this plugin.
                                                              //      One block for each non-empty envelope.
                                                             //
                                                              //  --- End of parameter envelopes

    PARM_TCP 4 2 0                                            //  Params visible on TCP/MCP.
                                                              //   List of int indexes separated by spaces.
    WAK 0                                                     //  int, ??
                                                             //

                                                              // --- Start of second plugin definition
    BYPASS 0 0 0                                              //  ...
                                                             //
    FLOATPOS 0 0 0 0                                          //  ...
    FXID {BE5D3334-6675-4DAD-AFDD-F4489878D82A}               //  ...
    WAK 0                                                     //  ...
                                                             //  ...

    >                                                         // --- End of FX section

```

## VST(i) Plugin

```text
                                                             //  End of VST plugin data
```

## Jesusonic Plugin

For the sake of formatting, the plugin data has been truncated.

```text
                                                             //  End of JS plugin data
```