* io: import a MIDI file with stray bytes after its last track (#1528)
Importing a MIDI file read it with craft-midi's strict read_smf, which
refuses any damage. The file in #1528 is whole, its one track ending with
End of Track at its declared length, but two line feeds follow it. The
strict reader took them for the start of another chunk and refused the
file with "unexpected end of data at byte 45281".
Read imported files with read_smf_lenient instead, as other MIDI readers
do: it reads a sound file exactly as read_smf does, ignores bytes after
the last chunk, and keeps what makes sense of a damaged track, bounded by
the same event and track limits. Its warnings are logged. Something that
is not a Standard MIDI File is still refused, and the file is still read
in full before the session changes (#911).
Test: a complete file followed by two line feeds imports its note; it
failed with the issue's error before.
* io: a MIDI file past the reader's limits stays refused (#1528)
Read leniently, a file with more events or tracks than craft-midi reads
kept what came before the limit and left the rest out with only a log
warning, where the strict reader refused it. Import now reads a file
strictly first: a sound file reads as before, a file past the event or
track limit is refused as before, and only other damage (stray bytes
after the last track) falls back to the lenient reader.
Test: a file one track past the limit, its last track holding a note and
stray bytes after it, is refused and leaves the session empty.
* io: refuse a MIDI file past the event limit after a damaged track (#1528)
The strict reader stops at the first damage. When a damaged track came
before the one that goes past MAX_EVENTS, the strict error was not a
limit error, the import fell back to the lenient read, and that read
kept what came before the limit and left the rest out with a warning:
the file was imported cut short.
The lenient read now says when a limit left part of the file out
(LenientRead::over_limit, storytold/craft-libs#1308), and the import
refuses such a file before the session changes, warnings full or not.
The six craft-libs crates pinned at 6a86adb move together to that PR's
commit, as craft-scraft-format uses craft-midi's and craft-audio's
types. They move to its merge commit once it merges.
* deps: keep only the craft-libs source changes in Cargo.lock (#1528)
Moving the craft-libs pins also re-resolved several windows-sys edges
(0.61.2 to 0.52.0) and tempfile's getrandom edge (0.4.3 to 0.3.4).
Restore main's resolution for those, so the lockfile only changes the
source of the craft-libs crates.
* deps: pin craft-libs to the merge of craft-libs#1308 (#1528)
Move the six craft-libs crates from the PR's commit 4db60c4 to its merge
into craft-libs main, 45a8e16. None of these crates, nor craft-zip which
craft-scraft-format uses, changed between the two.
* io: a missing movie is offline with its checked path (#923)
relink_videos resolved a stored movie path, found no file, and then left
the raw stored string in the session with offline unset. The video
worker opened that string as given, relative to the working directory,
so a session path reached the file system without going through
stored_path.
Store the resolved path in that arm and mark the movie offline, as the
refused-path arm already does; the Video track then shows
"media offline: file not found" instead of trying the path. Test: a
relative stored path that names no file.
* io: keep a missing movie's stored path as it was
Review follow-up: the first commit replaced the stored string with the
resolved absolute path. Saving then wrote this folder's path, and a
session moved together with its movie no longer found it under the same
relative path (relinking only looks beside the session and in
"Video Files").
Marking the movie offline is what keeps the Video track from opening the
stored string, so leave the string as stored. The test now saves the
session into another folder, puts the movie back there under the same
relative path and checks it opens.
* Test: every outcome of relinking a movie
Its file is there; it is gone with a copy next to the session or in Video
Files (relinked); it is gone with no copy (offline, path kept); its stored
path is refused, with or without a copy.
---------
Co-authored-by: ashokram-si <347905169+ashokram-si@users.noreply.github.com>
* io: check a MIDI file in full before the session changes (#911)
import_midi_bytes wrote the file's tempo and meter changes and added a
track per SMF track as it went, then returned an error for a track
longer than a day. Through execute the session is restored on error,
but the web shell calls the function directly and only pushes its undo
step on success, so a refused file left the earlier tracks and the new
tempo map in place with no way back.
Build the tempo map apart from the session, check every track's length
with it, and only then commit the map and place the clips. Test: a file
whose second track is too long leaves the session equal to before.
* io: a refused MIDI file isn't an edit either
The checks before the import ran after session_mut, which already counts
as an edit: it bumps the revision, marks the engine unsaved and may copy
the session. They now read through session(), and session_mut is taken
only once nothing can fail. The test checks the revision and unsaved
mark too.
---------
Co-authored-by: ashokram-si <347905169+ashokram-si@users.noreply.github.com>
* mix.volume: say what each track got and when a value was clamped
The fader stops at -144 and +12 dB, and mix.volume replied only with a track
count, so +15 dB played at +12 with nothing to show it. The reply now lists
each target's volume and sets clamped when a target or a group member was
held at a stop.
* mix.volume: list every requested track in the reply
A target moved as a group sibling of an earlier one was skipped before it was
added to volumes, so tracks [3, 6] in one group listed only track 3. Build
volumes after the loop from each requested track's final volume.
The help for mix.send said `level_db?: 0`, but a new send has always started
at -144 dB (silent): SendSlot::new sets it, the Mix window relies on it, and
Preferences > Mixing shows "Sends Default to -inf dB". The help now gives the
range and the real default, and a test checks the help and a new send agree.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
craft-audio in craft-libs was built from audio-io and FilmCraft's codecs, so
each format has one implementation that every Craft app shares. Call sites use
its API directly: EncodeOptions::new(format).with_*(), EncodeFormat,
DECODE_EXTENSIONS, ENCODE_EXTENSIONS, encode_format_for, AudioInfo's container,
codec and layout.
soundcraft_model::FileFormat stays as the kind of file a session records for
each source: its variant names are part of the session format. It maps from
craft-audio's AudioInfo.
craft-audio and craft-media are pinned to the craft-libs branch of
storytold/craft-libs#824, which adds the extension tables SoundCraft had in
FileFormat and fixes the quadratic WAV chunk scan (#893).
Behaviour that changes: AAC, ALAC, Opus, AC-3/E-AC-3 and MP2 decode with
craft-audio's own decoders; MP4 and Matroska tracks import at their
presentation length; .opus, .ac3, .eac3, .ec3, .mov, .mka and .mpa are
importable names; .aifc is a writable name; FLAC files come from craft-audio's
encoder.
* fix(engine): create output files exclusively and check read access before probing
* address review: canonicalize through the checked io gateway, treat any occupied export name as taken
* address review: read group audio through the validated file handle
* address review: document that a write-only root writes a new numbered WAV per save
* address review: clip-group audio is opened without waiting for a FIFO writer
* Strip Silence: cut and remove pieces in one pass over the playlist
* address review: document the sorted-points order and test stretched audio offsets
* fix(ui): check movie read access and file type; private take folder without settings
* address review: make the fallback take folder exclusively under an unguessable name; qualify the owner-only claim to Unix
* address review: unique folder prefix must be one name; no fallback take folder for a saved session
* add tests for the take folder and the movie open checks
Display labels only; command ids, catalog paths, session tokens and processor ids are unchanged.
- Avid-listed names and bundled plug-in products get our own names (Beat Analysis, Punch Recording, Room Reverb, Compressor/Limiter, Saturator, Bit Crusher, Rendered (High Quality), ...).
- Features we don't have stay in the menu as disabled placeholders with "Not available yet." (Tempo Sync, No ARA plug-ins, Analog Saturation).
- AudioSuite, Elastic Audio, TrackPunch, Pitch Shift Legacy and Time Compression Expansion keep their names until RFC-0029 settles.
- parity_floor and catalog dispatch unchanged; docs/feature-naming.md has the crosswalk.
Address the review by clearing stale test scratch directories before setup and exercising an explicit supported WAV format through the real command, including decoded output format, frames and audio.
Each clip looked for its file name from the start again, checking the
disk for every earlier name, so exporting many clips of one name took
time growing with the square of their number. The export now remembers
the next suffix to try for each name. Files already in the folder are
still skipped.
Both made a folder first, which fails in the browser. Making a folder is
now a no-op on wasm32, where each file is delivered by name, and Export
Clips writes through write_file, the path bounce and export already use,
instead of std::fs. Two clips with the same name no longer get the same
file name when nothing is on disk. Native behaviour is unchanged.
A session was parsed into a serde_json Value and then converted, which takes
many times the file's size in memory, and nothing limited how big a session
file could be.
Session::from_json now reads only format_version first (every other field is
skipped) and then parses the text straight into the session. A missing
format_version and a newer version give the errors they gave before. Other
type errors now end with the place they were found ("at line L column C").
A field of the document given twice in one object, which used to load with
the last value winning, is now refused with "duplicate field `key`" (a
twice-given format_version too, not "missing format_version"): keeping the
old leniency would need the tree this change removes, and no writer repeats
a field. Keys of maps (plugin params, edit values and the like) and unknown
keys still keep the last value given, as before.
A track's height was read through an untagged enum, which buffers the whole
value before it looks at it; a huge array there took about 27 times its size.
It now has its own reader that takes exactly the forms that loaded before
("Micro" to "Extreme", also as {"Micro": null}, {"Custom": n}, {"Fit": n},
and the old bare "Fit" or {"Fit": null}) and refuses anything else at its
first token.
Opening a session (a .scraft file, the browser's bytes, the session in a
bundle) and Import Session Data refuse one over 256 MiB by its size, before
reading it. Save, Save Copy In, Save As Template, autosave and the browser's
bundle refuse to write a session over that size, so SoundCraft never saves
one it then won't open. Save and autosave check before they write any audio,
so a refused save leaves nothing behind and a refused autosave keeps the last
one and its audio copies as they were; the refusal is reported like any
other autosave failure. Save checks against the longest name each new audio
file can get, so it may refuse a session within a few bytes per new file of
the limit. Crash recovery reads only the name of a leftover autosave, and
none from one over the cap. Audio files are read without that cap, as
before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exercise null, numeric, boolean, array and object format values through Engine::execute and verify the parameter error without creating a destination. The regression fails before the guard; all 363 engine unit tests pass with it.
Address review r3017244428: only an absent format defaults to WAV; a present non-string value returns a parameter error before creating the output directory.
Converting clip gain to volume (and baking volume into clip gain)
evaluated the clip's gain envelope by walking it from the start for
every breakpoint being converted, so a large envelope in an opened or
imported session cost envelope points squared and blocked the engine.
Build a running-maximum index over the envelope once per clip and
binary-search it. It returns exactly what the walk returned, including
for envelopes stored out of order.
Bundle entries are stored, so the files read out of one can only
outgrow the bundle when several entries point at the same bytes. A
small bundle naming one payload thousands of times was copied out once
per name, up to the 1 GiB total limit, in the browser. Check the
archive for overlapping entry data before reading any entry.
Its help said `<plugin id>`, but it only runs built-in plugins, and a
hosted id (clap:, vst3:, au:) failed as "unknown process". The help now
says built-in plugin id, and a hosted id gets an error saying AudioSuite
runs built-in plugins only.
Fixes#1301.
Bounces passed no bwf to the encoder, so mix and stem WAVs had no bext
chunk and post tools placed them at zero. Bounce::new now stamps them
with TimeReference = the session's timecode start plus the bounce start,
in samples since midnight, as other DAWs do. A caller's own bwf wins;
AIFF and FLAC have no bext and are unchanged.
Fixes#1296.