forge
Explore
Log in

Don't you dare go Hollow

✨ Pitch takes fractional semitones (v58 when one is set), a speed ramp holds up to 64 keys, a given audio_kbps re-encodes the sound rather than being refused, and EDITH_FONTS_DIR adds font folders ahead of the system's

Browse files at this commit

5d650d9a2fd9fd0f5103e9ed51ad7feba08d4e70Ahmet Kaan GümüşParent: fd05fc7
MCP.mdmodified+5 -3
@@ -334,12 +334,12 @@ prints it live, and `help {topic:"<op>"}` gives one op's entry. The recipes and
334334 | place | `place {source, at, lane?, in?, out?, length?, stretch?, audio?, audio_lane?, audio_track?, overwrite?}` (no lane: linked V1+A1; with lane: overwrites it; `at:"end"` is the timeline end, not the lane's, so it can leave a hole on a lane that ends sooner; a `length` past the source is refused ("runs past the source end") unless `stretch:true`; `audio_track:N` picks the sound track of a multi-audio file, 0-based as `media_probe` numbers them, and a track other than the source's own is placed as a source of its own, `src:N` with the same file name) · `append {source, in?, out?}` (to the end of its lane; not the timeline end) · `keep {source, ranges:[[in,out]…], lane?, at?}` (ranges back to back, the rough-cut workhorse) · `assemble {items:[{source,in?,out?}…], lane?, at?, gap?}` (keep across sources) |
335335 | three-point | `insert {source, in?, out?, at, to?, length?, lanes?}` · `overwrite {source, in?, out?, at, to?, length?, lanes?}` (`src` also spells `source`; the source range `in..out`, else the whole file, goes at `at`; `to` is a timeline out mark and `length` a duration, either sets the length from `in` instead of `out`; the take lands on `lanes`, at most one V and one A, else the first unlocked V and A lanes the source has, linked as one take; a still takes a V lane and `length` (default 5 s), a song an A lane. `insert` cuts the clip `at` falls inside and ripples what follows on those lanes only; it never moves or splits a lane outside the take, and refuses by name when that would pull a linked take apart. `overwrite` replaces what is there, trimming or splitting it, and nothing moves. Captions and titles keep their time; a locked lane refuses; one undo step each) |
336336 | cut | `split {at, lanes?}` · `trim {clip, edge: in\|out, to, scope?}` [group] · `roll {clip, by\|to, edge?}` [group] (move the cut between two clips) · `slip {clip, by}` [group] (shift the source in/out, same slot) · `slide {clip, by}` [group] (move the clip between its neighbours) · `move {clip, at, to_lane?, insert?, titles?, split_captions?}` [group] (`insert:true` is a ripple move) · `delete {clip}` [group] · `lift {clip}` · `ripple_delete {clip}` · `close_gaps {lane}` · `cut_regions {regions:[[from,to]…], lanes?}` (accepts `silence` output verbatim) · `insert_time {at, duration, lanes?}` (ripples empty time in; a clip `at` falls inside is cut first) · `remove_time {at, duration, lanes?}` (the `cut_regions` cut for one span; a title wholly inside the span is removed, and one straddling an edge is trimmed to the part outside; the reply names both) · `swap {a, b}` (two clips on one lane trade places; a clip in a linked take is refused until the take is ungrouped) |
337-| time | `speed {clip, x}` 0.25–4 [group] (x is the absolute rate, not a multiplier: re-sending 0.5 on a clip already at 0.5 changes nothing) · `reverse {clip, on?}` [group] (plays the clip backward, picture and sound, or forward again; `on` omitted toggles; composes with speed and ramps; a still refuses; `clip_info` and `timeline` say `reversed`) · `speed_ramp {clip, keys:[{at, speed}…], ripple?, lanes?}` [group] (up to 8 keys at clip-relative times, speed 0.25–4 linear between them and held outside them; `keys:[]` clears the ramp) · `fade {clip, in?, out?}` (int = frames, `"0.5s"` = time) · `dissolve {clip, frames}` (video transition into the next clip) · `transition {clip, kind?=dissolve, length?, direction?}` (the same overlap with a look: `dissolve`, `dip-black`, `dip-white`, `wipe`, `slide`, `push` or `zoom`; `wipe`/`slide`/`push` move `left` (default), `right`, `up` or `down`, the way things move, so `wipe-left` shows the next clip from the right edge; `length` or `frames` is the overlap, kept when omitted; `dissolve` accepts `kind` too; the picture changes with the kind, the sound is always the crossfade; `timeline` flags and `clip_info.transition_kind` show it) · `crossfade {clip, frames}` (audio) · `freeze {at, duration, lane?=V1, insert?=true}` (holds the composed frame at `at` as a still; needs a project path, saved or not; see below) |
337+| time | `speed {clip, x}` 0.25–4 [group] (x is the absolute rate, not a multiplier: re-sending 0.5 on a clip already at 0.5 changes nothing) · `reverse {clip, on?}` [group] (plays the clip backward, picture and sound, or forward again; `on` omitted toggles; composes with speed and ramps; a still refuses; `clip_info` and `timeline` say `reversed`) · `speed_ramp {clip, keys:[{at, speed}…], ripple?, lanes?}` [group] (up to 64 keys at clip-relative times, speed 0.25–4 linear between them and held outside them; `keys:[]` clears the ramp) · `fade {clip, in?, out?}` (int = frames, `"0.5s"` = time) · `dissolve {clip, frames}` (video transition into the next clip) · `transition {clip, kind?=dissolve, length?, direction?}` (the same overlap with a look: `dissolve`, `dip-black`, `dip-white`, `wipe`, `slide`, `push` or `zoom`; `wipe`/`slide`/`push` move `left` (default), `right`, `up` or `down`, the way things move, so `wipe-left` shows the next clip from the right edge; `length` or `frames` is the overlap, kept when omitted; `dissolve` accepts `kind` too; the picture changes with the kind, the sound is always the crossfade; `timeline` flags and `clip_info.transition_kind` show it) · `crossfade {clip, frames}` (audio) · `freeze {at, duration, lane?=V1, insert?=true}` (holds the composed frame at `at` as a still; needs a project path, saved or not; see below) |
338338 | look | `color {clip, brightness?, contrast?, saturation?, tint?, reset?}` · `transform {clip, x?, y?, corner?, margin?, scale?, rotate?, crop?:[l,r,t,b], opacity?, reset?}` (`corner` is centre, top-left, top-right, bottom-left or bottom-right: the engine sets x and y from the picture's own size (after crop and quarter turn), the scale given and a `margin` in pixels (default 32) from the two edges it touches; giving x or y with corner is refused, and so is margin without corner; picture in picture is `corner:"bottom-right", scale:0.3`) · `transform_keys {clip, keys?:[{at, x?, y?, scale?, rotate?, opacity?, ease?}…], clear?}` (animates the transform over the clip's own time) · `opacity_keys {clip, keys?:[{at, opacity, ease?}…], clear?}` (opacity 0..1 over the clip's own time, fades multiply on top) · `color_keys {clip, keys?:[{at, brightness?, contrast?, saturation?, tint?, ease?}…], clear?}` (the grade over the clip's own time, interpolated per frame) · `look {clip, name}` (the whole grade becomes a look, one undo step: a built-in `Warm`, `Cool`, `Teal & orange`, `Bleach bypass`, `Black & white`, `Faded film`, `High contrast` or `Vintage`, or a saved one from the colour card's "Save current as look" (`$XDG_DATA_HOME/edith/looks/<name>.look`); an unknown name is refused with the list; `help {topic:"looks"}` lists them) · `look {clip, save:"<name>"}` (the reverse: the clip's grade is saved as a look of that name, as the grading card's "Save current as look" does; the project does not change, so no undo step; a built-in's name is refused) · `auto_color {clip}` (reads the clip's middle frame as shot: grey-world white balance into the wheels' channel gains, then brightness and contrast so the 0.5 % and 99.5 % luma percentiles land near 0.02 and 0.98; saturation, tint, curves and LUT kept; the reply gives the values set; one undo step) · · `wheels {clip, lift?, gamma?, gain?, reset?}` (each `[master, red, green, blue]`, -1..1, or one number for the master) · `curves {clip, master?, red?, green?, blue?, reset?}` (each up to 16 `[input, output]` points in 0..1, monotone cubic; `[]` straightens one) · `lut {clip, path?, mix?, clear?}` / `lut {relink, path}` (a `.cube` file, 1D or 3D up to 65, tetrahedral, mix 0..1; a broken file is refused; relink moves every clip naming a file, one undo step). The grade runs wheels → curves → LUT → the four sliders, in Rec. 709 R'G'B' for the first three; colour keys animate the sliders and the look holds under them; saved as v43 `wheels`/`curve`/`lut` lines. Recipe: `edit {ops:[{op:"lut", clip:"V1@0", path:"~/luts/warm.cube", mix:0.8}]}`, then `scopes {at:"2s"}` to read the shift · `copy_look {from, to | to_lane, what?}` (copies colour, transform, fit, effects, EQ, gain or speed onto other clips, one undo step) · `replace {clip, source, in?}` (the replace edit: overwrite the clip and its linked half with another source, same place and length) · `nudge {clips, by}` [group] (move clips by a signed distance, all or nothing) · `fit {clip, policy: fit\|fill\|stretch\|center}` · `deinterlace {clip, mode: frame\|field\|off\|ivtc-auto\|ivtc}` (how a video clip's interlaced source is made progressive, frame by default; only matters for an interlaced source, which `media_probe` reports; field and off are stored, the render acts on frame for now; `ivtc` removes 3:2 pulldown from telecined 29.97i H.264 and MPEG-2, giving the 23.976p film frames (best cadence found in the first 60 pictures, one cadence for the whole file), `ivtc-auto` does so only when that cadence is clear and otherwise deinterlaces as frame; put the project on 23.976 (`set_frame_rate`) for one timeline frame per film frame; soft pulldown (MPEG-2 repeat_first_field, H.264 pic_struct) in a transport stream is always presented as 23.976p; saved as v46 `deint` lines) · `visualizer {clip, on?, style?, fast?}` (the clip becomes a sound picture: style fill\|ribbon\|ring\|wave, fill by default; `fast` paints from a 0.2 s window; `on:false` turns it off, from the waveform picture or from the sound clip). On a sound clip, `on:true` places a waveform picture on the next free top picture lane (V2 or V3), grouped with the sound and covering the picture under it where they overlap; place it with `transform` (x, y move its centre, -1 to 1; scale; opacity). A picture address (`V1@…`) is mapped to its linked sound clip, which gets the picture; a picture with no linked sound is refused · `reframe {clip, aspect?=fit, smoothness?=0.5}` (auto reframe: a cheap saliency per sampled frame -- what moved since the last sample, local contrast, a pull to the middle, no models -- gives the subject's path, which is smoothed (`0.25 + 1.75 × smoothness` s), held still inside a dead zone and thinned to the keys where it turns; the keys scale the clip to cover the canvas and pan the subject to the middle, clamped so no edge ever shows; sets `fit` to fit and replaces the clip's `transform_keys` in one undo step, so no format change; it analyses before it answers; `aspect` is a guard that the project canvas has that shape; `engine::reframe`) · `stabilize {clip, on?, strength?=0.5, crop?=zoom, off?, cancel?}` (takes the camera shake out of a video clip: corners tracked frame to frame by pyramidal Lucas-Kanade, a shift-turn-zoom fitted by RANSAC, the camera path smoothed by a Gaussian of strength × 2 s (a steady pan is kept), each frame moved to the smoothed path before the clip's transform; `crop` `zoom` enlarges just enough that no frame shows an edge (≤1.5×), `full` keeps the frame and shows black edges; the analysis runs in the background, is cached per source and file-frame range under `~/.cache/edith/stabilise`, follows the footage through trims, speed, ramps and reverse; an export measures a missing analysis itself, which `export_status` shows as its `Measuring shake` stage with its own percent, while `frame` and `contact_sheet` never wait: they start it, draw the clip unstabilised and say the analysis is pending; `engine::stabilise`, format v44) |
339339 | generated | `generator_add {kind: solid\|gradient\|countdown\|bars\|rectangle\|ellipse\|line\|arrow, color?, color2?, angle?, from?, fill?, stroke?, width?, radius?, lane?=V1, at?, duration?=5s}` (shapes `rectangle`, `ellipse`, `line` and `arrow` draw on a transparent canvas and composite over the lanes below: `fill` and `stroke` are `"#rrggbb"` or `"none"`, `width` the stroke in pixels 0..400, `radius` rounds a rectangle 0..2000; a line and an arrow are all stroke, a line runs left to right and an arrow points right; a shape lands at 40% scale and its size and place are the clip's `transform`; a clip made from numbers instead of a file: `color` is `"#ff3366"`, `angle` 0..359 degrees with 0 left to right and 90 top to bottom, `from` the countdown's whole seconds 1..3600, which is also its default duration; `at` defaults to the end of the lane; the lane must exist; a param the kind does not take, an unknown kind or a bad colour is refused by name; it overwrites what it lands on like a still, and is an ordinary clip afterwards, so trim, move, split, `color`, `transform` and effects all work) · `generator_set {clip, color?, color2?, angle?, from?, fill?, stroke?, width?, radius?}` (params merged onto a generator clip, place and length kept; a clip that plays a file is refused) · `adjustment_add {lane?=V2, at?, duration?=5s}` (a clip with no picture whose grade and effects reach everything composed beneath it; with no lane, V2, added when there is only V1; a transform on it moves the whole composite below, so uncovered area goes black, while crop only limits where it reaches and cropped-away areas keep the untouched picture; adjacent layers hard-cut) · `label {clip \| clips, value}` (a name from the label palette in any case, 1..8, or `none`) · `enable {clip \| clips, on}` (`on:false` keeps the clip but skips its picture and sound; an off adjustment layer stops adjusting). One undo step each; `timeline` and `clip_info` show `generator solid #ff3366`, `adjustment layer`, `label Rose` and `disabled`, and `media_list` does not call a generator an offline file. A generator's source is a pseudo-path `/edith-gen/<spec>.gen` (`engine::generate`), so the library, trims and saves treat it as a still. Format v48 (older formats still load): written only when a project has a generator, a label or a switched-off clip, so other projects keep their older version |
340340 | sequences | `nest {clips:[addr…], name?}` (folds the picked clips and their linked partners into a new sequence and leaves one compound clip, on the lowest picked video and sound lanes, linked; refuses when an unpicked clip sits between picked ones; one undo step) · `break_apart {clips}` (puts a compound clip's contents back, trimmed to the stretch it played, one undo step) · `place_sequence {sequence, at, lane?=V1}` (a sequence as a compound clip; a cycle is refused). A compound clip's source is `1<<30 + sequence id`; the render inlines it into the flat timeline, so a nested render equals the flat one; it has no speed, ramp or reverse (refused) and its own colour/effects/transform are not applied. Format v45 (`MAGIC_V44` still loads): the active sequence is the body as before, then `seqactive <id> <name>`, `seqorder <ids>` and one `seq <id> <name>` … `endseq` block per parked sequence holding a complete document; only written when there is more than one sequence or a compound clip, so other projects stay v44 or older. The frame rate is locked then |
341341 | multicam | `angle {clip, at?, angle?, audio?}` (switches a multicam clip's angle from `at` on: the clip is cut there when `at` is inside it, and the right part shows `angle`, a number from 1 or a name; the sound follows the picture unless `audio` is `"follow"` or an angle, which keeps it there; `clip` may be the picture or its linked sound clip; one undo step; refused for a clip that is not multicam, an angle that does not exist, or no change). A multicam clip is a compound clip (`source = 1<<30 + id`) with an `Angle {video, audio?}` on the clip; the sequence it plays is flagged multicam and holds angle `n` as its `n`th video lane and `n`th audio lane, so the render inlines exactly that angle's lane (`expand`), `break_apart` and `multicam_flatten` do the same. `timeline` rows read `multicam "Name" angle 2 "cam_b"`. Format v47 (`MAGIC_V46` and older still load; the version lives in `edith.rs` `MAGIC`/`NEWEST_VERSION`): `mcam <sequence id> <angle name>` lines in angle order after `seqorder`, and `angle <video|audio> <ord> <index> <picture> <sound|->` per clip that is not on angle 1 (angles counted from 1); written only when a project has a multicam source or a switched clip, so other projects keep their older version |
342-| sound | `eq {clip, bands:[{f,db,q,kind}] (max 10), reset?}` (f 20–20000 Hz, db ±12, q 0.3–12 default 0.707; kind peak (default), low_shelf, high_shelf, low_cut, high_cut) · `gain {clip, db (-60..24) \| add_db}` (one audio clip's own volume, on top of its lane's; relative steps clamp to the range) · `gain_keys {clip, keys:[[time, db]…]}` (the clip's volume envelope, audio only: replaces all points, `[]` clears, max 256; times are timeline times inside the clip) · `gain_key {clip, at, db}` (one point; the same frame is replaced) · `gain_key_remove {clip, at}` (the point within a frame of `at`; a miss lists the points) · `gain_ramp {clip, from, to, to_db, from_db?}` (straight dB ramp; `from_db` defaults to the envelope's level at `from`) · `gain_dip {clip, from, to, db, ramp?="0.5s"}` (dips over `from..to` with ramps in and out, starting from the level there now and clamped to the clip). The ramp and dip ops replace the points inside their span. · `lane_gain {lane, db}` (-60..12) · `pan {clip, pan}` (-1 left .. 1 right, 0 the middle; an audio clip's balance, format v50 `clippan` line) · `pitch {clip, semitones}` (-12..12 whole semitones, 0 the original; an audio clip's pitch with its speed kept, format v52 `pitch` line) · `lane_pan {lane, pan}` (the same for an audio lane, on top of the clips' `lanepan` line) · `limiter {on?, ceiling_db?}` (ceiling -24..0 dB) · `duck {lane, under, depth_db?=-12, threshold_db?=-40, attack_ms?=80, release_ms?=400, off?}` (the lane dips while the key lane speaks) |· `dynamics {lane, gate?, nr?, compressor?, deesser?, reset?}` (an audio lane's voice processors, run gate, noise reduction, compressor, de-esser after the clips' own EQ and before the limiter; each is true, false (bypass) or an object of settings; `engine::voice`, format v41) |
342+| sound | `eq {clip, bands:[{f,db,q,kind}] (max 10), reset?}` (f 20–20000 Hz, db ±12, q 0.3–12 default 0.707; kind peak (default), low_shelf, high_shelf, low_cut, high_cut) · `gain {clip, db (-60..24) \| add_db}` (one audio clip's own volume, on top of its lane's; relative steps clamp to the range) · `gain_keys {clip, keys:[[time, db]…]}` (the clip's volume envelope, audio only: replaces all points, `[]` clears, max 256; times are timeline times inside the clip) · `gain_key {clip, at, db}` (one point; the same frame is replaced) · `gain_key_remove {clip, at}` (the point within a frame of `at`; a miss lists the points) · `gain_ramp {clip, from, to, to_db, from_db?}` (straight dB ramp; `from_db` defaults to the envelope's level at `from`) · `gain_dip {clip, from, to, db, ramp?="0.5s"}` (dips over `from..to` with ramps in and out, starting from the level there now and clamped to the clip). The ramp and dip ops replace the points inside their span. · `lane_gain {lane, db}` (-60..12) · `pan {clip, pan}` (-1 left .. 1 right, 0 the middle; an audio clip's balance, format v50 `clippan` line) · `pitch {clip, semitones}` (-12..12 semitones, fractions too, 0.37; 0 the original; an audio clip's pitch with its speed kept, format v55 `pitch` line, v58 when fractional) · `lane_pan {lane, pan}` (the same for an audio lane, on top of the clips' `lanepan` line) · `limiter {on?, ceiling_db?}` (ceiling -24..0 dB) · `duck {lane, under, depth_db?=-12, threshold_db?=-40, attack_ms?=80, release_ms?=400, off?}` (the lane dips while the key lane speaks) |· `dynamics {lane, gate?, nr?, compressor?, deesser?, reset?}` (an audio lane's voice processors, run gate, noise reduction, compressor, de-esser after the clips' own EQ and before the limiter; each is true, false (bypass) or an object of settings; `engine::voice`, format v41) |
343343 | lanes | `lane_add {kind}` · `lane_remove {lane}` · `lane_move {lane, to}` · `lane_flags {lane, hidden?, muted?, locked?}` · `lane_name {lane, name}` (the lane's display label, like a track name, at most 40 characters, `""` clears it; the address V1/A2 is unchanged and still what every op takes; `timeline` shows the name on the lane header and as `name` in its structured lanes; one undo step; saved as v46 `lanename` lines) |
344344 | group | `group {clips:[addr…]}` · `ungroup {clip}` |
345345 | captions | edit ops, not tools: `subtitles_import {path}` (tracks, no lane yet) · `captions_place {track, lane?, at?}` · `sub_move {clip, at, to_lane?}` [group] · `sub_trim {clip, edge:in|out, to}` · `sub_delete {clip}` · `captions_remove {track, force?}` · `cue_add {track, at, to, text, overwrite?}` · `cue_text {track, index, text}` (`\n` = line break) · `cue_delete {track, index}` · `cue_time {track, index, at?, to?}` (timeline times: trim or move one cue inside its neighbours, 0.1 s minimum) · `cue_merge {track, index}` (with the next cue) · `cue_split {track, index, at}` · `cue_replace {track?, find, replace, case_sensitive?}` (every cue of one track, or all tracks; case-insensitive unless `case_sensitive`; reports occurrences and cues). Written as `edit {ops:[{op:"cue_text", …}]}`; `captions` (the tool) lists the cues as `track T cue C` |
@@ -402,11 +402,13 @@ flag turns that off; the server does not pass it.
402402 Voice needs piper (`EDITH_PIPER`, or `~/.local/share/piper-venv/bin/piper`).
403403 Piper's stderr is reported on failure.
404404
405+Subtitle fonts: `EDITH_FONTS_DIR` (directories separated by `:`) adds font files that win over system fonts.
406+
405407 ### 4.7 Export
406408
407409 | tool | args | does |
408410 |---|---|---|
409-| `export_start` | **out**, preset (an `export_presets` id; explicit args override it), loudness (-30 to -5 LUFS, the integrated target; the true peak holds at the preset's ceiling or -1 dBTP, the gain is cut back and never a limiter), format (mp4, av1, av1-mp4, hevc, hevc-mp4, webm, wav, flac, mp3, ogg, m4a, opus, prores, png_sequence, still, gif), gif_width (320/480/640/720, default 480), gif_fps (1-60, default 15), gif_loop (default true), range, size, fit, bitrate_kbps, qp (0-51, a constant quantiser instead of a bitrate: the hardware seat for H.264, HEVC and AV1, and software HEVC; software H.264 and AV1 refuse it; not with bitrate_kbps), keyframe_s (0.1-10 seconds between key frames of the picture, default the encoder's two; not with intra_only), faststart (true lays an mp4, hevc-mp4, av1-mp4 or m4a out moov-first so it plays before it is fully read; other formats refused), audio_kbps (128/192/256/320, and 384 for AAC only: mp4, av1, av1-mp4, hevc, hevc-mp4, m4a), bit_depth (8\|10; 10 is AV1 and HEVC only), prores_profile (proxy\|lt\|standard\|hq\|4444\|4444xq; format `prores`, a `.mov`), hdr (off\|pq\|hlg; HEVC only, implies 10-bit), hevc_speed (default\|fast\|faster; HEVC only: fast is about 1.2-1.6x quicker for 0-3% more bits, faster about 1.5-2x quicker for up to 27% more), audio_bit_depth (16\|24; ProRes sound), chapters (default true; `"markers"` writes the comment markers as the chapters), intra_only, seat (auto\|hardware\|software), subtitles, burn_captions, overwrite | starts an export; returns `job:<n>` at once. The reply counts the chapters written (`3 chapters`) and, for an AV1 or HEVC file, its depth (`output 10-bit, from the source`) · `queue` (true: line the export up behind the others -- it keeps its own copy of the timeline as it is now, so later edits do not change it, and starts when every earlier export has finished, one encode at a time, polled or not; `export_status` shows it as `waiting`; default false starts at once beside any others) |
411+| `export_start` | **out**, preset (an `export_presets` id; explicit args override it), loudness (-30 to -5 LUFS, the integrated target; the true peak holds at the preset's ceiling or -1 dBTP, the gain is cut back and never a limiter), format (mp4, av1, av1-mp4, hevc, hevc-mp4, webm, wav, flac, mp3, ogg, m4a, opus, prores, png_sequence, still, gif), gif_width (320/480/640/720, default 480), gif_fps (1-60, default 15), gif_loop (default true), range, size, fit, bitrate_kbps, qp (0-51, a constant quantiser instead of a bitrate: the hardware seat for H.264, HEVC and AV1, and software HEVC; software H.264 and AV1 refuse it; not with bitrate_kbps), keyframe_s (0.1-10 seconds between key frames of the picture, default the encoder's two; not with intra_only), faststart (true lays an mp4, hevc-mp4, av1-mp4 or m4a out moov-first so it plays before it is fully read; other formats refused), audio_kbps (128/192/256/320, and 384 for AAC only: mp4, av1, av1-mp4, hevc, hevc-mp4, m4a; given, the sound is re-encoded at it rather than copied, a preset's counts too), bit_depth (8\|10; 10 is AV1 and HEVC only), prores_profile (proxy\|lt\|standard\|hq\|4444\|4444xq; format `prores`, a `.mov`), hdr (off\|pq\|hlg; HEVC only, implies 10-bit), hevc_speed (default\|fast\|faster; HEVC only: fast is about 1.2-1.6x quicker for 0-3% more bits, faster about 1.5-2x quicker for up to 27% more), audio_bit_depth (16\|24; ProRes sound), chapters (default true; `"markers"` writes the comment markers as the chapters), intra_only, seat (auto\|hardware\|software), subtitles, burn_captions, overwrite | starts an export; returns `job:<n>` at once. The reply counts the chapters written (`3 chapters`) and, for an AV1 or HEVC file, its depth (`output 10-bit, from the source`) · `queue` (true: line the export up behind the others -- it keeps its own copy of the timeline as it is now, so later edits do not change it, and starts when every earlier export has finished, one encode at a time, polled or not; `export_status` shows it as `waiting`; default false starts at once beside any others) |
410412 | `export_presets` | – | lists the export presets (id, label, format, bitrate_kbps, audio_kbps, size, bit_depth, prores_profile, hdr, loudness): youtube_1080p/1080p60/1080p_hevc/4k/4k60/4k_hevc, shorts_reels, podcast, podcast_ogg and podcast_opus (-16 LUFS, -1 dBTP), archive (10-bit AV1 mkv), archive_prores (ProRes 422 HQ .mov), hdr10_hevc (10-bit HEVC mp4 tagged PQ), archive_flac, archive_wav |
411413 | `export_captions` | format (`srt` or `vtt`, required unless chapters), path, overwrite, chapters | writes the timeline's captions (every cue on the subtitle lanes, in start order) as SRT or WebVTT; picture and empty cues are left out. Without `path`: `<first source> edit.<format>` in the Videos folder. Refuses an existing file unless `overwrite` is true, and writes nothing when there are no captions. `chapters: true` writes nothing and returns the chapter markers as the YouTube description listing (`00:00 Intro`, one line each), the text File > Copy chapters copies, as the reply text and as JSON (`chapters` lines, `text`, `warnings`) |
412414 | `proxies` | action (`status`, the default, `make`, `cancel` or `delete`), source (`src:<n>`, a list or `"all"`) | the editing copies (proxies) of sources. `status` shows each source's state (ready, making with its percent, off, not needed for a sound or still, or why a stand-in failed). `make` starts one in the background and turns that film's switch back on; a film that plays at speed on this machine needs none, and says so. `cancel` stops one being made and leaves the film off, as the Proxies switch on a library row does. `delete` removes the stand-in and keeps the film off. With `auto_proxies` on, each `media_import` starts its stand-ins the same way |
crates/app/src/export_ui.rsmodified+1 -0
@@ -753,6 +753,7 @@ pub(crate) fn export_settings(
753753 // free function cannot see; an empty list means "use the project's chapters".
754754 chapters: Vec::new(),
755755 audio_kbps: Some(audio_kbps),
756+ reencode_audio: false,
756757 audio_bit_depth: None,
757758 bitrate: Some(bitrate),
758759 // The copy path (the old `Quality::Exact`) is off this surface: the
crates/app/src/player/cards.rsmodified+3 -3
@@ -2656,8 +2656,8 @@ impl Player {
26562656 ),
26572657 MixDrag::Pitch(..) => (
26582658 self.mix_panel.borrow().pitch_bar.clone(),
2659- f32::from(engine::project::MIN_CLIP_PITCH),
2660- f32::from(engine::project::MAX_CLIP_PITCH),
2659+ engine::project::MIN_CLIP_PITCH,
2660+ engine::project::MAX_CLIP_PITCH,
26612661 ),
26622662 MixDrag::Ceiling => (
26632663 self.mix_panel.borrow().ceiling_bar.clone(),
@@ -2717,7 +2717,7 @@ impl Player {
27172717 /// Sets the selected clip's pitch in semitones; `true` when it moved.
27182718 pub(crate) fn set_clip_pitch_mix(&mut self, lane: Lane, idx: usize, semitones: i32) -> bool {
27192719 match self.session.as_mut() {
2720- Some(session) => session.set_clip_pitch(lane, idx, semitones),
2720+ Some(session) => session.set_clip_pitch(lane, idx, semitones as f32),
27212721 None => false,
27222722 }
27232723 }
crates/app/src/player/export.rsmodified+1 -1
@@ -579,7 +579,7 @@ impl Player {
579579 /// sound: there is nothing to write either way.
580580 pub(crate) fn audio_rate_refusal(&self) -> Option<&'static str> {
581581 match &self.session {
582- Some(session) => session.audio_rate_refusal(self.format, self.export_span().is_some()),
582+ Some(session) => session.audio_rate_refusal(self.format, self.export_span().is_some(), false),
583583 None => Some("no sound to write"),
584584 }
585585 }
crates/app/src/player/sections.rsmodified+1 -1
@@ -187,7 +187,7 @@ impl Player {
187187 }
188188 Section::Effects => !clip.effects.is_empty(),
189189 Section::Eq => session.eq_of(lane, idx).is_some_and(|e| !e.is_identity()),
190- Section::Mix => clip.gain_db != 0. || clip.pan != 0 || clip.pitch != 0 || !clip.gain_keys.is_empty() || clip.fade_in != 0 || clip.fade_out != 0,
190+ Section::Mix => clip.gain_db != 0. || clip.pan != 0 || clip.pitch != 0.0 || !clip.gain_keys.is_empty() || clip.fade_in != 0 || clip.fade_out != 0,
191191 }
192192 }
193193 }
crates/app/src/tests/cards.rsmodified+2 -2
@@ -2060,7 +2060,7 @@ fn a_duration_row_shows_only_for_a_transition_and_its_room_is_the_successors() {
20602060 gain_db: 0.0,
20612061 gain_keys: Vec::new(),
20622062 pan: 0,
2063- pitch: 0,
2063+ pitch: 0.0,
20642064 transform_keys: Vec::new(),
20652065 opacity_keys: Vec::new(),
20662066 color_keys: Vec::new(),
@@ -2163,7 +2163,7 @@ fn the_transition_kinds_are_palette_actions_and_set_through_a_gated_door() {
21632163 gain_db: 0.0,
21642164 gain_keys: Vec::new(),
21652165 pan: 0,
2166- pitch: 0,
2166+ pitch: 0.0,
21672167 transform_keys: Vec::new(),
21682168 };
21692169 let mut b = a.clone();
crates/app/src/tests/editing.rsmodified+4 -4
@@ -715,7 +715,7 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() {
715715 gain_db: 0.0,
716716 gain_keys: Vec::new(),
717717 pan: 0,
718- pitch: 0,
718+ pitch: 0.0,
719719 transform_keys: Vec::new(),
720720 opacity_keys: Vec::new(),
721721 color_keys: Vec::new(),
@@ -1205,7 +1205,7 @@ fn a_menu_offers_only_what_applies_and_is_drawn_inside_the_window() {
12051205 gain_db: 0.0,
12061206 gain_keys: Vec::new(),
12071207 pan: 0,
1208- pitch: 0,
1208+ pitch: 0.0,
12091209 transform_keys: Vec::new(),
12101210 opacity_keys: Vec::new(),
12111211 color_keys: Vec::new(),
@@ -2001,7 +2001,7 @@ fn a_copied_clip_is_renumbered_or_dropped_when_a_row_leaves_the_library() {
20012001 gain_db: 0.0,
20022002 gain_keys: Vec::new(),
20032003 pan: 0,
2004- pitch: 0,
2004+ pitch: 0.0,
20052005 transform_keys: Vec::new(),
20062006 opacity_keys: Vec::new(),
20072007 color_keys: Vec::new(),
@@ -2373,7 +2373,7 @@ fn trim_to_playhead_needs_a_subject_cut_with_the_playhead_on_it() {
23732373 gain_db: 0.0,
23742374 gain_keys: Vec::new(),
23752375 pan: 0,
2376- pitch: 0,
2376+ pitch: 0.0,
23772377 transform_keys: Vec::new(),
23782378 opacity_keys: Vec::new(),
23792379 color_keys: Vec::new(),
crates/app/src/tests/layout.rsmodified+1 -1
@@ -742,7 +742,7 @@ fn a_drop_moves_the_clip_that_was_picked_up_not_its_old_index() {
742742 gain_db: 0.0,
743743 gain_keys: Vec::new(),
744744 pan: 0,
745- pitch: 0,
745+ pitch: 0.0,
746746 transform_keys: Vec::new(),
747747 opacity_keys: Vec::new(),
748748 color_keys: Vec::new(),
crates/app/src/tests/menu_wire.rsmodified+1 -1
@@ -26,7 +26,7 @@ fn clip() -> Clip {
2626 gain_db: 0.0,
2727 gain_keys: Vec::new(),
2828 pan: 0,
29- pitch: 0,
29+ pitch: 0.0,
3030 transform_keys: Vec::new(),
3131 opacity_keys: Vec::new(),
3232 color_keys: Vec::new(),
crates/app/src/tests/view.rsmodified+1 -1
@@ -224,7 +224,7 @@ fn the_marks_are_every_lane_the_playhead_and_the_start() {
224224 gain_db: 0.0,
225225 gain_keys: Vec::new(),
226226 pan: 0,
227- pitch: 0,
227+ pitch: 0.0,
228228 transform_keys: Vec::new(),
229229 opacity_keys: Vec::new(),
230230 color_keys: Vec::new(),
crates/app/src/timeline_math.rsmodified+1 -1
@@ -1108,7 +1108,7 @@ mod drop_landing_tests {
11081108 gain_db: 0.0,
11091109 gain_keys: Vec::new(),
11101110 pan: 0,
1111- pitch: 0,
1111+ pitch: 0.0,
11121112 transform_keys: Vec::new(),
11131113 opacity_keys: Vec::new(),
11141114 color_keys: Vec::new(),
crates/app/src/ui/cards/mix.rsmodified+9 -8
@@ -17,10 +17,11 @@ use crate::*;
1717 /// What the dynamics section has switched on, in plain words and kept short: one line
1818 /// under the section, so it never wraps into the rows below.
1919 /// A clip's pitch as the row reads it: `0 semitones`, `+3 semitones`, `-12 semitones`.
20-fn pitch_text(semitones: i32) -> String {
21- match semitones {
22- 0 => "0 semitones".into(),
23- n => format!("{n:+} semitones"),
20+fn pitch_text(semitones: f32) -> String {
21+ if semitones == 0.0 {
22+ "0 semitones".into()
23+ } else {
24+ format!("{semitones:+} semitones")
2425 }
2526 }
2627
@@ -372,9 +373,9 @@ impl Player {
372373 let t = tokens();
373374 let semis = target
374375 .and_then(|(lane, idx)| self.session.as_ref()?.clip_pitch_of(lane, idx))
375- .unwrap_or(0);
376- let value = pitch_text(i32::from(semis));
377- let changed = semis != 0;
376+ .unwrap_or(0.0);
377+ let value = pitch_text(semis);
378+ let changed = semis != 0.0;
378379 let bar = self.mix_panel.borrow().pitch_bar.clone();
379380 let me = cx.entity();
380381 let typed = target.map(|(lane, idx)| SliderTyped {
@@ -409,7 +410,7 @@ impl Player {
409410 );
410411 let track = centred_track(
411412 "mix-clip-pitch",
412- (f32::from(semis) + 12.) / 24.,
413+ (semis + 12.) / 24.,
413414 bar,
414415 move |this: &mut Player, x: Pixels, cx: &mut Context<Player>| {
415416 if let Some((lane, idx)) = target {
crates/engine/examples/bench.rsmodified+1 -1
@@ -900,7 +900,7 @@ fn export_bench(path: &Path, seat: &str, out_dir: &Path) {
900900 fit: engine::scale::FitPolicy::default(),
901901 speed: Speed::NORMAL,
902902 transform: None,
903- pitch: 0,
903+ pitch: 0.0,
904904 };
905905 // The sound, where it was asked for, is the same clip on an audio lane:
906906 // the very window the picture covers, so the two passes measure one export.
crates/engine/src/audio.rsmodified+1 -1
@@ -5576,7 +5576,7 @@ mod tests {
55765576 fit: FitPolicy::default(),
55775577 speed: Speed::NORMAL,
55785578 transform: None,
5579- pitch: 0,
5579+ pitch: 0.0,
55805580 };
55815581 // One second of the mono source, then one second of the stereo one.
55825582 let project = Project::from_parts(
crates/engine/src/beats.rsmodified+1 -1
@@ -446,7 +446,7 @@ mod tests {
446446 transform: None,
447447 fit: FitPolicy::default(),
448448 speed: Speed::default(),
449- pitch: 0,
449+ pitch: 0.0,
450450 };
451451 // 0.5 s is source frame 62.5, rounded to 63 -> timeline 113; 1.0 s is 75 -> 125.
452452 // 20 s is past the clip's end and is dropped.
crates/engine/src/edith.rsmodified+35 -25
@@ -248,9 +248,11 @@
248248 //! with none is the bytes a v28 one was bar the version line.
249249 //!
250250 //! A `pitch` line is `pitch audio <ord> <index> <semitones>`: an audio clip's pitch
251-//! shift in whole semitones, `-12` to `12`, written for each clip that is not at `0`,
252-//! after the lanes it names (as `clippan` is). **Version 52** is the first dialect
253-//! with one; a project with none is the bytes a v51 one was bar the version line.
251+//! shift in semitones, `-12` to `12`, written for each clip that is not at `0`,
252+//! after the lanes it names (as `clippan` is). **Version 55** is the first dialect
253+//! with one, whole semitones only. **Version 58** allows a fraction (`0.37`), which a
254+//! pre-v58 reader would refuse; a project whose shifts are all whole keeps the header
255+//! it needed before. A project with none is the bytes a v54 one was bar the version line.
254256 //!
255257 //! The `resolution` line is the **project's** picture size, which is a
256258 //! different thing from any source's: media of other sizes are placed on it.
@@ -444,11 +446,12 @@ use crate::transform::{KeyEase, MAX_TRANSFORM_KEYS, OpacityKey, TransformKey, Tr
444446 /// The newest project format version: the `N` in the `edith N` first line that
445447 /// [`save`] writes for a project that uses the newest features. A reader refuses any
446448 /// higher version by name.
447-pub const NEWEST_VERSION: u32 = 57;
449+pub const NEWEST_VERSION: u32 = 58;
448450
449451 /// What [`save`] writes. Read support goes back to `edith 1`; see the module
450452 /// docs for what those dialects looked like. Kept at [`NEWEST_VERSION`].
451-const MAGIC: &[u8] = b"edith 57";
453+const MAGIC: &[u8] = b"edith 58";
454+const MAGIC_V57: &[u8] = b"edith 57";
452455 const MAGIC_V56: &[u8] = b"edith 56";
453456 const MAGIC_V55: &[u8] = b"edith 55";
454457 const MAGIC_V54: &[u8] = b"edith 54";
@@ -830,13 +833,17 @@ pub fn encode_flagged(
830833 // ...and one with an effect's keys is v56 (`ekeys`), as is one with a custom bezier key easing.
831834 let keyed = lanes.iter().any(|(_, clips)| clips.iter().any(|c| c.effects.iter().any(|e| !e.keys.is_empty())));
832835 // ...and one with a clip's pitch shift is v55.
833- let pitched = lanes.iter().any(|(_, clips)| clips.iter().any(|c| c.pitch != 0));
836+ let pitched = lanes.iter().any(|(_, clips)| clips.iter().any(|c| c.pitch != 0.0));
837+ // ...and one with a fractional pitch shift is v58.
838+ let fractional = lanes.iter().any(|(_, clips)| clips.iter().any(|c| c.pitch.fract() != 0.0));
834839 // ...and one with a title's own keys is v56 (`ttkeys`).
835840 let title_keyed = titles.iter().any(|t| !t.keys.is_empty());
836841 let curved = keyed || title_keyed || lanes.iter().any(|(_, clips)| clips.iter().any(has_bezier));
837842 if curved || pitched || titled || panned || styled || marked || angled || named || deinterlaced || steadied || looked || effected || voiced || captioned || animated || reversed || transitioned || ramped || !chapters.is_empty() || !markers.is_empty() {
838843 let first_end = bytes.iter().position(|&b| b == b'\n').unwrap_or(bytes.len());
839- let header = if curved {
844+ let header = if fractional {
845+ MAGIC
846+ } else if curved {
840847 MAGIC_V56
841848 } else if pitched {
842849 MAGIC_V55
@@ -971,7 +978,7 @@ pub fn noted(mut main: Vec<u8>, notes: &str, still_secs: f64, speech_model: Opti
971978 return main;
972979 }
973980 let first_end = main.iter().position(|&b| b == b'\n').unwrap_or(main.len());
974- let header = raise_header(&main[..first_end], if speech { MAGIC } else { MAGIC_V52 });
981+ let header = raise_header(&main[..first_end], if speech { MAGIC_V57 } else { MAGIC_V52 });
975982 main.splice(..first_end, header);
976983 if main.last() != Some(&b'\n') {
977984 main.push(b'\n');
@@ -1064,7 +1071,8 @@ pub fn sequenced(main: Vec<u8>, active: (u32, &str), order: &[u32], blocks: &[Se
10641071 // v47 only when something in the file needs it (a multicam source or an angle somewhere), v46
10651072 // when a part is v46; a newer-only line under an older header is refused.
10661073 let is = |b: &[u8], m: &[u8]| b.starts_with(m) && b.get(m.len()) == Some(&b'\n');
1067- let v57 = is(&bytes, MAGIC) || blocks.iter().any(|b| is(&b.bytes, MAGIC));
1074+ let v58 = is(&bytes, MAGIC) || blocks.iter().any(|b| is(&b.bytes, MAGIC));
1075+ let v57 = v58 || is(&bytes, MAGIC_V57) || blocks.iter().any(|b| is(&b.bytes, MAGIC_V57));
10681076 let v56 = v57 || is(&bytes, MAGIC_V56) || blocks.iter().any(|b| is(&b.bytes, MAGIC_V56));
10691077 let v55 = v56 || is(&bytes, MAGIC_V55) || blocks.iter().any(|b| is(&b.bytes, MAGIC_V55));
10701078 let v54 = v55 || is(&bytes, MAGIC_V54) || blocks.iter().any(|b| is(&b.bytes, MAGIC_V54));
@@ -1076,7 +1084,7 @@ pub fn sequenced(main: Vec<u8>, active: (u32, &str), order: &[u32], blocks: &[Se
10761084 let v48 = v49 || is(&bytes, MAGIC_V48) || blocks.iter().any(|b| is(&b.bytes, MAGIC_V48));
10771085 let v47 = !mcam.is_empty() || is(&bytes, MAGIC_V47) || blocks.iter().any(|b| is(&b.bytes, MAGIC_V47));
10781086 let v46 = is(&bytes, MAGIC_V46) || blocks.iter().any(|b| is(&b.bytes, MAGIC_V46));
1079- let header = if v57 { MAGIC } else if v56 { MAGIC_V56 } else if v55 { MAGIC_V55 } else if v54 { MAGIC_V54 } else if v53 { MAGIC_V53 } else if v52 { MAGIC_V52 } else if v51 { MAGIC_V51 } else if v50 { MAGIC_V50 } else if v49 { MAGIC_V49 } else if v48 { MAGIC_V48 } else if v47 { MAGIC_V47 } else if v46 { MAGIC_V46 } else { MAGIC_V45 };
1087+ let header = if v58 { MAGIC } else if v57 { MAGIC_V57 } else if v56 { MAGIC_V56 } else if v55 { MAGIC_V55 } else if v54 { MAGIC_V54 } else if v53 { MAGIC_V53 } else if v52 { MAGIC_V52 } else if v51 { MAGIC_V51 } else if v50 { MAGIC_V50 } else if v49 { MAGIC_V49 } else if v48 { MAGIC_V48 } else if v47 { MAGIC_V47 } else if v46 { MAGIC_V46 } else { MAGIC_V45 };
10801088 bytes.splice(..first_end, header.iter().copied());
10811089 bytes.extend_from_slice(format!("seqactive {} ", active.0).as_bytes());
10821090 escape_text(active.1, &mut bytes);
@@ -1316,7 +1324,7 @@ fn pitch_lines(lanes: &[(LaneKind, Vec<Clip>)]) -> Vec<u8> {
13161324 }
13171325 audio += 1;
13181326 for (idx, c) in clips.iter().enumerate() {
1319- if c.pitch != 0 {
1327+ if c.pitch != 0.0 {
13201328 out.extend_from_slice(format!("pitch audio {audio} {idx} {}\n", c.pitch).as_bytes());
13211329 }
13221330 }
@@ -2313,7 +2321,8 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
23132321 // The one that carries a clip's placement animation, as `tkeys` lines...
23142322 // The one that carries a clip's stabilisation, as `stab` lines...
23152323 // The one that carries a clip's pitch shift, as `pitch` lines...
2316- let v57 = first == MAGIC;
2324+ let v58 = first == MAGIC;
2325+ let v57 = v58 || first == MAGIC_V57;
23172326 let v56 = v57 || first == MAGIC_V56;
23182327 let v55 = v56 || first == MAGIC_V55;
23192328 let v54 = v55 || first == MAGIC_V54;
@@ -2797,9 +2806,9 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
27972806 .map(|(at, _)| at)
27982807 .ok_or_else(|| format!("line {n}: pitch names a lane that is not there"))?;
27992808 let idx = number(f[2], n)? as usize;
2800- let semitones = std::str::from_utf8(f[3]).ok().and_then(|s| s.parse::<i8>().ok());
2809+ let semitones = std::str::from_utf8(f[3]).ok().and_then(|s| s.parse::<f32>().ok());
28012810 let semitones = match semitones {
2802- Some(v) if (crate::project::MIN_CLIP_PITCH..=crate::project::MAX_CLIP_PITCH).contains(&v) => v,
2811+ Some(v) if (crate::project::MIN_CLIP_PITCH..=crate::project::MAX_CLIP_PITCH).contains(&v) && (v58 || v.fract() == 0.0) => v,
28032812 _ => return Err(format!("line {n}: pitch has a number out of its range").into()),
28042813 };
28052814 doc.lanes[at]
@@ -4060,7 +4069,7 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
40604069 transform: None,
40614070 fit: FitPolicy::default(),
40624071 speed: Speed::NORMAL,
4063- pitch: 0,
4072+ pitch: 0.0,
40644073 },
40654074 &doc,
40664075 n,
@@ -4258,7 +4267,7 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result<Document> {
42584267 )?,
42594268 fit: fit_policy(f.get(7).copied(), n)?,
42604269 speed,
4261- pitch: 0,
4270+ pitch: 0.0,
42624271 },
42634272 &doc,
42644273 n,
@@ -5533,7 +5542,7 @@ mod tests {
55335542 transform: None,
55345543 fit: FitPolicy::default(),
55355544 speed: Speed::NORMAL,
5536- pitch: 0,
5545+ pitch: 0.0,
55375546 }
55385547 }
55395548
@@ -5998,7 +6007,7 @@ mod tests {
59986007 transform: None,
59996008 fit: FitPolicy::default(),
60006009 speed: Speed::from_permille(permille),
6001- pitch: 0,
6010+ pitch: 0.0,
60026011 };
60036012 // 30 source frames at 2x is 15 timeline frames, which is where the
60046013 // second clip starts -- the file writes the source range and the rate,
@@ -6100,7 +6109,7 @@ mod tests {
61006109 transform: None,
61016110 fit: FitPolicy::default(),
61026111 speed: Speed::NORMAL,
6103- pitch: 0,
6112+ pitch: 0.0,
61046113 };
61056114 let lanes = vec![(LaneKind::Video, vec![faded])];
61066115 let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0);
@@ -6169,7 +6178,7 @@ mod tests {
61696178 transform: None,
61706179 fit: FitPolicy::default(),
61716180 speed: Speed::NORMAL,
6172- pitch: 0,
6181+ pitch: 0.0,
61736182 };
61746183 let lanes = vec![(LaneKind::Video, vec![dissolving])];
61756184 let bytes = emit(&dir, &sources, &lanes, &[], &[], (1280, 720), 0);
@@ -7184,13 +7193,13 @@ mod tests {
71847193 assert!(!before.contains("pitch"), "{before}");
71857194 assert!(!before.starts_with("edith 55"), "{before}");
71867195 let mut lanes = plain.clone();
7187- lanes[1].1[1].pitch = -7;
7196+ lanes[1].1[1].pitch = -7.0;
71887197 let text = save(&lanes);
71897198 assert!(text.starts_with("edith 55\n"), "{text}");
71907199 assert!(text.contains("\npitch audio 1 1 -7\n"), "{text}");
71917200 let back = load(&path).expect("v55 loads");
7192- assert_eq!(back.lanes[1].1[1].pitch, -7);
7193- assert_eq!(back.lanes[1].1[0].pitch, 0);
7201+ assert_eq!(back.lanes[1].1[1].pitch, -7.0);
7202+ assert_eq!(back.lanes[1].1[0].pitch, 0.0);
71947203 assert_eq!(save(&back.lanes), text, "saved again: the same bytes");
71957204 let dirp = PathBuf::from("/proj");
71967205 let head = "edith 55\nplayhead 0\nresolution 1280 720\nsource 0 a.mp4\n\
@@ -8052,7 +8061,7 @@ mod clip_gain_tests {
80528061 visualizer: 0,
80538062 viz_paint: 0,
80548063 gain_db,
8055- pitch: 0,
8064+ pitch: 0.0,
80568065 };
80578066 let lanes = vec![
80588067 (LaneKind::Video, vec![clip(0.0)]),
@@ -8423,11 +8432,12 @@ mod gain_key_tests {
84238432 let err = parse(v34.as_bytes(), &dir).unwrap_err().to_string();
84248433 assert!(err.contains("speedkeys"), "{err}");
84258434 let head = format!("edith 35\n{HEAD}");
8435+ let too_many: String = (0..65).map(|i| format!(" {i}:1000")).collect();
84268436 for line in [
8437+ &format!("speedkeys audio 1 0{too_many}\n")[..],
84278438 "speedkeys audio 1 0 0:9000\n",
84288439 "speedkeys audio 1 0 30:1000 0:1000\n",
84298440 "speedkeys audio 1 0 0\n",
8430- "speedkeys audio 1 0 0:1000 1:1000 2:1000 3:1000 4:1000 5:1000 6:1000 7:1000 8:1000\n",
84318441 ] {
84328442 let err = parse(format!("{head}{line}").as_bytes(), &dir).unwrap_err().to_string();
84338443 assert!(err.contains("line 6"), "{line}: {err}");
crates/engine/src/export.rsmodified+20 -11
@@ -583,6 +583,8 @@ pub struct ExportSettings {
583583 /// it used to. Means nothing to WAV and FLAC, which code no rate, and
584584 /// nothing to a *copied* AAC track, which carries its source's.
585585 pub audio_kbps: Option<u32>,
586+ /// Code the sound at [`ExportSettings::audio_kbps`] even where its packets could be copied.
587+ pub reencode_audio: bool,
586588 /// Bits per sample of the PCM sound in a ProRes `.mov`: 16 or 24. `None` (and
587589 /// anything else) is 24. No other format reads it.
588590 pub audio_bit_depth: Option<u8>,
@@ -1453,6 +1455,7 @@ fn audio_label(
14531455 sound: bool,
14541456 copied: Option<bool>,
14551457 ranged: bool,
1458+ reencode: bool,
14561459 ) -> &'static str {
14571460 if !sound {
14581461 return "no sound to write";
@@ -1467,7 +1470,7 @@ fn audio_label(
14671470 // Never a copy: WebM carries Opus, and the sound is mixed and encoded
14681471 // for it at 48 kHz ([`start`], [`encode_audio`]).
14691472 Format::Webm => "Opus · SW encode (ec-opus)",
1470- _ => match copied.unwrap_or(!forces_encode(project, ranged)) {
1473+ _ => match copied.unwrap_or(!(reencode || forces_encode(project, ranged))) {
14711474 true => "AAC copy",
14721475 // A Matroska file gets Opus where the mix allows it -- 48 kHz and
14731476 // stereo, which is every Opus source and most of everything else --
@@ -1511,7 +1514,7 @@ fn measured_audio_label(
15111514 (Some(false), false) if format.is_mkv() => "AAC · SW encode (ec-aac)",
15121515 // `sound` is already what happened, not a prediction, so `copied` is
15131516 // filled in and `ranged` never reaches the branch that reads it.
1514- _ => audio_label(project, format, sound.is_some(), sound, false),
1517+ _ => audio_label(project, format, sound.is_some(), sound, false, false),
15151518 }
15161519 }
15171520
@@ -1521,7 +1524,7 @@ fn measured_audio_label(
15211524 /// a marked range -- a copy needs the source's own packets to *be* the file,
15221525 /// which a range's exact offset and length rule out ([`copy_audio`]).
15231526 pub fn planned_audio(project: &Project, format: Format, ranged: bool) -> &'static str {
1524- audio_label(project, format, has_sound(project), None, ranged)
1527+ audio_label(project, format, has_sound(project), None, ranged, false)
15251528 }
15261529
15271530 /// Why the sound's rate is nothing this timeline can be asked about in this
@@ -1533,7 +1536,7 @@ pub fn planned_audio(project: &Project, format: Format, ranged: bool) -> &'stati
15331536 /// [`ExportSettings::audio_kbps`] like every other encode. So the value travels
15341537 /// even where this refuses; what it cannot do is silently write a rate nobody
15351538 /// picked.
1536-pub fn audio_rate_refusal(project: &Project, format: Format, ranged: bool) -> Option<&'static str> {
1539+pub fn audio_rate_refusal(project: &Project, format: Format, ranged: bool, reencode: bool) -> Option<&'static str> {
15371540 match format {
15381541 _ if !has_sound(project) => Some("no sound to write"),
15391542 Format::Wav | Format::Flac | Format::ProRes => Some("lossless — the samples themselves, at no rate"),
@@ -1546,7 +1549,7 @@ pub fn audio_rate_refusal(project: &Project, format: Format, ranged: bool) -> Op
15461549 Format::Ogg => Some("quality-coded — Vorbis holds no rate to pick"),
15471550 // The bitrate is the one choice WebM leaves: Opus at the rate picked.
15481551 Format::Mp3 | Format::Webm | Format::Opus => None,
1549- _ if forces_encode(project, ranged) => None,
1552+ _ if reencode || forces_encode(project, ranged) => None,
15501553 _ => Some("the source's own packets are copied — at the rate they hold"),
15511554 }
15521555 }
@@ -1951,7 +1954,7 @@ fn export_spans(project: &Project, range: Option<(u32, u32)>) -> Vec<crate::proj
19511954 from: None,
19521955 speed: Speed::NORMAL,
19531956 reverse: false,
1954- pitch: 0,
1957+ pitch: 0.0,
19551958 });
19561959 }
19571960 let Some((r_start, r_end)) = range else {
@@ -2091,7 +2094,7 @@ pub(crate) fn stack_span_at(project: &Project, frame: u32) -> Option<crate::proj
20912094 speed,
20922095 ramp,
20932096 reverse,
2094- pitch: 0,
2097+ pitch: 0.0,
20952098 })
20962099 }
20972100
@@ -3629,7 +3632,8 @@ pub fn planned_seats(
36293632 // reads, so this costs nothing beyond what is already open. A standalone
36303633 // audio file (mp3, wav, flac...) has no sample table either: its sound is
36313634 // decoded and encoded again, as [`copy_multi_streams`] refusing it sends it.
3632- let copyable = !forces_encode(project, settings.range.is_some())
3635+ let copyable = !settings.reencode_audio
3636+ && !forces_encode(project, settings.range.is_some())
36333637 && !project.sources().iter().any(|source|
36343638 {
36353639 crate::demux::is_matroska(&source.path)
@@ -3656,6 +3660,7 @@ pub fn planned_seats(
36563660 has_sound(project),
36573661 Some(copyable),
36583662 settings.range.is_some(),
3663+ settings.reencode_audio,
36593664 ),
36603665 };
36613666 (video, sound)
@@ -3803,13 +3808,14 @@ fn copy_audio(
38033808 kbps: u32,
38043809 mkv: bool,
38053810 webm: bool,
3811+ reencode: bool,
38063812 shared: &Shared,
38073813 sample_rate: Option<u32>,
38083814 range: Option<(u32, u32)>,
38093815 ) -> crate::Result<Option<ExportAudio>> {
38103816 // WebM's sound is Opus, which no source's packets are: always the mix. A loudness target is a
3811- // gain over the mix, which a copied packet cannot carry.
3812- if webm || shared.loudness.is_some() {
3817+ // gain over the mix, which a copied packet cannot carry. A rate the caller chose is a re-encode.
3818+ if webm || reencode || shared.loudness.is_some() {
38133819 return encode_audio(project, meta, kbps, mkv, webm, shared, sample_rate, range);
38143820 }
38153821 // A ranged export needs an exact offset and an exact length, which a
@@ -5244,6 +5250,7 @@ fn run(
52445250 audio_kbps_of(&settings),
52455251 settings.format.is_mkv(),
52465252 settings.format == Format::Webm,
5253+ settings.reencode_audio,
52475254 &shared,
52485255 // WebM's sound is mixed at the rate Opus codes at, so the
52495256 // one encoder path it takes is the one that resamples.
@@ -7514,7 +7521,7 @@ fn mix_pcm(
75147521 // publishes its own.
75157522 if !format.has_video() {
75167523 *shared.encoders.lock().unwrap() =
7517- Some(audio_label(project, format, true, None, settings.range.is_some()).to_string());
7524+ Some(audio_label(project, format, true, None, settings.range.is_some(), settings.reencode_audio).to_string());
75187525 }
75197526 let channels = usize::from(audio.channels);
75207527 let out_frames = settings.range.map_or(project.media_frames(), |(s, e)| {
@@ -7594,6 +7601,7 @@ fn run_aac(
75947601 audio_kbps_of(settings),
75957602 false,
75967603 false,
7604+ settings.reencode_audio,
75977605 shared,
75987606 sample_rate,
75997607 settings.range,
@@ -7610,6 +7618,7 @@ fn run_aac(
76107618 true,
76117619 Some(track.copied),
76127620 settings.range.is_some(),
7621+ settings.reencode_audio,
76137622 )
76147623 .to_string(),
76157624 );
crates/engine/src/playback.rsmodified+8 -7
@@ -1185,7 +1185,7 @@ impl PlaybackSession {
11851185 transform: None,
11861186 fit: FitPolicy::default(),
11871187 speed: Speed::NORMAL,
1188- pitch: 0,
1188+ pitch: 0.0,
11891189 };
11901190 let project = Project::from_parts(
11911191 vec![Source::new(path, 0)],
@@ -1311,7 +1311,7 @@ impl PlaybackSession {
13111311 transform: None,
13121312 fit: FitPolicy::default(),
13131313 speed: Speed::NORMAL,
1314- pitch: 0,
1314+ pitch: 0.0,
13151315 };
13161316 // No group and no audio clip: a still is silent, and a clip on `A1`
13171317 // playing from a PNG is a source the audio worker cannot open.
@@ -2002,8 +2002,9 @@ impl PlaybackSession {
20022002 &self,
20032003 format: crate::export::Format,
20042004 ranged: bool,
2005+ reencode: bool,
20052006 ) -> Option<&'static str> {
2006- crate::export::audio_rate_refusal(&self.project.render_view(), format, ranged)
2007+ crate::export::audio_rate_refusal(&self.project.render_view(), format, ranged, reencode)
20072008 }
20082009
20092010 /// Why this session plays silent although the file has sound -- an audio
@@ -3985,14 +3986,14 @@ impl PlaybackSession {
39853986 }
39863987
39873988 /// The clip's pitch shift in semitones at `idx` of `lane` ([`Project::clip_pitch`]).
3988- pub fn clip_pitch_of(&self, lane: Lane, idx: usize) -> Option<i8> {
3989+ pub fn clip_pitch_of(&self, lane: Lane, idx: usize) -> Option<f32> {
39893990 self.project.clip_pitch(lane, idx)
39903991 }
39913992
39923993 /// Sets that clip's pitch in semitones, clamped to `-12..=12`. One undo step; the
39933994 /// sound is rebuilt where the playhead is, as for [`set_clip_gain`](Self::set_clip_gain).
39943995 /// `false` for a video lane, a bad index, or a value already set.
3995- pub fn set_clip_pitch(&mut self, lane: Lane, idx: usize, semitones: i32) -> bool {
3996+ pub fn set_clip_pitch(&mut self, lane: Lane, idx: usize, semitones: f32) -> bool {
39963997 self.edit(Dirty::Sound, |p| p.set_clip_pitch(lane, idx, semitones))
39973998 }
39983999
@@ -5927,7 +5928,7 @@ impl PlaybackSession {
59275928 transform: None,
59285929 fit: FitPolicy::default(),
59295930 speed: Speed::NORMAL,
5930- pitch: 0,
5931+ pitch: 0.0,
59315932 };
59325933 // Which lane a source may land on is decided here and only here, so a
59335934 // front-end never has to make the same call twice: a file with no
@@ -6255,7 +6256,7 @@ impl PlaybackSession {
62556256 transform: None,
62566257 fit: FitPolicy::default(),
62576258 speed: Speed::NORMAL,
6258- pitch: 0,
6259+ pitch: 0.0,
62596260 };
62606261 let end = start + clip.frames();
62616262 let overlaps = |lane: Lane| {
crates/engine/src/project.rsmodified+45 -45
@@ -329,7 +329,7 @@ impl Speed {
329329
330330 /// Most keys a speed ramp may hold ([`Clip::speed_keys`]). A fixed cap, so that a
331331 /// [`Span`] carrying a ramp stays `Copy`.
332-pub const MAX_SPEED_KEYS: usize = 8;
332+pub const MAX_SPEED_KEYS: usize = 64;
333333
334334 /// How long a still image is placed for when the project does not say (the 5 s every project had
335335 /// before v52), and the shortest and longest length a project may set for one.
@@ -895,12 +895,12 @@ pub struct Clip {
895895 /// gain. Audio clips only ([`Project::set_clip_pan`]); [`Clip::pan_value`] reads it as
896896 /// `-1.0..=1.0`.
897897 pub pan: i8,
898- /// The clip's pitch in whole semitones, `-12` (an octave down) to `12` (up), `0` the
898+ /// The clip's pitch in semitones, `-12.0` (an octave down) to `12.0` (up), `0.0` the
899899 /// default and the original sound. Changes the pitch and keeps the speed: the
900900 /// stretch and the resample that make it are built by [`Project::lane_speeds_from`],
901901 /// so playback and export hear the same thing. Audio clips only
902- /// ([`Project::set_clip_pitch`]). One byte, in the same padding as [`Clip::pan`].
903- pub pitch: i8,
902+ /// ([`Project::set_clip_pitch`]).
903+ pub pitch: f32,
904904 /// The clip's placement animation: whole [`TransformParams`] at SOURCE
905905 /// frames, sorted by [`TransformKey::at`] with no two alike. Empty is the
906906 /// single [`Clip::transform`] for the whole clip. Video lanes only
@@ -1080,9 +1080,9 @@ pub const MIN_CLIP_GAIN_DB: f32 = -60.0;
10801080 pub const MAX_CLIP_GAIN_DB: f32 = 24.0;
10811081
10821082 /// The widest a clip's pitch shift may be, in semitones either way ([`Clip::pitch`]).
1083-pub const MAX_CLIP_PITCH: i8 = 12;
1083+pub const MAX_CLIP_PITCH: f32 = 12.0;
10841084 /// The lowest a clip's pitch shift may be ([`Clip::pitch`]).
1085-pub const MIN_CLIP_PITCH: i8 = -12;
1085+pub const MIN_CLIP_PITCH: f32 = -12.0;
10861086 /// The most points a clip's gain envelope may hold ([`Clip::gain_keys`]).
10871087 pub const MAX_GAIN_KEYS: usize = 256;
10881088
@@ -1289,7 +1289,7 @@ impl Clip {
12891289 gain_db: 0.0,
12901290 gain_keys: Vec::new(),
12911291 pan: 0,
1292- pitch: 0,
1292+ pitch: 0.0,
12931293 }
12941294 }
12951295
@@ -2026,7 +2026,7 @@ impl<'a> SourceWalls<'a> {
20262026 /// What a lane holds over one stretch of the timeline: either a placed clip or
20272027 /// a gap. Returned already trimmed to the position it was asked about, so a
20282028 /// caller can hand `len` straight to a decoder (or to a black-frame generator).
2029-#[derive(Clone, Copy, PartialEq, Eq, Debug)]
2029+#[derive(Clone, Copy, PartialEq, Debug)]
20302030 pub struct Span {
20312031 /// Timeline frame the span starts at.
20322032 pub start: u32,
@@ -2055,8 +2055,8 @@ pub struct Span {
20552055 /// [`timeline_at`](Span::timeline_at) count distance walked, as they do forwards.
20562056 /// `false` for a gap.
20572057 pub reverse: bool,
2058- /// The pitch in semitones of the clip this came off ([`Clip::pitch`]); `0` for a gap.
2059- pub pitch: i8,
2058+ /// The pitch in semitones of the clip this came off ([`Clip::pitch`]); `0.0` for a gap.
2059+ pub pitch: f32,
20602060 }
20612061
20622062 impl Span {
@@ -2152,14 +2152,14 @@ pub struct Stretch {
21522152 /// The pitch in semitones the segment is shifted by ([`Clip::pitch`]), `0` for none.
21532153 /// The stretch then runs at `step / 2^(pitch/12)` and the resample at the same ratio
21542154 /// up: the pitch moves, the length does not.
2155- pub pitch: i8,
2155+ pub pitch: f32,
21562156 }
21572157
21582158 impl Stretch {
21592159 /// Whether the segment is only played backwards, at the rate it was recorded:
21602160 /// no change of time, so no stretch is built for it.
21612161 pub fn is_straight(&self) -> bool {
2162- self.reverse && self.step == 1.0 && self.ramp.is_none() && self.pitch == 0
2162+ self.reverse && self.step == 1.0 && self.ramp.is_none() && self.pitch == 0.0
21632163 }
21642164
21652165 /// The frequency ratio the segment's pitch shift is: `2^(pitch/12)`, `1.0` for none.
@@ -2169,7 +2169,7 @@ impl Stretch {
21692169 }
21702170
21712171 /// The frequency ratio of a shift of `semitones`: `2^(semitones/12)`, so `12` is an octave up.
2172-pub fn pitch_ratio(semitones: i8) -> f64 {
2172+pub fn pitch_ratio(semitones: f32) -> f64 {
21732173 (f64::from(semitones) / 12.0).exp2()
21742174 }
21752175
@@ -2887,7 +2887,7 @@ impl Project {
28872887 gain_db: 0.0,
28882888 gain_keys: Vec::new(),
28892889 pan: 0,
2890- pitch: 0,
2890+ pitch: 0.0,
28912891 transform_keys: Vec::new(),
28922892 opacity_keys: Vec::new(),
28932893 color_keys: Vec::new(),
@@ -3508,7 +3508,7 @@ impl Project {
35083508 gain_db: 0.0,
35093509 gain_keys: Vec::new(),
35103510 pan: 0,
3511- pitch: 0,
3511+ pitch: 0.0,
35123512 transform_keys: Vec::new(),
35133513 opacity_keys: Vec::new(),
35143514 color_keys: Vec::new(),
@@ -6021,14 +6021,14 @@ impl Project {
60216021 /// Give the clip at `idx` of `lane` this pitch in semitones, clamped to `-12..=12`.
60226022 /// One undo step. `false` -- and no history -- for an index that is not there, a
60236023 /// non-audio lane, or a value already set.
6024- pub fn set_clip_pitch(&mut self, lane: Lane, idx: usize, semitones: i32) -> bool {
6024+ pub fn set_clip_pitch(&mut self, lane: Lane, idx: usize, semitones: f32) -> bool {
60256025 if lane.kind != LaneKind::Audio {
60266026 return false;
60276027 }
60286028 let Some(current) = self.lane(lane).get(idx).map(|c| c.pitch) else {
60296029 return false;
60306030 };
6031- let semitones = semitones.clamp(i32::from(MIN_CLIP_PITCH), i32::from(MAX_CLIP_PITCH)) as i8;
6031+ let semitones = semitones.clamp(MIN_CLIP_PITCH, MAX_CLIP_PITCH);
60326032 if current == semitones {
60336033 return false;
60346034 }
@@ -6039,7 +6039,7 @@ impl Project {
60396039
60406040 /// The pitch in semitones of the clip at `idx` of `lane`, or `None` for an index that
60416041 /// is not there.
6042- pub fn clip_pitch(&self, lane: Lane, idx: usize) -> Option<i8> {
6042+ pub fn clip_pitch(&self, lane: Lane, idx: usize) -> Option<f32> {
60436043 self.lane(lane).get(idx).map(|c| c.pitch)
60446044 }
60456045
@@ -6824,7 +6824,7 @@ impl Project {
68246824 /// refused, and the caller is told how far it would have run.
68256825 pub fn set_speed_ramp(&mut self, lane: Lane, idx: usize, keys: &[SpeedKey]) -> crate::Result<()> {
68266826 if !keys.is_empty() && !valid_speed_keys(keys) {
6827- return Err("a speed ramp takes 1 to 8 keys, in strictly increasing frames".into());
6827+ return Err(format!("a speed ramp takes 1 to {MAX_SPEED_KEYS} keys, in strictly increasing frames").into());
68286828 }
68296829 let Some(members) = self.group_of(lane, idx) else {
68306830 return Err(format!("there is no clip {idx} on {}", lane.label()).into());
@@ -7575,7 +7575,7 @@ impl Project {
75757575 speed: Speed::NORMAL,
75767576 ramp: None,
75777577 reverse: false,
7578- pitch: 0,
7578+ pitch: 0.0,
75797579 // The next placement, or the end of the timeline: a gap is
75807580 // bounded by what comes after it, never by its own bookkeeping.
75817581 len: clips
@@ -7658,7 +7658,7 @@ impl Project {
76587658 speed,
76597659 ramp,
76607660 reverse,
7661- pitch: 0,
7661+ pitch: 0.0,
76627662 })
76637663 }
76647664
@@ -11034,7 +11034,7 @@ impl Project {
1103411034 Some(_) => f64::from(span.source_len()) / f64::from(span.len),
1103511035 None => span.speed.as_f64(),
1103611036 };
11037- (ramped || !span.speed.is_normal() || span.reverse || span.pitch != 0).then(|| Stretch {
11037+ (ramped || !span.speed.is_normal() || span.reverse || span.pitch != 0.0).then(|| Stretch {
1103811038 step,
1103911039 timeline_secs: f64::from(span.len) / fps,
1104011040 reverse: span.reverse,
@@ -12365,7 +12365,7 @@ mod tests {
1236512365 gain_db: 0.0,
1236612366 gain_keys: Vec::new(),
1236712367 pan: 0,
12368- pitch: 0,
12368+ pitch: 0.0,
1236912369 transform_keys: Vec::new(),
1237012370 opacity_keys: Vec::new(),
1237112371 color_keys: Vec::new(),
@@ -15089,7 +15089,7 @@ mod tests {
1508915089 len: 3,
1509015090 from: Some((0, 6)),
1509115091 speed: Speed::NORMAL,
15092- pitch: 0,
15092+ pitch: 0.0,
1509315093 })
1509415094 );
1509515095 assert_eq!(p.span_at(Lane::V1, 9), None);
@@ -15126,7 +15126,7 @@ mod tests {
1512615126 assert_eq!(std::mem::size_of::<FitPolicy>(), 1);
1512715127 assert_eq!(
1512815128 std::mem::size_of::<Clip>(),
15129- 224,
15129+ 232,
1513015130 "Clip changed size: {} bytes",
1513115131 std::mem::size_of::<Clip>()
1513215132 );
@@ -15162,7 +15162,7 @@ mod tests {
1516215162 transform: None,
1516315163 fit: FitPolicy::Fit,
1516415164 speed: Speed::NORMAL,
15165- pitch: 0,
15165+ pitch: 0.0,
1516615166 };
1516715167
1516815168 #[test]
@@ -15387,7 +15387,7 @@ mod tests {
1538715387 len: 2,
1538815388 from: None,
1538915389 speed: Speed::NORMAL,
15390- pitch: 0,
15390+ pitch: 0.0,
1539115391 })
1539215392 );
1539315393 assert_eq!(p.map(Lane::V1, 4), Some((1, 4)), "video plays on");
@@ -15409,7 +15409,7 @@ mod tests {
1540915409 len: 4,
1541015410 from: None,
1541115411 speed: Speed::NORMAL,
15412- pitch: 0,
15412+ pitch: 0.0,
1541315413 }),
1541415414 "the audio lane holds silence to the end of the picture"
1541515415 );
@@ -15509,7 +15509,7 @@ mod tests {
1550915509 len: 11,
1551015510 from: None,
1551115511 speed: Speed::NORMAL,
15512- pitch: 0,
15512+ pitch: 0.0,
1551315513 })
1551415514 );
1551515515 assert!(!p.place(Lane::V1, 0, clip(0, 7, 7, 0)), "empty clip");
@@ -16449,7 +16449,7 @@ mod tests {
1644916449 gain_db: 0.0,
1645016450 gain_keys: Vec::new(),
1645116451 pan: 0,
16452- pitch: 0,
16452+ pitch: 0.0,
1645316453 transform_keys: Vec::new(),
1645416454 opacity_keys: Vec::new(),
1645516455 color_keys: Vec::new(),
@@ -17972,13 +17972,13 @@ mod tests {
1797217972 /// (the visualizer `u64` and six `Vec`s, the volume, placement, speed
1797317973 /// ramp, opacity and colour keys and the effects stack, are the wide fields; the placement keys raised it from 96 by one
1797417974 /// `Vec`, the speed ramp raised it from 120 by another, the opacity and
17975- /// colour keys took it from 144 to 192, and the effects stack to 216, the multicam angle to 224). The
17975+ /// colour keys took it from 144 to 192, and the effects stack to 216, the multicam angle to 224, the fractional pitch to 232). The
1797617976 /// bound is `<=` rather than `==` so a field that shrinks the clip does not
1797717977 /// trip it; growing past it is the thing to notice.
1797817978 #[test]
17979- fn a_clip_stays_within_224_bytes() {
17979+ fn a_clip_stays_within_232_bytes() {
1798017980 assert!(
17981- std::mem::size_of::<Clip>() <= 224,
17981+ std::mem::size_of::<Clip>() <= 232,
1798217982 "Clip grew to {} bytes -- every undo snapshot and clone pays for it",
1798317983 std::mem::size_of::<Clip>()
1798417984 );
@@ -18210,7 +18210,7 @@ mod tests {
1821018210 gain_db: 0.0,
1821118211 gain_keys: Vec::new(),
1821218212 pan: 0,
18213- pitch: 0,
18213+ pitch: 0.0,
1821418214 transform_keys: Vec::new(),
1821518215 opacity_keys: Vec::new(),
1821618216 color_keys: Vec::new(),
@@ -18797,7 +18797,7 @@ mod tests {
1879718797 len: 4,
1879818798 from: None,
1879918799 speed: Speed::NORMAL,
18800- pitch: 0,
18800+ pitch: 0.0,
1880118801 })
1880218802 );
1880318803 // Every lane still covers the whole timeline, gaps included.
@@ -19296,7 +19296,7 @@ mod tests {
1929619296 gain_db: 0.0,
1929719297 gain_keys: Vec::new(),
1929819298 pan: 0,
19299- pitch: 0,
19299+ pitch: 0.0,
1930019300 transform_keys: Vec::new(),
1930119301 opacity_keys: Vec::new(),
1930219302 color_keys: Vec::new(),
@@ -19480,7 +19480,7 @@ mod tests {
1948019480 len: 10,
1948119481 from: Some((0, 0)),
1948219482 speed: Speed::NORMAL,
19483- pitch: 0,
19483+ pitch: 0.0,
1948419484 },
1948519485 Span {
1948619486 reverse: false,
@@ -19489,7 +19489,7 @@ mod tests {
1948919489 len: 10,
1949019490 from: Some((1, 5)),
1949119491 speed: Speed::NORMAL,
19492- pitch: 0,
19492+ pitch: 0.0,
1949319493 },
1949419494 Span {
1949519495 reverse: false,
@@ -19498,7 +19498,7 @@ mod tests {
1949819498 len: 10,
1949919499 from: Some((0, 20)),
1950019500 speed: Speed::NORMAL,
19501- pitch: 0,
19501+ pitch: 0.0,
1950219502 },
1950319503 ],
1950419504 "V2 takes over for its own span and hands V1 back"
@@ -19513,7 +19513,7 @@ mod tests {
1951319513 len: 5,
1951419514 from: Some((1, 10)),
1951519515 speed: Speed::NORMAL,
19516- pitch: 0,
19516+ pitch: 0.0,
1951719517 })
1951819518 );
1951919519 assert_eq!(p.composite_span_at(30), None, "past the end");
@@ -19538,7 +19538,7 @@ mod tests {
1953819538 len: 5,
1953919539 from: Some((0, 0)),
1954019540 speed: Speed::NORMAL,
19541- pitch: 0,
19541+ pitch: 0.0,
1954219542 },
1954319543 Span {
1954419544 reverse: false,
@@ -19547,7 +19547,7 @@ mod tests {
1954719547 len: 5,
1954819548 from: None,
1954919549 speed: Speed::NORMAL,
19550- pitch: 0,
19550+ pitch: 0.0,
1955119551 },
1955219552 Span {
1955319553 reverse: false,
@@ -19556,7 +19556,7 @@ mod tests {
1955619556 len: 10,
1955719557 from: Some((1, 0)),
1955819558 speed: Speed::NORMAL,
19559- pitch: 0,
19559+ pitch: 0.0,
1956019560 },
1956119561 Span {
1956219562 reverse: false,
@@ -19565,7 +19565,7 @@ mod tests {
1956519565 len: 10,
1956619566 from: None,
1956719567 speed: Speed::NORMAL,
19568- pitch: 0,
19568+ pitch: 0.0,
1956919569 },
1957019570 ]
1957119571 );
@@ -20702,7 +20702,7 @@ mod pro_trim_tests {
2070220702 gain_db: 0.0,
2070320703 gain_keys: Vec::new(),
2070420704 pan: 0,
20705- pitch: 0,
20705+ pitch: 0.0,
2070620706 transform_keys: Vec::new(),
2070720707 start,
2070820708 in_frame,
crates/engine/src/proxy.rsmodified+1 -1
@@ -606,7 +606,7 @@ fn started(
606606 transform: None,
607607 fit: FitPolicy::default(),
608608 speed: Speed::NORMAL,
609- pitch: 0,
609+ pitch: 0.0,
610610 };
611611 let project = Project::from_parts(
612612 vec![Source::new(source, 0)],
crates/engine/src/silence.rsmodified+1 -1
@@ -338,7 +338,7 @@ mod tests {
338338 transform: None,
339339 fit: FitPolicy::default(),
340340 speed,
341- pitch: 0,
341+ pitch: 0.0,
342342 }
343343 }
344344
crates/engine/src/sweep.rsmodified+1 -1
@@ -93,7 +93,7 @@ fn clip(start: u32, in_frame: u32, out_frame: u32) -> Clip {
9393 transform: None,
9494 fit: FitPolicy::Fit,
9595 speed: Speed::NORMAL,
96- pitch: 0,
96+ pitch: 0.0,
9797 }
9898 }
9999
crates/engine/src/text.rsmodified+21 -9
@@ -183,9 +183,11 @@ fn family_k(font: &FontRef<'_>, data: &[u8], index: u32) -> f32 {
183183
184184 /// The system face `name` names, or None when the system has no such family or its face does not
185185 /// parse. Each name is looked up once; the database is read on first use. A face's bytes live for
186-/// the rest of the process, as the bundled faces do.
186+/// the rest of the process, as the bundled faces do. Faces in the `EDITH_FONTS_DIR` directories win
187+/// over system faces of the same family.
187188 pub(crate) fn family_face(name: &str) -> Option<Family> {
188189 static DB: OnceLock<fontdb::Database> = OnceLock::new();
190+ static ENV_DB: OnceLock<fontdb::Database> = OnceLock::new();
189191 static FOUND: Mutex<BTreeMap<String, Option<Family>>> = Mutex::new(BTreeMap::new());
190192 let mut found = FOUND.lock().ok()?;
191193 if let Some(known) = found.get(name) {
@@ -196,16 +198,26 @@ pub(crate) fn family_face(name: &str) -> Option<Family> {
196198 db.load_system_fonts();
197199 db
198200 });
201+ let env_db = ENV_DB.get_or_init(|| {
202+ let mut db = fontdb::Database::new();
203+ for dir in crate::envcfg::var("EDITH_FONTS_DIR").unwrap_or_default().split(':').filter(|dir| !dir.is_empty()) {
204+ db.load_fonts_dir(dir);
205+ }
206+ db
207+ });
199208 let query = fontdb::Query { families: &[fontdb::Family::Name(name)], ..fontdb::Query::default() };
200- let family = db.query(&query).and_then(|id| {
201- db.with_face_data(id, |data, index| {
202- let data: &'static [u8] = Box::leak(data.to_vec().into_boxed_slice());
203- let font = FontRef::try_from_slice_and_index(data, index).ok()?;
204- let k = family_k(&font, data, index);
205- Some(Family { font: Box::leak(Box::new(font)), k })
209+ let face = |db: &fontdb::Database| {
210+ db.query(&query).and_then(|id| {
211+ db.with_face_data(id, |data, index| {
212+ let data: &'static [u8] = Box::leak(data.to_vec().into_boxed_slice());
213+ let font = FontRef::try_from_slice_and_index(data, index).ok()?;
214+ let k = family_k(&font, data, index);
215+ Some(Family { font: Box::leak(Box::new(font)), k })
216+ })
217+ .flatten()
206218 })
207- .flatten()
208- });
219+ };
220+ let family = face(env_db).or_else(|| face(db));
209221 found.insert(name.to_string(), family);
210222 family
211223 }
crates/engine/tests/audio_mix_rates.rsmodified+1 -1
@@ -175,7 +175,7 @@ fn clip(start: u32, frames: u32, source: usize) -> Clip {
175175 gain_db: 0.0,
176176 gain_keys: Vec::new(),
177177 pan: 0,
178- pitch: 0,
178+ pitch: 0.0,
179179 transform_keys: Vec::new(),
180180 opacity_keys: Vec::new(),
181181 color_keys: Vec::new(),
crates/engine/tests/export.rsmodified+4 -4
@@ -276,7 +276,7 @@ fn exports_at_the_project_resolution_with_the_watched_geometry() {
276276 gain_db: 0.0,
277277 gain_keys: Vec::new(),
278278 pan: 0,
279- pitch: 0,
279+ pitch: 0.0,
280280 transform_keys: Vec::new(),
281281 opacity_keys: Vec::new(),
282282 color_keys: Vec::new(),
@@ -385,7 +385,7 @@ fn exports_the_audio_stream_the_timeline_plays() {
385385 gain_db: 0.0,
386386 gain_keys: Vec::new(),
387387 pan: 0,
388- pitch: 0,
388+ pitch: 0.0,
389389 transform_keys: Vec::new(),
390390 opacity_keys: Vec::new(),
391391 color_keys: Vec::new(),
@@ -2102,7 +2102,7 @@ fn one_source_clip(source: &Path, fade_in: u32, out_frame: u32) -> (Project, eng
21022102 gain_db: 0.0,
21032103 gain_keys: Vec::new(),
21042104 pan: 0,
2105- pitch: 0,
2105+ pitch: 0.0,
21062106 transform_keys: Vec::new(),
21072107 opacity_keys: Vec::new(),
21082108 color_keys: Vec::new(),
@@ -2248,7 +2248,7 @@ fn two_clip_edit(source: &Path, first: u32, second: u32) -> (Project, engine::Vi
22482248 gain_db: 0.0,
22492249 gain_keys: Vec::new(),
22502250 pan: 0,
2251- pitch: 0,
2251+ pitch: 0.0,
22522252 transform_keys: Vec::new(),
22532253 opacity_keys: Vec::new(),
22542254 color_keys: Vec::new(),
crates/engine/tests/it/audio_export.rsmodified+12 -12
@@ -74,7 +74,7 @@ fn mixed_project() -> Project {
7474 gain_db: 0.0,
7575 gain_keys: Vec::new(),
7676 pan: 0,
77- pitch: 0,
77+ pitch: 0.0,
7878 transform_keys: Vec::new(),
7979 opacity_keys: Vec::new(),
8080 color_keys: Vec::new(),
@@ -115,7 +115,7 @@ fn mixed_project() -> Project {
115115 gain_db: 0.0,
116116 gain_keys: Vec::new(),
117117 pan: 0,
118- pitch: 0,
118+ pitch: 0.0,
119119 transform_keys: Vec::new(),
120120 opacity_keys: Vec::new(),
121121 color_keys: Vec::new(),
@@ -484,7 +484,7 @@ fn a_still_and_a_song_export_as_an_mp4_with_sound() {
484484 gain_db: 0.0,
485485 gain_keys: Vec::new(),
486486 pan: 0,
487- pitch: 0,
487+ pitch: 0.0,
488488 transform_keys: Vec::new(),
489489 opacity_keys: Vec::new(),
490490 color_keys: Vec::new(),
@@ -575,7 +575,7 @@ fn a_fader_is_one_tracks_own_and_the_limiter_holds_the_sum() {
575575 gain_db: 0.0,
576576 gain_keys: Vec::new(),
577577 pan: 0,
578- pitch: 0,
578+ pitch: 0.0,
579579 transform_keys: Vec::new(),
580580 opacity_keys: Vec::new(),
581581 color_keys: Vec::new(),
@@ -829,7 +829,7 @@ fn the_sound_is_written_at_the_rate_that_was_asked_for() {
829829 gain_db: 0.0,
830830 gain_keys: Vec::new(),
831831 pan: 0,
832- pitch: 0,
832+ pitch: 0.0,
833833 transform_keys: Vec::new(),
834834 opacity_keys: Vec::new(),
835835 color_keys: Vec::new(),
@@ -862,7 +862,7 @@ fn the_sound_is_written_at_the_rate_that_was_asked_for() {
862862 gain_db: 0.0,
863863 gain_keys: Vec::new(),
864864 pan: 0,
865- pitch: 0,
865+ pitch: 0.0,
866866 transform_keys: Vec::new(),
867867 opacity_keys: Vec::new(),
868868 color_keys: Vec::new(),
@@ -944,7 +944,7 @@ fn a_silent_clip_exports_as_silence_over_its_own_span() {
944944 gain_db: 0.0,
945945 gain_keys: Vec::new(),
946946 pan: 0,
947- pitch: 0,
947+ pitch: 0.0,
948948 transform_keys: Vec::new(),
949949 opacity_keys: Vec::new(),
950950 color_keys: Vec::new(),
@@ -1056,7 +1056,7 @@ fn a_51_ac3_source_round_trips_through_a_wav() {
10561056 gain_db: 0.0,
10571057 gain_keys: Vec::new(),
10581058 pan: 0,
1059- pitch: 0,
1059+ pitch: 0.0,
10601060 transform_keys: Vec::new(),
10611061 opacity_keys: Vec::new(),
10621062 color_keys: Vec::new(),
@@ -1215,7 +1215,7 @@ fn a_fade_in_reaches_the_exported_audio() {
12151215 gain_db: 0.0,
12161216 gain_keys: Vec::new(),
12171217 pan: 0,
1218- pitch: 0,
1218+ pitch: 0.0,
12191219 transform_keys: Vec::new(),
12201220 opacity_keys: Vec::new(),
12211221 color_keys: Vec::new(),
@@ -1325,7 +1325,7 @@ fn a_split_and_crossfaded_clip_has_no_muted_interior() {
13251325 gain_db: 0.0,
13261326 gain_keys: Vec::new(),
13271327 pan: 0,
1328- pitch: 0,
1328+ pitch: 0.0,
13291329 transform_keys: Vec::new(),
13301330 opacity_keys: Vec::new(),
13311331 color_keys: Vec::new(),
@@ -1450,7 +1450,7 @@ fn a_mono_timeline_exports_as_dual_mono_ogg() {
14501450 gain_db: 0.0,
14511451 gain_keys: Vec::new(),
14521452 pan: 0,
1453- pitch: 0,
1453+ pitch: 0.0,
14541454 transform_keys: Vec::new(),
14551455 opacity_keys: Vec::new(),
14561456 color_keys: Vec::new(),
@@ -1559,7 +1559,7 @@ fn plain_clip(source: usize, out_frame: u32) -> Clip {
15591559 gain_db: 0.0,
15601560 gain_keys: Vec::new(),
15611561 pan: 0,
1562- pitch: 0,
1562+ pitch: 0.0,
15631563 transform_keys: Vec::new(),
15641564 opacity_keys: Vec::new(),
15651565 color_keys: Vec::new(),
crates/engine/tests/it/audio_files.rsmodified+1 -1
@@ -431,7 +431,7 @@ fn a_silent_first_source_does_not_stop_the_scan_for_one_with_sound() {
431431 gain_db: 0.0,
432432 gain_keys: Vec::new(),
433433 pan: 0,
434- pitch: 0,
434+ pitch: 0.0,
435435 transform_keys: Vec::new(),
436436 opacity_keys: Vec::new(),
437437 color_keys: Vec::new(),
crates/engine/tests/it/av1_software_export.rsmodified+1 -1
@@ -182,7 +182,7 @@ fn a_mid_clip_av1_frame_composes_with_a_start_and_an_in_point() {
182182 gain_db: 0.0,
183183 gain_keys: Vec::new(),
184184 pan: 0,
185- pitch: 0,
185+ pitch: 0.0,
186186 transform_keys: Vec::new(),
187187 opacity_keys: Vec::new(),
188188 color_keys: Vec::new(),
crates/engine/tests/it/av_sync.rsmodified+1 -1
@@ -87,7 +87,7 @@ fn clip(shot: Shot) -> Clip {
8787 gain_db: 0.0,
8888 gain_keys: Vec::new(),
8989 pan: 0,
90- pitch: 0,
90+ pitch: 0.0,
9191 transform_keys: Vec::new(),
9292 start: shot.start,
9393 in_frame: shot.in_frame,
crates/engine/tests/it/clip_gain.rsmodified+1 -1
@@ -38,7 +38,7 @@ fn clip(frames: u32, gain_db: f32) -> Clip {
3838 gain_db,
3939 gain_keys: Vec::new(),
4040 pan: 0,
41- pitch: 0,
41+ pitch: 0.0,
4242 transform_keys: Vec::new(),
4343 opacity_keys: Vec::new(),
4444 color_keys: Vec::new(),
crates/engine/tests/it/duck_audio.rsmodified+1 -1
@@ -45,7 +45,7 @@ fn clip(source: usize, frames: u32) -> Clip {
4545 gain_db: 0.0,
4646 gain_keys: Vec::new(),
4747 pan: 0,
48- pitch: 0,
48+ pitch: 0.0,
4949 transform_keys: Vec::new(),
5050 opacity_keys: Vec::new(),
5151 color_keys: Vec::new(),
crates/engine/tests/it/eq_audio.rsmodified+1 -1
@@ -67,7 +67,7 @@ fn clip(start: u32, source: usize, frames: u32) -> Clip {
6767 gain_db: 0.0,
6868 gain_keys: Vec::new(),
6969 pan: 0,
70- pitch: 0,
70+ pitch: 0.0,
7171 transform_keys: Vec::new(),
7272 opacity_keys: Vec::new(),
7373 color_keys: Vec::new(),
crates/engine/tests/it/pan.rsmodified+1 -1
@@ -37,7 +37,7 @@ fn clip(frames: u32, gain_db: f32) -> Clip {
3737 gain_db,
3838 gain_keys: Vec::new(),
3939 pan: 0,
40- pitch: 0,
40+ pitch: 0.0,
4141 transform_keys: Vec::new(),
4242 opacity_keys: Vec::new(),
4343 color_keys: Vec::new(),
crates/engine/tests/it/placement_walls.rsmodified+1 -1
@@ -49,7 +49,7 @@ fn clip(source: usize, in_frame: u32, out_frame: u32) -> Clip {
4949 gain_db: 0.0,
5050 gain_keys: Vec::new(),
5151 pan: 0,
52- pitch: 0,
52+ pitch: 0.0,
5353 transform_keys: Vec::new(),
5454 opacity_keys: Vec::new(),
5555 color_keys: Vec::new(),
crates/engine/tests/it/project_fuzz.rsmodified+2 -2
@@ -311,7 +311,7 @@ fn random_project(rng: &mut Rng, dir: &Path) -> Project {
311311 },
312312 gain_keys: random_gain_keys(rng, frames),
313313 pan: 0,
314- pitch: 0,
314+ pitch: 0.0,
315315 transform_keys: if kind == LaneKind::Video {
316316 random_transform_keys(rng, frames)
317317 } else {
@@ -1095,7 +1095,7 @@ fn plain_clip(start: u32) -> Clip {
10951095 gain_db: 0.0,
10961096 gain_keys: Vec::new(),
10971097 pan: 0,
1098- pitch: 0,
1098+ pitch: 0.0,
10991099 transform_keys: Vec::new(),
11001100 opacity_keys: Vec::new(),
11011101 color_keys: Vec::new(),
crates/engine/tests/it/reverse.rsmodified+1 -1
@@ -150,7 +150,7 @@ fn audio_clip(in_frame: u32, out_frame: u32, speed: u16, reversed: bool) -> Clip
150150 gain_db: 0.0,
151151 gain_keys: Vec::new(),
152152 pan: 0,
153- pitch: 0,
153+ pitch: 0.0,
154154 transform_keys: Vec::new(),
155155 start: 0,
156156 in_frame,
crates/engine/tests/it/silence.rsmodified+2 -2
@@ -154,7 +154,7 @@ fn speed_mode_refuses_a_clip_that_laps_over_a_silence() {
154154 gain_db: 0.0,
155155 gain_keys: Vec::new(),
156156 pan: 0,
157- pitch: 0,
157+ pitch: 0.0,
158158 transform_keys: Vec::new(),
159159 opacity_keys: Vec::new(),
160160 color_keys: Vec::new(),
@@ -208,7 +208,7 @@ fn whole(source: usize, frames: u32) -> Clip {
208208 gain_db: 0.0,
209209 gain_keys: Vec::new(),
210210 pan: 0,
211- pitch: 0,
211+ pitch: 0.0,
212212 transform_keys: Vec::new(),
213213 opacity_keys: Vec::new(),
214214 color_keys: Vec::new(),
crates/engine/tests/it/transform_keys.rsmodified+1 -1
@@ -180,7 +180,7 @@ fn a_still_keeps_its_keys_at_the_same_timeline_times_after_a_head_trim() {
180180 gain_db: 0.0,
181181 gain_keys: Vec::new(),
182182 pan: 0,
183- pitch: 0,
183+ pitch: 0.0,
184184 transform_keys: Vec::new(),
185185 opacity_keys: Vec::new(),
186186 color_keys: Vec::new(),
crates/engine/tests/it/trim_walls.rsmodified+1 -1
@@ -40,7 +40,7 @@ fn clip(source: usize, in_frame: u32, out_frame: u32) -> Clip {
4040 gain_db: 0.0,
4141 gain_keys: Vec::new(),
4242 pan: 0,
43- pitch: 0,
43+ pitch: 0.0,
4444 transform_keys: Vec::new(),
4545 opacity_keys: Vec::new(),
4646 color_keys: Vec::new(),
crates/engine/tests/it/undo_stress.rsmodified+1 -1
@@ -155,7 +155,7 @@ fn random_clip(rng: &mut Rng) -> Clip {
155155 gain_db: 0.0,
156156 gain_keys: Vec::new(),
157157 pan: 0,
158- pitch: 0,
158+ pitch: 0.0,
159159 transform_keys: Vec::new(),
160160 opacity_keys: Vec::new(),
161161 color_keys: Vec::new(),
crates/engine/tests/it/voice_audio.rsmodified+1 -1
@@ -29,7 +29,7 @@ fn clip(source: usize, frames: u32) -> Clip {
2929 gain_db: 0.0,
3030 gain_keys: Vec::new(),
3131 pan: 0,
32- pitch: 0,
32+ pitch: 0.0,
3333 transform_keys: Vec::new(),
3434 start: 0,
3535 in_frame: 0,
crates/engine/tests/it/voice_early_stop.rsmodified+1 -1
@@ -31,7 +31,7 @@ fn clip(frames: u32) -> Clip {
3131 gain_db: 0.0,
3232 gain_keys: Vec::new(),
3333 pan: 0,
34- pitch: 0,
34+ pitch: 0.0,
3535 transform_keys: Vec::new(),
3636 start: 0,
3737 in_frame: 0,
crates/engine/tests/lanes.rsmodified+2 -2
@@ -247,7 +247,7 @@ fn the_mp4_copy_follows_the_lane_that_holds_the_sound() {
247247 gain_db: 0.0,
248248 gain_keys: Vec::new(),
249249 pan: 0,
250- pitch: 0,
250+ pitch: 0.0,
251251 transform_keys: Vec::new(),
252252 opacity_keys: Vec::new(),
253253 color_keys: Vec::new(),
@@ -329,7 +329,7 @@ fn two_audio_lanes_are_summed() {
329329 gain_db: 0.0,
330330 gain_keys: Vec::new(),
331331 pan: 0,
332- pitch: 0,
332+ pitch: 0.0,
333333 transform_keys: Vec::new(),
334334 opacity_keys: Vec::new(),
335335 color_keys: Vec::new(),
crates/engine/tests/opus_export.rsmodified+2 -2
@@ -95,7 +95,7 @@ fn project(video: &Path, sound: &Path, sound_in: u32) -> Project {
9595 gain_db: 0.0,
9696 gain_keys: Vec::new(),
9797 pan: 0,
98- pitch: 0,
98+ pitch: 0.0,
9999 transform_keys: Vec::new(),
100100 opacity_keys: Vec::new(),
101101 color_keys: Vec::new(),
@@ -494,7 +494,7 @@ fn a_copied_picture_names_the_sound_it_was_written_with() {
494494 gain_db: 0.0,
495495 gain_keys: Vec::new(),
496496 pan: 0,
497- pitch: 0,
497+ pitch: 0.0,
498498 transform_keys: Vec::new(),
499499 opacity_keys: Vec::new(),
500500 color_keys: Vec::new(),
crates/mcp/src/help.rsmodified+2 -2
@@ -214,7 +214,7 @@ LANES
214214 lane_gain {lane, db} sets a lane's level, -60..12 dB. Each clip's own gain adds on top.
215215 pan {clip, pan} and lane_pan {lane, pan} place sound between the speakers, -1 (left) to 1 (right), 0 the middle; a balance, so
216216 the far side is turned down and the near one stays. A clip's pan and its lane's stack. Stereo mixes only. edit {ops:[{op:\"pan\", clip:\"A1@0\", pan:-0.5}]}
217- pitch {clip, semitones (-12..12)} shifts an audio clip's pitch in whole semitones and keeps its length (12 an octave up). edit {ops:[{op:\"pitch\", clip:\"A1@0\", semitones:12}]}
217+ pitch {clip, semitones (-12..12)} shifts an audio clip's pitch in semitones, fractions too (0.37), and keeps its length (12 an octave up). edit {ops:[{op:\"pitch\", clip:\"A1@0\", semitones:12}]}
218218 Ducks stack: a lane can carry one duck per key lane (`under`), so several keys can pull it down. edit {ops:[{op:\"duck\", lane, under, off:true}]}
219219 removes that one; edit {ops:[{op:\"duck\", lane, off:true}]} with no under clears every duck on the lane.
220220 Not supported (help {topic:\"unsupported\"}): custom transition shapes.
@@ -622,7 +622,7 @@ const OP_TEXTS: &[(&str, &str)] = &[
622622 ),
623623 (
624624 "pitch",
625- "pitch {clip, semitones (-12..12)} — the audio clip's pitch in whole semitones: 12 an octave up, -12 an octave down, 0 the original (the default). The speed does not change, so the clip is the same length. Playback and export hear it. Audio clips only.",
625+ "pitch {clip, semitones (-12..12)} — the audio clip's pitch in semitones, fractions allowed (0.37): 12 an octave up, -12 an octave down, 0 the original (the default). The speed does not change, so the clip is the same length. Playback and export hear it. Audio clips only.",
626626 ),
627627 (
628628 "lane_pan",
crates/mcp/src/tools/edit.rsmodified+3 -3
@@ -96,7 +96,7 @@ insert_time {at, duration, lanes?} — ripple empty time in at `at`: clips, capt
9696 remove_time {at, duration, lanes?} — ripple a span out of the unlocked lanes (or `lanes`): the cut_regions cut for one span. Titles after it move back; a title wholly inside the span is removed and one straddling an edge is trimmed to the part outside (both named in the reply).
9797 TIME
9898 speed {clip, x, ripple?, lanes?} — rate 0.25..4. [group] Its length changes, so a neighbour in its way refuses; ripple:true moves the later items in the RIPPLE RULE scope (titles too) by the length change: slower pushes them later, faster closes the gap. A clip on another lane that spans the change is never cut: outside the scope it is left in place and the reply names it; a scope lane (named in lanes) that holds one refuses, naming it. One undo step.
99-speed_ramp {clip, keys:[{at, speed}...], ripple?, lanes?} [group] — a speed that changes over the clip: each key sets a speed 0.25–4 at a clip-relative time `at` ("0s", "2s", "end" or frames), linear between keys and held before the first and after the last. Keys must be in increasing `at`, at most 8, and keys:[] clears the ramp back to the clip's constant speed. The clip's length follows the ramp, and ripple:true moves the later items as speed does. preset:"speed_up"|"slow_down"|"fast_middle"|"slow_middle" lays one of the speed card's shapes across the clip's length instead of keys (speed_up: 1x to 2x; slow_down: 2x to 1x; fast_middle: slow–fast–slow; slow_middle: fast–slow–fast); not with keys.
99+speed_ramp {clip, keys:[{at, speed}...], ripple?, lanes?} [group] — a speed that changes over the clip: each key sets a speed 0.25–4 at a clip-relative time `at` ("0s", "2s", "end" or frames), linear between keys and held before the first and after the last. Keys must be in increasing `at`, at most 64, and keys:[] clears the ramp back to the clip's constant speed. The clip's length follows the ramp, and ripple:true moves the later items as speed does. preset:"speed_up"|"slow_down"|"fast_middle"|"slow_middle" lays one of the speed card's shapes across the clip's length instead of keys (speed_up: 1x to 2x; slow_down: 2x to 1x; fast_middle: slow–fast–slow; slow_middle: fast–slow–fast); not with keys.
100100 regroup {at} — rejoins the clips that meet at `at` in every lane and puts them back in one group: the inverse of split (metadata only, one undo step; refused when no cut sits there).
101101 copy_paste {clips:[addr,...], at, lane?} — pastes copies of the named clips at `at`, with their effects, keys and volume, keeping their spacing. A paste past the end appends at the end, and the reply says where the copies landed. One clip splits and ripples the room open as the GUI's paste does; several (or any with `lane`) land as one set on their own lanes, refused whole when a landing would overlap. `lane` puts every copy on that lane (the same kind, V or A, as each copy). Links come back among the copies: copied clips that were one take (a picture and its sound, say) land as one new take, while a clip whose partner was not copied comes back unlinked. A set with a `lane` override keeps a take only where its members land on different lanes.
102102 close_gap {lane, at} — closes the one gap on `lane` that `at` stands in (the GUI's Close gap): a gap that borders a linked take closes with the take's other lane too; nothing else moves. Refused for a clip at `at`, the time past the lane's last clip, and the empty lead-in before its first clip. Captions use close_gaps.
@@ -135,7 +135,7 @@ gain_keys {clip, keys:[[time, db, ease?],...]} — the clip's volume envelope (a
135135 gain_key {clip, at, db, ease?} — one point (a point at that frame is replaced) · gain_key_remove {clip, at} — takes out the point within a frame of at
136136 gain_ramp {clip, from, to, to_db, from_db?} — a straight dB ramp from from to to; from_db defaults to the envelope's level at from. Points inside from..to are replaced.
137137 gain_dip {clip, from, to, db, ramp?=0.5s} — dips to db over from..to with ramps in and out; the ramps start from the level there now and clamp to the clip. Points inside the dip are replaced. For a dip that follows speech by itself, use duck.
138-pan {clip, pan (-1..1)} — the audio clip's place between the speakers, -1 left, 0 middle, 1 right (a balance: the far side is turned down) · pitch {clip, semitones (-12..12)} — the audio clip's pitch in whole semitones, 12 an octave up, -12 down, 0 the original; its length and speed are kept · lane_pan {lane, pan (-1..1)} — the same for a whole audio lane, on top of the clips' own
138+pan {clip, pan (-1..1)} — the audio clip's place between the speakers, -1 left, 0 middle, 1 right (a balance: the far side is turned down) · pitch {clip, semitones (-12..12)} — the audio clip's pitch in semitones, fractions allowed (0.37), 12 an octave up, -12 down, 0 the original; its length and speed are kept · lane_pan {lane, pan (-1..1)} — the same for a whole audio lane, on top of the clips' own
139139 lane_gain {lane, db (-60..12)} — level · limiter {on, ceiling_db?} — the master limiter on the output: ceiling_db -24..0 dB, the highest level the output may reach (default -1 dB)
140140 duck {lane, under, depth_db?=-12, threshold_db?=-40, attack_ms?=80, release_ms?=400, off?} — music lane dips while the key lane speaks
141141 dynamics {lane, gate?, nr?, compressor?, deesser?, reset?} — an audio lane's voice processors: each of gate, nr, compressor, deesser is true, false (bypass) or an object of settings; clean_voice sets the whole chain at once
@@ -843,7 +843,7 @@ fn clip_of(source: usize, in_frame: u32, out_frame: u32) -> Clip {
843843 gain_db: 0.0,
844844 gain_keys: Vec::new(),
845845 pan: 0,
846- pitch: 0,
846+ pitch: 0.0,
847847 }
848848 }
849849
crates/mcp/src/tools/edit_fx.rsmodified+10 -10
@@ -1756,7 +1756,7 @@ fn pan(s: &mut PlaybackSession, op: &Value) -> Result<Applied, String> {
17561756 Ok(done(format!("{who} → {pan:+.2}"), vec![(lane, start)]))
17571757 }
17581758
1759-/// `pitch {clip, semitones}`, -12 (an octave down) to 12 (up), whole semitones. The speed is kept.
1759+/// `pitch {clip, semitones}`, -12 (an octave down) to 12 (up), fractions allowed. The speed is kept.
17601760 fn pitch(s: &mut PlaybackSession, op: &Value) -> Result<Applied, String> {
17611761 let (lane, idx, raw, start) = clip_arg(s, op)?;
17621762 let who = format!("pitch {raw}");
@@ -1764,11 +1764,8 @@ fn pitch(s: &mut PlaybackSession, op: &Value) -> Result<Applied, String> {
17641764 return Err(format!("{who}: {raw} is on a video lane, and a clip's pitch is set on its audio clip; set it on the audio clip split from the same take"));
17651765 }
17661766 let v = num(op, "semitones")?.ok_or_else(|| format!("{who}: missing argument `semitones` (-12 an octave down to 12 an octave up, 0 the original)"))?;
1767- if v.fract() != 0.0 {
1768- return Err(format!("{who}: semitones {} is not a whole number", fmt(v)));
1769- }
1770- let semitones = ranged(&who, "semitones", v, -12.0, 12.0)? as i32;
1771- if s.clip_pitch_of(lane, idx) == Some(semitones as i8) {
1767+ let semitones = ranged(&who, "semitones", v, -12.0, 12.0)?;
1768+ if s.clip_pitch_of(lane, idx) == Some(semitones) {
17721769 return Ok(done(format!("{who} → already {semitones:+}"), Vec::new()));
17731770 }
17741771 if !s.set_clip_pitch(lane, idx, semitones) {
@@ -4441,14 +4438,17 @@ mod pitch_op_tests {
44414438 let mut s = session();
44424439 let len = s.lane_clips(Lane::A1)[0].len();
44434440 run(&mut s, json!({"op": "pitch", "clip": "A1#0", "semitones": 12})).expect("pitch up an octave");
4444- assert_eq!(s.clip_pitch_of(Lane::A1, 0), Some(12));
4441+ assert_eq!(s.clip_pitch_of(Lane::A1, 0), Some(12.0));
44454442 assert_eq!(s.lane_clips(Lane::A1)[0].len(), len, "pitch keeps the clip's length");
44464443 assert!(s.undo(), "pitch is one undo step");
4447- assert_eq!(s.clip_pitch_of(Lane::A1, 0), Some(0));
4448- assert!(run(&mut s, json!({"op": "pitch", "clip": "A1#0", "semitones": 1.5})).is_err());
4444+ assert_eq!(s.clip_pitch_of(Lane::A1, 0), Some(0.0));
4445+ run(&mut s, json!({"op": "pitch", "clip": "A1#0", "semitones": 0.37})).expect("a fraction sets");
4446+ assert_eq!(s.clip_pitch_of(Lane::A1, 0), Some(0.37));
4447+ assert!(s.undo());
4448+ assert!(run(&mut s, json!({"op": "pitch", "clip": "A1#0", "semitones": 12.5})).is_err());
44494449 assert!(run(&mut s, json!({"op": "pitch", "clip": "A1#0", "semitones": 13})).is_err());
44504450 assert!(run(&mut s, json!({"op": "pitch", "clip": "A1#0"})).is_err());
44514451 assert!(run(&mut s, json!({"op": "pitch", "clip": "V1#0", "semitones": 2})).is_err());
4452- assert_eq!(s.clip_pitch_of(Lane::A1, 0), Some(0), "refusals change nothing");
4452+ assert_eq!(s.clip_pitch_of(Lane::A1, 0), Some(0.0), "refusals change nothing");
44534453 }
44544454 }
crates/mcp/src/tools/export.rsmodified+2 -1
@@ -1607,7 +1607,7 @@ fn export_start(srv: &mut Server, args: &Value) -> Reply {
16071607 AUDIO_KBPS.map(|v| v.to_string()).join(", ")
16081608 ));
16091609 };
1610- if let Some(why) = s.audio_rate_refusal(format, ranged) {
1610+ if let Some(why) = s.audio_rate_refusal(format, ranged, true) {
16111611 return Reply::err(format!(
16121612 "audio_kbps can't be chosen for {}: {why}",
16131613 format_name(format)
@@ -1763,6 +1763,7 @@ fn export_start(srv: &mut Server, args: &Value) -> Reply {
17631763 keyframe_s,
17641764 faststart,
17651765 audio_kbps,
1766+ reencode_audio: audio_kbps.is_some(),
17661767 subtitles,
17671768 no_soft_subtitles: no_soft,
17681769 range,
crates/mcp/src/tools/look.rsmodified+5 -5
@@ -677,13 +677,13 @@ fn media_rows(s: &PlaybackSession, lane: Lane, fps: f64, range: Option<(u32, u32
677677 // always; brief shows only the ones set off their default.
678678 let (pan, pitch, deint) = (
679679 s.clip_pan_of(lane, idx).unwrap_or(0.0),
680- s.clip_pitch_of(lane, idx).unwrap_or(0),
680+ s.clip_pitch_of(lane, idx).unwrap_or(0.0),
681681 s.deinterlace_of(lane, idx),
682682 );
683683 if lane.kind == LaneKind::Audio && (full || pan != 0.0) {
684684 body.push_str(&format!(" pan {}", num(f64::from(pan))));
685685 }
686- if lane.kind == LaneKind::Audio && (full || pitch != 0) {
686+ if lane.kind == LaneKind::Audio && (full || pitch != 0.0) {
687687 body.push_str(&format!(" pitch {pitch:+}"));
688688 }
689689 if lane.kind == LaneKind::Video && (full || deint != engine::project::Deinterlace::Frame) {
@@ -1390,14 +1390,14 @@ fn media_info(s: &PlaybackSession, lane: Lane, idx: usize, fps: f64) -> Reply {
13901390 // Pan, pitch and deinterlace, each shown only when it is off its default.
13911391 let (pan, pitch, deint) = (
13921392 s.clip_pan_of(lane, idx).unwrap_or(0.0),
1393- s.clip_pitch_of(lane, idx).unwrap_or(0),
1393+ s.clip_pitch_of(lane, idx).unwrap_or(0.0),
13941394 s.deinterlace_of(lane, idx),
13951395 );
13961396 let mut tweaks = Vec::new();
13971397 if pan != 0.0 {
13981398 tweaks.push(format!("pan {}", num(f64::from(pan))));
13991399 }
1400- if pitch != 0 {
1400+ if pitch != 0.0 {
14011401 tweaks.push(format!("pitch {pitch:+} semitones"));
14021402 }
14031403 if deint != engine::project::Deinterlace::Frame {
@@ -2324,7 +2324,7 @@ mod tests {
23242324 let audio = call(&mut srv, "clip_info", json!({"clip": "A1#0"}));
23252325 assert!(audio.text.contains("pan -0.5 · pitch +3 semitones"), "{}", audio.text);
23262326 assert_eq!(audio.structured.as_ref().unwrap()["pan"], -0.5);
2327- assert_eq!(audio.structured.as_ref().unwrap()["pitch"], 3);
2327+ assert_eq!(audio.structured.as_ref().unwrap()["pitch"], 3.0);
23282328 let video = call(&mut srv, "clip_info", json!({"clip": "V1#0"}));
23292329 assert!(video.text.contains("deinterlace field"), "{}", video.text);
23302330 assert!(video.text.contains("speed keys: 3\n at clip 0.000s speed 1x\n at clip 1.000s speed 1.5x\n at clip 2.000s speed 2x"), "{}", video.text);