268 lines
14 KiB
Markdown
268 lines
14 KiB
Markdown
```
|
|
CURRENT EXECUTABLE IMPLEMENTATION — REAL NATIVE SD3 TEMPLATE SONG CODEC
|
|
Verification: 2026-10-19 local / 2026-10-20 UTC
|
|
Status: IMPLEMENTED AND VERIFIED by native saved-file structural/content
|
|
read-back. SD3 application open/play/save/reload and Cubase acceptance: UNRUN.
|
|
This supersedes the historical unavailable-layout gate, not application testing.
|
|
|
|
SCOPE
|
|
|
|
Executed the current implementation amendment atop prompts\step_8_fix.md.
|
|
Read latest plan continuation, CURRENT report_7_fix implementation and current
|
|
profiles, compiler, event/MIDI contracts, native APIs, service and tests.
|
|
Implemented formats\sdp.py, necessary strict profile/model/resource extensions,
|
|
SD3 tests/original fixtures, related resource/stdio/service regression assertions
|
|
and directly related format/architecture/profile/compatibility/README docs.
|
|
|
|
Existing Riffer implementation and working standard defaults were preserved.
|
|
No service implementation edits, native service registration, CLI template
|
|
configuration, default flips, commits, delegation or later prompt work.
|
|
The checkout already contained Step 7 and plan/prompt changes when this task
|
|
started; those pre-existing changes, including service.py, were not reverted
|
|
or misrepresented as Step 8 implementation.
|
|
|
|
READ-ONLY EVIDENCE AND FACTS
|
|
|
|
- Installed Superior Drummer 3.exe ProductVersion: 3.4.4.
|
|
- Five operator-local projects were read in place, never copied into fixtures:
|
|
all UTF-8, PlugVersion 3.4.4, one SongTrack and a terminal NUL.
|
|
sd3-demo.sd3p has 170 packed note triples in two clips.
|
|
Three transcription projects each have 1,169 triples; the other project has
|
|
no song notes. All observed packed messages have note-on status 0x90.
|
|
All five passed actual parser + library/pad/input-channel preflight.
|
|
- Actual library location is SAMPLER/HQ/soundlib "SL-DFH".
|
|
Native pad/alias declarations establish kickR -> 36, snareR -> 38,
|
|
hatsTP -> 42. Only these three voices were promoted to the target subset.
|
|
Other GM pitches were NOT promoted merely because their numbers resemble GM.
|
|
- Genuine 8332944 = 0x7f2690 independently decodes as note-on channel 0,
|
|
pitch 38, velocity 127. Start/end triple coordinates are quarter-note beats.
|
|
- Drumtracker/Track is unrelated tracker state. Its trackstuff/tempoMap and
|
|
all other non-song bytes are preserved, not treated as song MIDI or decoded
|
|
into an audio-analysis feature.
|
|
- The installed Operation Manual.pdf is actually a 20,744-byte ONE-PAGE link
|
|
sheet, not the complete SD3 manual. Local in-memory PDF inspection confirmed
|
|
its official manual URL; that public URL still requires login. No login or
|
|
bypass was attempted. Mapping evidence is the local setup/project pad
|
|
declarations, NOT a fabricated manual mapping citation.
|
|
- Local provenance identifier: LOCAL-SD3-344-DFH-PADS-20261019.
|
|
pypdf 6.21.1 was installed solely as a local evidence reader after the
|
|
selected import failed for a missing tool. No project dependency or package
|
|
manifest was changed for PDF reading.
|
|
|
|
No private template, factory musical sequence, manual asset or executable was
|
|
copied into source/tests, packaged as a fixture, or uploaded. Generated local
|
|
evidence retains operator kit state and stays in ignored .test-artifacts,
|
|
outside source/tests. Public fetch sent only the official manual URL.
|
|
|
|
IMPLEMENTED CODEC AND PROFILE
|
|
|
|
1. Public Python APIs:
|
|
parse_sdp_project(raw: bytes) -> SdpProject
|
|
inspect_sdp_template(path: Path) -> SdpTemplateInfo
|
|
check_sdp_capability(part, profile, *, template: Path | None = None)
|
|
require_sdp_capability(part, profile, *, template: Path | None = None)
|
|
write_sdp(path, plan, part, profile, *, template=None) -> Path
|
|
validate_sdp_file(path, plan, part, profile, *, template=None) -> SdpReadback
|
|
write_sd3p / validate_sd3p_file alias the same real native implementation.
|
|
sdp remains the request alias; actual files MUST use lowercase .sd3p.
|
|
|
|
2. Nondefault strict production profile:
|
|
toontrack.sd3.3.4.4.core.v1
|
|
toontrack-sd3-3.4.4-core-v1.json
|
|
Provenance is verified_subset; version 3.4.4, library SL-DFH, core three
|
|
pad voices only, normal/sustain only. The actual template must uniquely
|
|
assign these pitches to matching defined pads in the evidenced xpad.
|
|
Active sampler MIDI-learn overrides/incompatible input filtering error.
|
|
Channel 9, linear intensity interpolation 1..127, action-free/reset-free
|
|
scheduling and precision restrictions are explicitly generator policy,
|
|
NOT vendor channel defaults, named sample layers or a complete SD3 map.
|
|
Invalid promotions/version/library/voice/control/default changes fail.
|
|
|
|
3. Capability is executable, not a metadata switch:
|
|
standard/mapping-only profiles -> sdp_profile_not_supported;
|
|
supported target, no optional template -> sdp_template_required;
|
|
supported target + actual valid template -> available,
|
|
sd3_3_4_4_template_song.
|
|
No-template checks preserve the old no-IO boundary contract.
|
|
An explicitly supplied unreadable/missing template is OUTPUT_IO_ERROR;
|
|
supplied corrupt/versioned/map-mismatched state is SERIALIZATION_ERROR.
|
|
These errors are not swallowed as a MIDI fallback opportunity.
|
|
Mutable/unchecked profile validation and wrong-part errors remain strict.
|
|
|
|
4. Actual bounded native text parser:
|
|
Balanced blocks, quoted/escaped strings, quoted record keys, braces inside
|
|
quoted state, Unicode, LF/CRLF, single optional terminal NUL.
|
|
Limits: 16 MiB, depth 64, 1,000,000 tokens, 100,000 note triples,
|
|
1..32 contiguous source tracks, numeric beat bounds <= 16,384.
|
|
Rejects wrong/duplicate version, unbalanced/malformed state, ambiguous
|
|
track/current-track/clip ownership, invalid tempo/meter maps, misplaced
|
|
song music, malformed/truncated triples and invalid timing/message bytes.
|
|
No template scripting, eval, subprocess or arbitrary executable content.
|
|
|
|
5. Actual native writer:
|
|
Replaces ALL source SongTrack records and current-song selection with
|
|
exactly one generated drum track/clip. Old grooves, clips, extra active
|
|
tracks, offsets, MIDI/database references and per-song transformations
|
|
are removed. Shared start/end, tempo/meter, velocities, drum pitches and
|
|
channel survive as new original native events.
|
|
Every unrelated template byte remains unchanged, including ClearTracksFirst,
|
|
kit/sampler/mixer/editor/tracker/e-drum/metronome/host-sync state.
|
|
The template is never written. Output uses exclusive xb on the supplied
|
|
staged path only, flush/fsync, bounded positive size and saved validation.
|
|
No parent/sibling/publication is created; no existing destination is
|
|
overwritten. Template content stability is checked across the write.
|
|
|
|
6. Independent saved-content validation:
|
|
Parses saved bytes and independently extracts status/channel, pitch and
|
|
velocity from packed integers; it does not reserialize expected native
|
|
text and compare the writer against itself.
|
|
Recompiles the selected score and accounts for ALL compiled events.
|
|
Compares exact native note multisets, common bounds, tempo/meter, neutral
|
|
clip controls, supported structural fields and exact non-song bytes.
|
|
Extra references/fields/tracks, mutated content or retained source-song
|
|
semantics fail with named serialization errors.
|
|
|
|
7. Explicit supported subset boundaries:
|
|
Only ordinary note-on triples with explicit positive-duration endpoints.
|
|
CC/switch/status semantics, nonzero release velocity, empty music,
|
|
score/event mismatch, wrong channels, pre-roll or tail are rejected.
|
|
Exact finite-decimal quarter-beat coordinates, <= six fractional places;
|
|
nonterminating 1/3 and overprecision 1/128 error rather than round.
|
|
Different PPQs are converted exactly, not assumed to be 960.
|
|
Absolute score start is normalized to the common score-relative zero.
|
|
Native percussion key metadata is neutral, not a pitched-key claim.
|
|
Failed caller-owned staging files can remain after serialization/IO failure;
|
|
they are never a successful published artifact.
|
|
|
|
ACTUAL ORIGINAL NATIVE RESULTS — PERSISTENT AND REVALIDATED
|
|
|
|
Original score: 137.5 BPM, 7/8, one bar, 3.5 quarter beats.
|
|
Logical score interval is 8..11.5; compiled/common musical interval is 0..3.5.
|
|
Zero-based MIDI channel 9. Three original notes:
|
|
|
|
voice pitch velocity start beat end beat
|
|
kick 36 1 0 0.125
|
|
closed_hat 42 64 0.25 0.375
|
|
snare 38 127 3 3.125
|
|
|
|
Actual new Events triples, independently decoded from saved native files:
|
|
74905 0 0.125 (0x012499)
|
|
4205209 0.25 0.375 (0x402a99)
|
|
8332953 3 3.125 (0x7f2699)
|
|
|
|
Read-only genuine template run:
|
|
Input: prompt-specified operator-local sd3-demo.sd3p, 75,393 bytes.
|
|
Source SHA-256:
|
|
06f54b02079e4b32d532ecc232b813c3fe1865799e6f5b2b21b5ddf398b0533d
|
|
Output:
|
|
.test-artifacts\native-sd3-evidence-v1\operator-local\original-drums.sd3p
|
|
Actual output: 66,194 bytes; SHA-256:
|
|
c747670d81736441928f368d8092d5363ad8e1bf3cad453af3173c1102674f88
|
|
Source 170 events/two clips -> saved three original notes/one clip/one track.
|
|
Saved metadata is 137.5 BPM, 7/8, start 0, end 3.5, Offset 0.
|
|
No source song FileName/DatabasePath/KPTransform content survives inside
|
|
the generated song. Native validation disallows those extra fields.
|
|
|
|
Exact non-song preservation:
|
|
65,591 bytes, byte-for-byte identical before/after, SHA-256:
|
|
10340dc5c057f2580c474ebc56277b2deae3263cee49e4674e07b8c9cc421d32
|
|
Independently compared raw block spans:
|
|
SAMPLER 60,637 bytes identical (includes selected kit/mixer)
|
|
editorVars 885 bytes identical
|
|
mixerState 146 bytes identical
|
|
Drumtracker 1,409 bytes identical
|
|
SongCreator 32 bytes identical
|
|
EdrumPreset 1,024 bytes identical
|
|
MetronomeSettings 156 bytes identical
|
|
SAMPLER SHA-256:
|
|
026a27006d04555942b11124b3cc8ea6803c2fca299f8efa74a0191e84b91fc5
|
|
Drumtracker SHA-256:
|
|
3c71b1d1079bc083a0f9249e21dec130171196dcb4e47ca48ffb0abe3ac8bd60
|
|
Source inode/file ID 166633186213030518, size 75393,
|
|
mtime_ns 1788614183091903900 and full content hash were unchanged.
|
|
SyncToHost and MIDI input configuration were preserved, not silently reset.
|
|
|
|
Original minimal fixture run:
|
|
tests\fixtures\sd3\original-template.sd3p and original-score.json contain
|
|
newly authored original sentinel state/music, not a stripped private export.
|
|
Output:
|
|
.test-artifacts\native-sd3-evidence-v1\synthetic-original\original-drums.sd3p
|
|
Actual output: 1,360 bytes; SHA-256:
|
|
5b7e3e7e8615d58ba8b6a4e9df818caf94d0ce2eb5a4fc1dc546c6da6c3f0e6a
|
|
Same three generated notes/tempo/meter/bounds; source fixture hash/identity
|
|
unchanged. The minimal fixture is a codec fixture, not a redistributed kit.
|
|
|
|
All retained local files above are ignored by git. No output was promoted
|
|
into source/tests and no private input was modified.
|
|
|
|
FINAL VALIDATION — ALL PASS, NO SKIPS
|
|
|
|
Environment: existing Windows CPython 3.13.13 venv.
|
|
runTests editor integration discovered no tests for the new file; actual pytest
|
|
execution below is authoritative. Editor problems reported no errors in the
|
|
changed codec/profile/new SD3 test files.
|
|
|
|
Focused native/service/resource/package suite:
|
|
.\.venv\Scripts\python.exe -m pytest
|
|
tests\unit\test_sd3p.py tests\unit\test_sdp.py
|
|
tests\unit\test_service.py tests\integration\test_sd3p_files.py
|
|
tests\integration\test_sdp_capability.py
|
|
tests\integration\test_articulation_midi.py
|
|
tests\integration\test_distribution.py -q --tb=short
|
|
RIFF_SD3_TEMPLATE was set to the prompt's genuine sd3-demo.sd3p.
|
|
Result: 266 passed in 15.52 seconds.
|
|
|
|
Final full current regression suite:
|
|
.\.venv\Scripts\python.exe -m pytest -q --tb=short
|
|
Result: 1,320 passed in 41.39 seconds; 0 failed, 0 skipped.
|
|
Prior current baseline was 1,221. Added 96 SD3 unit cases, one native
|
|
integration case and two targeted service readiness/MIDI cases.
|
|
|
|
Final static/dependency checks:
|
|
.\.venv\Scripts\python.exe -m ruff check src tests
|
|
All checks passed.
|
|
.\.venv\Scripts\python.exe -m ruff format --check src tests
|
|
43 files already formatted.
|
|
.\.venv\Scripts\python.exe -m mypy src tests
|
|
Success: no issues found in 43 source files (strict project config).
|
|
.\.venv\Scripts\python.exe -m pip check
|
|
No broken requirements found.
|
|
git --no-pager diff --check
|
|
PASS.
|
|
|
|
Full/targeted package tests rebuilt real sdist/wheel offline, installed and
|
|
imported the wheel outside the checkout, verified all six packaged JSON
|
|
resources under both installed and ZIP resource loading, and ran the actual
|
|
installed stdio service. Installed-wheel native probes generated/read back
|
|
original .griff, .briff AND .sd3p files from the installed codec. The SD3 probe
|
|
uses its own original minimal template and confirms one snare note with
|
|
channel 9/pitch 38/velocity 127 and positive native size.
|
|
Owned build/install/test workspaces were cleaned; persistent evidence remains.
|
|
No dependency restore was needed for application/tests/build tools.
|
|
|
|
During development, fixture CRLF assumptions and an old exact five-resource
|
|
assertion failed; both were corrected without weakening state/resource checks.
|
|
All final suites above were rerun successfully after those corrections.
|
|
|
|
READINESS AND REMAINING LIMITS
|
|
|
|
READY: actual bounded native codec, typed optional template input, testable
|
|
read-only preflight, nondefault evidence-backed core profile, exact native
|
|
music validation, ignored original local-template evidence and package APIs.
|
|
The registry now exposes six profiles; the original three standard defaults
|
|
and operational standard-MIDI service/fallback behavior are unchanged.
|
|
Explicit MIDI with the SD3 subset also passes without template/native wiring.
|
|
Explicit SD3 native service requests without optional template fail preflight
|
|
before staging when fallback is disabled; no native service output is claimed.
|
|
|
|
NOT DONE HERE: native writer registration/service transaction integration,
|
|
optional CLI template configuration, default-profile changes, full SD3 map,
|
|
other libraries/versions/control semantics, application acceptance.
|
|
Preserved host sync/mute/routing/operator settings may affect playback or
|
|
override project tempo; structural read-back cannot certify receiver behavior.
|
|
|
|
Actual SD3 load/inspect/play/save/close/reload, acoustic pad/dynamics checks,
|
|
and Cubase routing/native/MIDI comparison remain UNRUN. No fabricated plugin
|
|
or DAW result is inferred from the real .sd3p structural/content success.
|
|
```
|