# Step 8 native fix: Implement SDP only from real format evidence ## Current executable native implementation amendment Real native evidence now exists. Read the latest plan continuation and CURRENT implementation section of `report_7_fix.md` (Riffer native implementation has passed 1,221 tests). Implement SD3 native output now, not another unavailable boundary or public-research-only report. This amendment supersedes the old absent-evidence gate below. ### Read-only local evidence - Installed executable: `C:\Program Files\Toontrack\Superior Drummer\Superior Drummer 3.exe`, ProductVersion 3.4.4. - Local official documentation: `C:\Program Files\Toontrack\Superior Drummer\Superior Drummer 3 Operation Manual.pdf`. Read locally if needed; do not upload/copy the manual into the repository. - Genuine project: `C:\Users\g3\Documents\Toontrack\Superior Drummer 3\sd3-demo.sd3p` (75,393 bytes); four other .sd3p projects exist in that same folder. Treat them as private read-only evidence, not redistributable fixtures. - Actual suffix is `.sd3p`; `sdp` is a request/API alias, not a file extension to write. Models now distinguish request aliases and actual ArtifactFormat. ### Observed native structure to verify UTF-8 text begins `PlugVersion 3.4.4`. There is a substantial `SAMPLER` block with selected `soundlib "SL-DFH"` and kit/mixer state. Preserve operator state instead of inventing/shipping proprietary kit data. Top-level: `ClearTracksFirst` followed by `SongTrack 0 { ... }`. Track fields include Minimized, ClearTrackFirst, TrackLength, VisibleArea, Zoom, Tempo ` 0 0`, TimeSig ` 0`, KeySign, TrackName, MutedCCs, ClearSongParts, GridRes, LoopArea, LoopActive, StartNumber, PlayHeadPos. Each `MidiLoop 0 { ... }` has Name, RealEndTime, StartTime, EndTime, Offset, tapQuantize, Velocity, ClearNotes, TimeSig and a `MidiEvents { ... }` block. MidiEvents includes EndTime, one Events line, KeySign, TimeSig and Tempo. Events are repeating triples: packed MIDI message integer, start beat, end beat. Observed 8332944 = 0x7f2690 = note-on status 0x90, pitch 38, velocity 127. Packing is status | (note << 8) | (velocity << 16); notes have explicit start/end positions in quarter-note beats. Verify against actual local samples rather than reusing any musical sequence. Use original generated events in tests. Important: later `Drumtracker { Track 0 { trackstuff ... } }` is a DIFFERENT audio-tracker state, not the song track. Its custom base64 payload decodes to `trackStuff`/GeneralStuff settings, while `tempoMap` decodes to XML. Do not mistake those opaque tracker fields for the song MIDI or add audio analysis. Do not alter them to implement song generation. ### Owned implementation - `formats/sdp.py`: real bounded versioned project parser, check/require, template-based writer and independent saved-file validator. - Only necessary shared model/profile/schema corrections and a nondefault evidence-backed SD3 3.4.4 subset profile/resource. - New/updated SD3 unit/integration/native contract/resource tests, format/ architecture/compatibility docs and `report_8_fix.md`. - No native service wiring/default-profile changes yet; that is the next fix. ### Constraints and acceptance 1. A project template is an operator-local configuration input, never bundled private state. Expose a typed template argument for the writer and an inspection/preflight API ready for later optional CLI configuration. Absent template is an explicit known native-capability limitation; corrupt, unsupported-version or unreadable explicitly supplied templates are errors, not silent MIDI fallback. No arbitrary code execution/template scripting. 2. Parse balanced native blocks with quoted/escaped strings correctly. Bound bytes/nesting/events. Reject unsupported version, malformed/unbalanced state, ambiguous active tracks and invalid music; preserve unrelated kit/ mixer/non-song template text byte-for-byte. 3. Replace ALL active template SongTrack musical data with one original generated drum track/clip. Do not accidentally retain original grooves, offsets, source MIDI references or extra active tracks. 4. Preserve requested tempo, meter, common start/end, drum pitches, velocities, channels and exact representable timing. Decode saved native event triples independently and compare musical events to the supplied plan/score. Explicitly reject any unsupported control/event semantics rather than drop. 5. The generated .sd3p must contain actual new song events, not only a preset, arbitrary JSON, an invented wrapper, a renamed MIDI or a copied old song. 6. Verify core drum note mapping from the local official manual/project/setup evidence. Keep the profile a verified SUBSET if only core voices are proven. Separate routing/intensity generator policy from vendor facts; do not call every GM sound the SD3 map. Existing defaults remain standard until integration. 7. Codec capability is not just a metadata flag. The actual template/version requirement must be testable and exposed to later service preflight. 8. Exclusive staged-path writes, explicit correct suffix, positive bounded file size, saved-file structural/content validation and no modifications of input templates. Any mismatch is a named serialization failure, not success. 9. Use generated original minimal test templates/state, no copied private or licensed project. Also run read-only local-template integration here with generated original music and retain only generated evidence outside source. 10. Test malformed/unsupported templates, quoting/nesting, multiple tracks, timing/packing boundaries, song replacement, unchanged non-song state, template identity/content preservation, wrong suffix, IO/corruption failures. Run full current suite, Ruff lint/format, strict mypy and package/resource checks as affected. Do not weaken prior working behavior. No commits, delegation, later prompts, source factory songs or service wiring. Write the full current implementation/testing/results/readiness report to `prompts/report_8_fix.md`, entirely inside one plain triple-backtick fence. Actual plugin/Cubase acceptance must be distinguished from structural native read-back; no fabricated application result. --- Historical gate (superseded by the genuine local evidence above): Status: real native acceptance BLOCKED; capability software reviewed/verified. Read `report_8.md` and `docs/formats/sdp.md`. The current boundary deliberately returns unavailable with no filesystem IO; it is not a native writer. ## Objective and inputs Implement real SD3 musical-content SDP export after lawful specifications or controlled real exports establish the container/version, song/groove fields, mapping dependencies and import workflow. Obtain empty/one-hit/multi-hit files, controlled timing/tempo/velocity/articulation differences, source/permission records, and actual SD3 version/library/map information. Do not bypass login, guess a different extension, emit preset-only state or rename MIDI. ## Owned files and constraints Modify `formats/sdp.py`, only necessary shared capability/profile definitions, SDP tests, format docs and compatibility matrix. Add fixtures only with rights; otherwise use documented private local evidence IDs. Preserve honest fallback and explicit errors. No commits, delegation, scope expansion or later prompts. ## Required tests and acceptance Unit-test evidence-based serialization, format/version invariants, invalid data, length/checksum/compression handling. Integration-test genuine round trips and generated drum-content equivalence. Record real SD3 import/inspect/save/reload and Cubase routing checks separately. Run related fallback/MIDI regressions, Ruff lint/format and strict types. Missing evidence remains blocked, not passed. The orchestrator must review the fix report before claiming native completion. When complete, write your end-of-step report to ./prompts/report_8_fix.md including: what was implemented, test results (pass/fail with details), any issues encountered, and whether you're ready for the next step Entire report: exactly one plain triple-backtick fence. Include commands, sources/fixture versions, native/application evidence, skips and blockers.