diff --git a/.gitignore b/.gitignore index 44b2e44..625c206 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,6 @@ scripts/diarize/__pycache__/ # Editor .vscode/settings.json + +# Rust spike build artifacts +spike/audio-sync/target/ diff --git a/docs/implementation-guides/issue-95-rust-scaffold.md b/docs/implementation-guides/issue-95-rust-scaffold.md new file mode 100644 index 0000000..74d059f --- /dev/null +++ b/docs/implementation-guides/issue-95-rust-scaffold.md @@ -0,0 +1,49 @@ +# Issue #95 — spike(rust/scaffold): create spike/audio-sync Cargo binary crate + +## Goal + +Create a minimal, buildable Cargo binary crate at `spike/audio-sync/` as a clean skeleton for subsequent Rust spike issues (#96, #97, #98). No algorithm logic — stubs only. + +## Steps + +### Step 1 — Create Cargo.toml + +Create `spike/audio-sync/Cargo.toml` as a standalone manifest (no workspace). + +**Status check:** `test -f spike/audio-sync/Cargo.toml` + +### Step 2 — Create src/main.rs and src/lib.rs stubs + +Create `spike/audio-sync/src/main.rs` with stub `main()` and `spike/audio-sync/src/lib.rs` as an empty file. + +**Status check:** `test -f spike/audio-sync/src/main.rs && test -f spike/audio-sync/src/lib.rs` + +### Step 3 — Add spike/audio-sync/target/ to .gitignore + +Append `spike/audio-sync/target/` to the root `.gitignore` so build artifacts are not tracked. + +**Status check:** `grep -q 'spike/audio-sync/target/' .gitignore` + +### Step 4 — Add spike/audio-sync/README.md + +Create setup and usage instructions for peers who need to install Rust. + +**Status check:** `test -f spike/audio-sync/README.md` + +### Step 5 — Verify build + +Run `cargo build --manifest-path spike/audio-sync/Cargo.toml` and confirm exit 0. + +**Status check:** `cargo build --manifest-path spike/audio-sync/Cargo.toml && echo OK` + +### Step 6 — Commit + +Commit `Cargo.toml`, `Cargo.lock`, `src/main.rs`, `src/lib.rs`, `README.md`, and `.gitignore` change. + +**Status check:** `git log --oneline -1 | grep -q 'spike(rust/scaffold)'` + +## Out of scope + +- Any algorithm logic +- Root-level `Cargo.toml` workspace +- CI configuration diff --git a/spike/audio-sync/Cargo.lock b/spike/audio-sync/Cargo.lock new file mode 100644 index 0000000..83dd763 --- /dev/null +++ b/spike/audio-sync/Cargo.lock @@ -0,0 +1,89 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "audio-sync" +version = "0.1.0" +dependencies = [ + "hound", + "rustfft", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "hound" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f" + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "primal-check" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0d895b311e3af9902528fbb8f928688abbd95872819320517cc24ca6b2bd08" +dependencies = [ + "num-integer", +] + +[[package]] +name = "rustfft" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21db5f9893e91f41798c88680037dba611ca6674703c1a18601b01a72c8adb89" +dependencies = [ + "num-complex", + "num-integer", + "num-traits", + "primal-check", + "strength_reduce", + "transpose", +] + +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] diff --git a/spike/audio-sync/Cargo.toml b/spike/audio-sync/Cargo.toml new file mode 100644 index 0000000..88163f4 --- /dev/null +++ b/spike/audio-sync/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "audio-sync" +version = "0.1.0" +edition = "2021" + +[dependencies] +rustfft = "6" +hound = "3" diff --git a/spike/audio-sync/README.md b/spike/audio-sync/README.md new file mode 100644 index 0000000..632cc79 --- /dev/null +++ b/spike/audio-sync/README.md @@ -0,0 +1,61 @@ +# audio-sync spike + +Standalone Rust binary for FFT cross-correlation sync. Part of the RFC 0001 Rust rewrite spike (see [issue #93](https://github.com/ragTechDev/deckcreate/issues/93)). + +> **Temporary** — this crate lives under `spike/` and will be deleted when the spike concludes. + +## Prerequisites + +Rust stable toolchain via `rustup`: + +```bash +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +Then restart your shell (or run `source "$HOME/.cargo/env"`), and verify: + +```bash +rustc --version # e.g. rustc 1.79.0 +cargo --version +``` + +No other dependencies — `rustfft` and `hound` are pure Rust and compile without any system libraries. + +## Build + +From the repo root: + +```bash +cargo build --manifest-path spike/audio-sync/Cargo.toml +``` + +Or from inside the crate: + +```bash +cd spike/audio-sync +cargo build +``` + +## Run + +```bash +cargo run --manifest-path spike/audio-sync/Cargo.toml +# → audio-sync spike — not yet implemented +``` + +## Dependencies + +| Crate | Version | Purpose | +|-------|---------|---------| +| `rustfft` | 6 | Pure-Rust FFT (no native deps, deterministic across platforms) | +| `hound` | 3 | WAV file reader/writer | + +## Fixtures + +Test WAV files are in `fixtures/`: + +| File | Description | +|------|-------------| +| `fixtures/audio-track.wav` | Isolated audio track | +| `fixtures/video-audio.wav` | Audio extracted from video | +| `fixtures/baseline.json` | JS baseline offset for cross-validation | diff --git a/spike/audio-sync/src/lib.rs b/spike/audio-sync/src/lib.rs new file mode 100644 index 0000000..e69de29 diff --git a/spike/audio-sync/src/main.rs b/spike/audio-sync/src/main.rs new file mode 100644 index 0000000..a347589 --- /dev/null +++ b/spike/audio-sync/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("audio-sync spike — not yet implemented"); +}