Regions, takes and notes
Region { id, name, start, length, muted, color, content, loop_end, takes, params, pattern }.
Times are in samples at the project rate.
contentisAudio { clip, offset, gain_db, fade_in, fade_out, fade_shape }orMidi { notes, cc }.offsetis the clip frame at the region’s start; fades are frame lengths (their curves and types are infade_shape, see Fades and crossfades); region gain is clamped to -96..+30 dB.- Loops:
loop_endis the timeline sample where a looping region stops repeating; the region’s ownstart..start+lengthis what repeats.Region::end()clamps it (at mostMAX_LOOP_PASSES= 4096 repetitions),passes()lists every pass, andmove_totakes the loop end along.real_copiesimplements Convert Loops to Real Copies. - Take folders:
takes: Some(TakeFolder)makes the region play a comp. See below. - Order matters: within a track, a region later in
regionsis newer and wins where audio overlaps. Moving a region pushes it to the end of the list. - Playback parameters:
params: RegionParams(region_params.rs, session side insession/region_params.rs) holds the Region inspector’s Quantize, Q-Swing, Transpose, Velocity, Dynamics, Gate Time and Delay; the defaults change nothing and aren’t saved. They are applied whenregions_dspbuilds the playback list, so the audio thread does nothing new: a MIDI region with parameters becomes oneRegionDsp::Midiper pass with transformed notes and a window widened (lead,tail) to cover notes a negative delay or quantize moved before its start and the end a positive delay moved later (region_params::pass); an audio region’s delay moves it (bake). Quantize and tick delays read the tempo map, sosync_globalsrebuilds the lists of tracks whose parameters follow it (push_tempo_regions).bakewrites the parameters into a region so it plays the same (Apply Region Parameters, Join, MIDI file export), andboundsgives render ranges (Bounce in Place, Export Region, Freeze, the project end). The snapshot’splayedlist carries the notes as they play for the Tracks area; the Piano Roll edits the stored notes. - Pattern regions (the Step Sequencer):
pattern: Some(Pattern)on a MIDI region (pattern.rs, session side insession/patterns.rs). APatternhas a length in steps, a step rate, swing, a loop switch andPatternRows (pitch, mute, solo, an optional rate and length of its own, andSteps: on, velocity, gate, tie; off steps with default values save as{}).regions_dspturns each pattern region into the plain MIDI region it plays (pattern::realize, through the tempo map from the region’s start) before anything else, so playback parameters, loops, chase and every render work unchanged;bakerealizes first, so Join and MIDI export do too, andpush_tempo_regionsrebuilds pattern tracks on tempo changes. The region’s stored notes stay empty. The Step Sequencer sends the whole edited pattern withset_pattern(keyed per drag, so a painted run is one undo step).
Take folders and comps
Section titled “Take folders and comps”TakeFolder { takes, comp, comps, current, offset } (types in model/take_folder.rs, logic in
takes.rs, session edits in session/takes.rs; the folder menu’s labels in src/comps.ts):
- Everything inside a folder is in take time: frames from the start of the recorded
passes. The folder region’s
contentis stillAudio, but itsoffsetis the take time at the region’s start (so moving, trimming and splitting work as for any audio region), itsclipis the newest take’s file, and its gain and fades apply to the whole comp. - Each
Takehas its own clip andoffset(clip frame at take time 0) and the take-time range it has audio for.takesis oldest first. compis a sorted, non-overlapping list ofCompSegment { start, end, take }. Gaps are silent.default_compstarts with the newest take, older ones filling in where it has no audio.- Several comps:
compsholds everyComp { name, comp }andcurrentthe one heard;compis the one being heard and edited, andstore_compcopies it back intocomps[current]after every edit, so playback and the swipe edits only touchcomp. An emptycompsis the single “Comp 1”, so older projects load unchanged.create_comp,duplicate_comp,switch_comp,rename_companddelete_compare the menu’s commands. - Playback expands the comp into
CompPieces (pass_pieces_edged), crossfading over Settings › Editing › Crossfade Time (EditingPrefs::crossfade_ms, 20 ms by default) with the Crossfade Curve, centred on each boundary. A folder crossfades with its neighbours like any audio region (PassEdgescarries the crossfades at its ends into the pieces). - MIDI take folders: a folder on a MIDI region. Each
Takekeeps its ownnotesandccin take time, andoffsetis the take time at the region’s start. A MIDI folder plays one whole take (midi_take), and the region’scontentalways holds that take’s notes inside the region (load_midi_take; edits are written back withsave_midi_takebefore anything reads the takes), so the playback list, the Piano Roll and every render treat it as a plain MIDI region.MidiOverlap::TakeFolders(Settings › Recording) makes MIDI cycle passes into takes, split at thePASS_MARKs the engine puts in the recorded stream (midi_passes). - Recording:
RecPlan(takes.rs) describes how a cycle or Autopunch recording is cut into takes;Session::record_planbuilds it before recording, andshape_takeapplies it to each finished file.
Notes and controllers
Section titled “Notes and controllers”Note { start, length, pitch, velocity, muted },startrelative to the region.CcEvent { start, kind, value }withCcKind::Controller(n),PitchBend(0..16383, 8192 centred) orAftertouch.ccis kept sorted by start.CcKind::indexgives a dense index (0..130) used for per-kind tables on the audio thread.crates/engine/src/midi.rshas the pure helpers for split, trim and join that keep controllers consistent: the later part of a split starts with the values in effect at the cut.- The Piano Roll edits content wholesale: it sends
set_midi_contentwith the region’s new notes and controllers (and new bounds when the region grew), as one undo step.