fxcue 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ${{ matrix.os }}
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ os: [ubuntu-latest, macos-latest, windows-latest]
14
+ python: ["3.10", "3.12", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python }}
20
+ - name: Install FFmpeg (Linux)
21
+ if: runner.os == 'Linux'
22
+ run: sudo apt-get update && sudo apt-get install -y ffmpeg
23
+ - name: Install FFmpeg (macOS)
24
+ if: runner.os == 'macOS'
25
+ run: brew install ffmpeg
26
+ - name: Install FFmpeg (Windows)
27
+ if: runner.os == 'Windows'
28
+ run: choco install ffmpeg -y --no-progress
29
+ - run: pip install -e ".[dev]"
30
+ - run: pytest -v
31
+ - run: python -m build
@@ -0,0 +1,48 @@
1
+ name: Publish to PyPI
2
+
3
+ # Runs when a GitHub Release (tag v1.2.3) is published.
4
+ # Uses PyPI trusted publishing: no API tokens are stored in this repository.
5
+ on:
6
+ release:
7
+ types: [published]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: "3.12"
17
+ - name: Check the release tag matches the package version
18
+ run: |
19
+ VERSION=$(python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
20
+ TAG="${GITHUB_REF_NAME#v}"
21
+ if [ "$VERSION" != "$TAG" ]; then
22
+ echo "Release tag $GITHUB_REF_NAME does not match pyproject version $VERSION"; exit 1
23
+ fi
24
+ - run: pip install build && python -m build
25
+ - name: Smoke-test the wheel
26
+ run: |
27
+ sudo apt-get update && sudo apt-get install -y ffmpeg
28
+ pip install dist/*.whl
29
+ fxcue --version
30
+ - uses: actions/upload-artifact@v4
31
+ with:
32
+ name: dist
33
+ path: dist/
34
+
35
+ publish:
36
+ needs: build
37
+ runs-on: ubuntu-latest
38
+ environment:
39
+ name: pypi
40
+ url: https://pypi.org/project/fxcue/
41
+ permissions:
42
+ id-token: write
43
+ steps:
44
+ - uses: actions/download-artifact@v4
45
+ with:
46
+ name: dist
47
+ path: dist/
48
+ - uses: pypa/gh-action-pypi-publish@release/v1
fxcue-0.1.0/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ dist/
4
+ build/
5
+ .pytest_cache/
6
+ .superpowers/
7
+ .venv/
@@ -0,0 +1,29 @@
1
+ # Contributing to fxcue
2
+
3
+ Thanks for helping! Good first contributions:
4
+
5
+ - a new **style** in `src/fxcue/styles.py`
6
+ - a new **detector** in `src/fxcue/detectors/`
7
+ - better default thresholds, backed by a test clip
8
+ - docs and examples
9
+
10
+ ## Set up
11
+
12
+ ```bash
13
+ git clone https://github.com/roy13dec-droid/fxcue && cd fxcue
14
+ pip install -e ".[dev]"
15
+ pytest
16
+ ```
17
+
18
+ You need FFmpeg (system install or the bundled `imageio-ffmpeg`).
19
+
20
+ ## Rules of the road
21
+
22
+ - **Tests first.** Tests use tiny synthetic videos generated with FFmpeg in
23
+ `tests/conftest.py`, so the expected cut, burst and beat times are known exactly.
24
+ Add a fixture rather than committing video files.
25
+ - **Keep the core light.** No PyTorch or GPU dependencies in the core package.
26
+ Heavy detectors belong in optional extras or separate packages.
27
+ - **Every cue needs a reason.** Developers show these reasons to their users.
28
+ - **Don't spam effects.** Defaults should look good to a beginner, not maximise cue count.
29
+ - Changing the JSON format means bumping `SCHEMA_VERSION`.
fxcue-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anal Kanti Roy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
fxcue-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.5
2
+ Name: fxcue
3
+ Version: 0.1.0
4
+ Summary: Turn a video into a timestamped, explained effects plan (zooms, transitions, shakes, whooshes) for beginner-friendly editing apps.
5
+ Project-URL: Homepage, https://github.com/roy13dec-droid/fxcue
6
+ Project-URL: Issues, https://github.com/roy13dec-droid/fxcue/issues
7
+ Author: Anal Kanti Roy
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: beats,editing,effects,ffmpeg,scene-detection,video
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Multimedia :: Video
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: imageio-ffmpeg>=0.5
17
+ Requires-Dist: librosa>=0.10
18
+ Requires-Dist: numpy>=1.24
19
+ Requires-Dist: opencv-python-headless>=4.8
20
+ Requires-Dist: scenedetect>=0.6.4
21
+ Provides-Extra: dev
22
+ Requires-Dist: build; extra == 'dev'
23
+ Requires-Dist: pytest>=8; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # fxcue
27
+
28
+ **Tell your users where the effects go.**
29
+
30
+ `fxcue` analyses a video and returns an **effects plan**: a list of timestamped
31
+ effect cues (zooms, transitions, shakes, whooshes…), each with the reason it was
32
+ placed there. It is built for developers making beginner-friendly editing apps,
33
+ auto-clippers and video tools. Your app decides how to show or apply each cue.
34
+
35
+ ```
36
+ 0:02.0 transition 1.0 scene change
37
+ 0:02.0 whoosh_sfx 1.0 scene change
38
+ 0:12.4 zoom_in 0.6 loud moment
39
+ 0:45.2 shake 0.7 strong hit
40
+ ```
41
+
42
+ - Fast, offline and lightweight. No GPU and no AI model downloads.
43
+ - Explainable: every cue says *why* it was placed.
44
+ - Never cluttered: built-in spacing keeps effects from piling up.
45
+ - Pluggable: add your own detectors and rules.
46
+ - Plain JSON output that any language can read.
47
+
48
+ ## Install
49
+
50
+ ```bash
51
+ pip install fxcue
52
+ ```
53
+
54
+ fxcue reads video through [FFmpeg](https://ffmpeg.org). If FFmpeg isn't on your
55
+ system, the bundled `imageio-ffmpeg` binary is used automatically.
56
+
57
+ ## Quickstart
58
+
59
+ ```python
60
+ import fxcue
61
+
62
+ plan = fxcue.plan("video.mp4", style="energetic")
63
+ for cue in plan.cues:
64
+ print(cue.time, cue.effect, cue.reason)
65
+ plan.save("plan.json")
66
+ ```
67
+
68
+ Or from the command line:
69
+
70
+ ```bash
71
+ fxcue video.mp4 # print the plan
72
+ fxcue video.mp4 -o plan.json # save it as JSON
73
+ fxcue video.mp4 --style calm
74
+ ```
75
+
76
+ ## Effects
77
+
78
+ Effect names are generic, so your app can map each one to its own assets.
79
+
80
+ | Effect | Kind | Placed on (energetic style) |
81
+ |---------------|--------|--------------------------------------|
82
+ | `transition` | visual | scene changes |
83
+ | `whoosh_sfx` | audio | scene changes |
84
+ | `zoom_in` | visual | loud moments |
85
+ | `punch_zoom` | visual | very loud moments (replaces zoom_in) |
86
+ | `impact_sfx` | audio | very loud moments |
87
+ | `shake` | visual | strong hits |
88
+ | `flash` | visual | strong music beats |
89
+
90
+ ## Styles
91
+
92
+ | Style | Min gap between visual effects | Max visual effects per minute | Uses |
93
+ |-------------|----|----|-----------------------------------------------|
94
+ | `calm` | 4 s | 6 | transitions, zooms on very loud moments |
95
+ | `energetic` | 1.5 s | 20 | everything above (default) |
96
+ | `vlog` | 2.5 s | 12 | transitions + whooshes, zooms |
97
+
98
+ There is never more than one visual effect at the same moment. A sound effect
99
+ is dropped when the visual effect it belongs to is dropped.
100
+
101
+ ## JSON output
102
+
103
+ ```json
104
+ {
105
+ "schema_version": 1,
106
+ "duration": 6.0,
107
+ "style": "energetic",
108
+ "cues": [
109
+ {"time": 2.0, "effect": "transition", "strength": 1.0,
110
+ "reason": "scene change", "source": "scenes", "duration": 0.5}
111
+ ]
112
+ }
113
+ ```
114
+
115
+ `duration` is a suggested length in seconds; apps may ignore it. Load a saved
116
+ plan with `fxcue.Plan.load("plan.json")`.
117
+
118
+ ## Customise
119
+
120
+ **Your own rules** replace the style's rules but keep its spacing:
121
+
122
+ ```python
123
+ from fxcue import Rule
124
+
125
+ plan = fxcue.plan("video.mp4", rules=[
126
+ Rule("scene_change", ["flash", "whoosh_sfx"]),
127
+ Rule("loud_peak", ["shake"], min_strength=0.5),
128
+ ])
129
+ ```
130
+
131
+ Event kinds from the built-in detectors are `scene_change`, `loud_peak`, `beat` and `onset`.
132
+
133
+ **Your own detector**, for example one using an AI model:
134
+
135
+ ```python
136
+ from fxcue import Event
137
+
138
+ class LaughDetector:
139
+ name = "laughs"
140
+ needs = "audio" # or "video"
141
+
142
+ def detect(self, media): # media.path, media.audio (samples, rate) or None, media.duration
143
+ return [Event(time=12.3, kind="loud_peak", strength=0.9, source=self.name)]
144
+
145
+ fxcue.register_detector(LaughDetector()) # used by every plan() call from now on
146
+ ```
147
+
148
+ ## How it works
149
+
150
+ ```
151
+ video ─► detectors ─► events ─► style rules ─► spacing pass ─► plan
152
+ ```
153
+
154
+ - **scenes**: hard cuts, found with [PySceneDetect](https://www.scenedetect.com/)
155
+ - **loudness**: moments much louder than the clip's own typical level ([librosa](https://librosa.org/))
156
+ - **beats**: music beats and strong hits (librosa)
157
+
158
+ ## Roadmap
159
+
160
+ - Optional preview render, so you can see a plan applied
161
+ - Optional AI detectors (speech emphasis, laughter, faces)
162
+ - More effects and styles, contributed by the community
163
+
164
+ ## Contributing
165
+
166
+ Contributions are welcome, especially new detectors, styles and effect ideas.
167
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
168
+
169
+ ## Licence
170
+
171
+ MIT © Anal Kanti Roy. See [LICENSE](LICENSE).
fxcue-0.1.0/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # fxcue
2
+
3
+ **Tell your users where the effects go.**
4
+
5
+ `fxcue` analyses a video and returns an **effects plan**: a list of timestamped
6
+ effect cues (zooms, transitions, shakes, whooshes…), each with the reason it was
7
+ placed there. It is built for developers making beginner-friendly editing apps,
8
+ auto-clippers and video tools. Your app decides how to show or apply each cue.
9
+
10
+ ```
11
+ 0:02.0 transition 1.0 scene change
12
+ 0:02.0 whoosh_sfx 1.0 scene change
13
+ 0:12.4 zoom_in 0.6 loud moment
14
+ 0:45.2 shake 0.7 strong hit
15
+ ```
16
+
17
+ - Fast, offline and lightweight. No GPU and no AI model downloads.
18
+ - Explainable: every cue says *why* it was placed.
19
+ - Never cluttered: built-in spacing keeps effects from piling up.
20
+ - Pluggable: add your own detectors and rules.
21
+ - Plain JSON output that any language can read.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ pip install fxcue
27
+ ```
28
+
29
+ fxcue reads video through [FFmpeg](https://ffmpeg.org). If FFmpeg isn't on your
30
+ system, the bundled `imageio-ffmpeg` binary is used automatically.
31
+
32
+ ## Quickstart
33
+
34
+ ```python
35
+ import fxcue
36
+
37
+ plan = fxcue.plan("video.mp4", style="energetic")
38
+ for cue in plan.cues:
39
+ print(cue.time, cue.effect, cue.reason)
40
+ plan.save("plan.json")
41
+ ```
42
+
43
+ Or from the command line:
44
+
45
+ ```bash
46
+ fxcue video.mp4 # print the plan
47
+ fxcue video.mp4 -o plan.json # save it as JSON
48
+ fxcue video.mp4 --style calm
49
+ ```
50
+
51
+ ## Effects
52
+
53
+ Effect names are generic, so your app can map each one to its own assets.
54
+
55
+ | Effect | Kind | Placed on (energetic style) |
56
+ |---------------|--------|--------------------------------------|
57
+ | `transition` | visual | scene changes |
58
+ | `whoosh_sfx` | audio | scene changes |
59
+ | `zoom_in` | visual | loud moments |
60
+ | `punch_zoom` | visual | very loud moments (replaces zoom_in) |
61
+ | `impact_sfx` | audio | very loud moments |
62
+ | `shake` | visual | strong hits |
63
+ | `flash` | visual | strong music beats |
64
+
65
+ ## Styles
66
+
67
+ | Style | Min gap between visual effects | Max visual effects per minute | Uses |
68
+ |-------------|----|----|-----------------------------------------------|
69
+ | `calm` | 4 s | 6 | transitions, zooms on very loud moments |
70
+ | `energetic` | 1.5 s | 20 | everything above (default) |
71
+ | `vlog` | 2.5 s | 12 | transitions + whooshes, zooms |
72
+
73
+ There is never more than one visual effect at the same moment. A sound effect
74
+ is dropped when the visual effect it belongs to is dropped.
75
+
76
+ ## JSON output
77
+
78
+ ```json
79
+ {
80
+ "schema_version": 1,
81
+ "duration": 6.0,
82
+ "style": "energetic",
83
+ "cues": [
84
+ {"time": 2.0, "effect": "transition", "strength": 1.0,
85
+ "reason": "scene change", "source": "scenes", "duration": 0.5}
86
+ ]
87
+ }
88
+ ```
89
+
90
+ `duration` is a suggested length in seconds; apps may ignore it. Load a saved
91
+ plan with `fxcue.Plan.load("plan.json")`.
92
+
93
+ ## Customise
94
+
95
+ **Your own rules** replace the style's rules but keep its spacing:
96
+
97
+ ```python
98
+ from fxcue import Rule
99
+
100
+ plan = fxcue.plan("video.mp4", rules=[
101
+ Rule("scene_change", ["flash", "whoosh_sfx"]),
102
+ Rule("loud_peak", ["shake"], min_strength=0.5),
103
+ ])
104
+ ```
105
+
106
+ Event kinds from the built-in detectors are `scene_change`, `loud_peak`, `beat` and `onset`.
107
+
108
+ **Your own detector**, for example one using an AI model:
109
+
110
+ ```python
111
+ from fxcue import Event
112
+
113
+ class LaughDetector:
114
+ name = "laughs"
115
+ needs = "audio" # or "video"
116
+
117
+ def detect(self, media): # media.path, media.audio (samples, rate) or None, media.duration
118
+ return [Event(time=12.3, kind="loud_peak", strength=0.9, source=self.name)]
119
+
120
+ fxcue.register_detector(LaughDetector()) # used by every plan() call from now on
121
+ ```
122
+
123
+ ## How it works
124
+
125
+ ```
126
+ video ─► detectors ─► events ─► style rules ─► spacing pass ─► plan
127
+ ```
128
+
129
+ - **scenes**: hard cuts, found with [PySceneDetect](https://www.scenedetect.com/)
130
+ - **loudness**: moments much louder than the clip's own typical level ([librosa](https://librosa.org/))
131
+ - **beats**: music beats and strong hits (librosa)
132
+
133
+ ## Roadmap
134
+
135
+ - Optional preview render, so you can see a plan applied
136
+ - Optional AI detectors (speech emphasis, laughter, faces)
137
+ - More effects and styles, contributed by the community
138
+
139
+ ## Contributing
140
+
141
+ Contributions are welcome, especially new detectors, styles and effect ideas.
142
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
143
+
144
+ ## Licence
145
+
146
+ MIT © Anal Kanti Roy. See [LICENSE](LICENSE).
@@ -0,0 +1,143 @@
1
+ # fxcue v1 Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** A pip-installable Python library + CLI that turns a video into a timestamped, explained effects plan (JSON).
6
+
7
+ **Architecture:** Detectors (scenes, loudness, beats) emit `Event`s; a style's rules map events to `Cue`s; a spacing pass removes collisions; `Plan` serialises to versioned JSON. Detectors are pluggable via a registry.
8
+
9
+ **Tech Stack:** Python 3.10+, PySceneDetect + opencv-python-headless, librosa, numpy, imageio-ffmpeg (FFmpeg fallback), pytest, hatchling, GitHub Actions.
10
+
11
+ **Spec:** `docs/superpowers/specs/2026-11-29-fxcue-design.md`
12
+
13
+ ## Global Constraints
14
+
15
+ - Python 3.10+; Linux/macOS/Windows.
16
+ - No PyTorch / GPU dependency in core.
17
+ - Licence MIT. Package name `fxcue`.
18
+ - Effect vocabulary exactly: `transition`, `zoom_in`, `punch_zoom`, `shake`, `flash`, `whoosh_sfx`, `impact_sfx`.
19
+ - Styles exactly: `calm`, `energetic` (default), `vlog`.
20
+ - JSON contains `"schema_version": 1`, `duration`, `style`, `cues`.
21
+ - Every cue carries a non-empty `reason` and `source`.
22
+ - Never more than one visual effect at the same moment (audio effects may coincide with one visual).
23
+
24
+ ## Review Focus
25
+
26
+ 1. Video with **no audio track** → plan still produced from scenes only; no crash (Task 6).
27
+ 2. **Silent or constant-volume audio** → zero loudness cues, not false peaks (Task 3).
28
+ 3. **Missing / unreadable file** → `FileNotFoundError` / `fxcue.MediaError` with the path in the message (Task 2).
29
+ 4. **Very short clip** (< 1 s) or no events → valid plan with empty `cues` (Task 6).
30
+ 5. **FFmpeg unavailable** and no `imageio-ffmpeg` → `MediaError` naming FFmpeg and how to install it (Task 2).
31
+
32
+ ---
33
+
34
+ ### Task 1: Project skeleton and data model
35
+
36
+ **Files:**
37
+ - Create: `pyproject.toml`, `LICENSE` (MIT, "Anal Kanti Roy"), `.gitignore`, `src/fxcue/__init__.py`, `src/fxcue/models.py`
38
+ - Test: `tests/test_models.py`
39
+
40
+ **Interfaces:**
41
+ - Produces:
42
+ - `Event(time: float, kind: str, strength: float, source: str)` — frozen dataclass; `strength` clamped to 0–1.
43
+ - `Cue(time: float, effect: str, strength: float, reason: str, source: str, duration: float = 0.0)` — frozen dataclass; `effect` must be in `EFFECTS` else `ValueError`.
44
+ - `EFFECTS: frozenset[str]`, `VISUAL_EFFECTS`, `AUDIO_EFFECTS` (`whoosh_sfx`, `impact_sfx`).
45
+ - `Plan(duration: float, style: str, cues: list[Cue])` with `to_dict()`, `to_json(indent=2)`, `save(path)`, `classmethod load(path)`; cues always sorted by time.
46
+
47
+ - [ ] **Step 1:** `git init`; write `pyproject.toml` (hatchling, src layout, deps listed in Tech Stack, `[project.scripts] fxcue = "fxcue.cli:main"`, extras `dev = [pytest]`).
48
+ - [ ] **Step 2: Write failing tests** — `test_cue_rejects_unknown_effect` (`Cue(1,"explode",...)` raises `ValueError`); `test_plan_roundtrip` (save → load equals original, `to_dict()["schema_version"] == 1`); `test_plan_sorts_cues`; `test_event_strength_clamped` (`Event(0,"x",1.7,"s").strength == 1.0`).
49
+ - [ ] **Step 3:** Run `pytest tests/test_models.py -v` → FAIL (import error).
50
+ - [ ] **Step 4:** Implement `models.py`; export names from `__init__.py`.
51
+ - [ ] **Step 5:** Run tests → PASS.
52
+ - [ ] **Step 6:** Commit `feat: data model for events, cues and plans`.
53
+
54
+ ### Task 2: Media loading and test fixtures
55
+
56
+ **Files:**
57
+ - Create: `src/fxcue/media.py`, `tests/conftest.py`
58
+ - Test: `tests/test_media.py`
59
+
60
+ **Interfaces:**
61
+ - Produces:
62
+ - `class MediaError(Exception)` (exported from `fxcue`).
63
+ - `ffmpeg_path() -> str` — system `ffmpeg` on PATH, else `imageio_ffmpeg.get_ffmpeg_exe()`, else `MediaError` mentioning "FFmpeg" and install hint.
64
+ - `load_audio(path: str, sr: int = 22050) -> tuple[np.ndarray, int] | None` — mono float32 via FFmpeg pipe; `None` if the file has no audio stream.
65
+ - `probe_duration(path) -> float`.
66
+ - conftest fixtures (generated once per session into `tmp_path_factory` with FFmpeg): `cuts_video` (6 s, colour changes at exactly 2.0 s and 4.0 s, silent audio), `bursts_video` (6 s single colour, quiet tone with loud bursts at 1.5 s and 4.5 s), `clicks_video` (8 s, click track at 120 BPM), `noaudio_video` (3 s, no audio stream), `short_video` (0.5 s).
67
+
68
+ - [ ] **Step 1: Failing tests** — `test_missing_file_raises` (`FileNotFoundError`, path in message); `test_no_audio_returns_none`; `test_load_audio_length` (bursts_video → `len(y)/sr ≈ 6.0 ± 0.1`); `test_ffmpeg_missing_message` (monkeypatch both lookups → `MediaError` containing "FFmpeg"); `test_probe_duration`.
69
+ - [ ] **Step 2:** Run → FAIL.
70
+ - [ ] **Step 3:** Implement `media.py` and fixtures (FFmpeg `lavfi` sources: `color`, `sine`, `aevalsrc`/`anullsrc`; concat for cuts).
71
+ - [ ] **Step 4:** Run → PASS. Commit `feat: media loading with ffmpeg fallback and synthetic fixtures`.
72
+
73
+ ### Task 3: Audio detectors (loudness, beats)
74
+
75
+ **Files:**
76
+ - Create: `src/fxcue/detectors/__init__.py`, `src/fxcue/detectors/audio.py`
77
+ - Test: `tests/test_audio_detectors.py`
78
+
79
+ **Interfaces:**
80
+ - Consumes: `Event`, `load_audio`.
81
+ - Produces: `Detector` protocol `name: str; needs: "audio" | "video"; detect(media: Media) -> list[Event]` where `Media(path: str, audio: tuple[np.ndarray,int] | None, duration: float)` (dataclass in `detectors/__init__.py`).
82
+ - `LoudnessDetector(threshold_db: float = 6.0)` → `kind="loud_peak"`: RMS frames rising ≥ threshold above the clip's median RMS; peaks merged within 0.5 s; strength scaled 0–1 by excess dB.
83
+ - `BeatDetector()` → `kind="beat"` (librosa `beat_track`) and `kind="onset"` for strong onsets; strength from onset envelope.
84
+ - Both return `[]` when `media.audio is None`.
85
+
86
+ - [ ] **Step 1: Failing tests** — `test_loudness_finds_bursts` (times ≈ [1.5, 4.5] ± 0.15); `test_loudness_silent_is_empty` (cuts_video audio → `[]`); `test_loudness_constant_tone_is_empty` (pure sine array → `[]`); `test_beats_tempo` (clicks_video → ≥ 12 beats, median gap ≈ 0.5 s ± 0.05); `test_detectors_no_audio` (both → `[]`).
87
+ - [ ] **Step 2:** Run → FAIL. **Step 3:** Implement. **Step 4:** Run → PASS.
88
+ - [ ] **Step 5:** Commit `feat: loudness and beat detectors`.
89
+
90
+ ### Task 4: Scene detector
91
+
92
+ **Files:**
93
+ - Create: `src/fxcue/detectors/video.py`
94
+ - Test: `tests/test_scene_detector.py`
95
+
96
+ **Interfaces:**
97
+ - Produces: `SceneDetector(threshold: float = 27.0)` → `kind="scene_change"`, strength 1.0 (or normalised content score), using PySceneDetect `ContentDetector`; ignores the cut at t=0.
98
+
99
+ - [ ] **Step 1: Failing tests** — `test_scene_cuts` (cuts_video → times ≈ [2.0, 4.0] ± 0.1); `test_single_shot_no_cuts` (bursts_video → `[]`).
100
+ - [ ] **Step 2–4:** Run FAIL → implement → PASS. Commit `feat: scene change detector`.
101
+
102
+ ### Task 5: Rules, styles and spacing
103
+
104
+ **Files:**
105
+ - Create: `src/fxcue/rules.py`, `src/fxcue/styles.py`
106
+ - Test: `tests/test_rules.py`
107
+
108
+ **Interfaces:**
109
+ - Produces:
110
+ - `Rule(kind: str, effects: list[str], min_strength: float = 0.0, strong_effect: str | None = None, strong_at: float = 0.85)` with `apply(event) -> list[Cue]`; `reason` text like `"scene change"`, `"loud moment"`, `"music beat"`.
111
+ - `Style(name, rules: list[Rule], min_gap: float, max_per_minute: int)`.
112
+ - `STYLES: dict[str, Style]` with defaults: `calm` (min_gap 4.0, max 6/min, scenes → transition only, loud → zoom_in ≥0.7), `energetic` (min_gap 1.5, max 20/min, scene → transition+whoosh_sfx, loud → zoom_in / punch_zoom when strong + impact_sfx, onset → shake ≥0.6, beat → flash ≥0.8), `vlog` (min_gap 2.5, max 12/min, scene → transition+whoosh_sfx, loud → zoom_in).
113
+ - `space_cues(cues: list[Cue], min_gap: float, max_per_minute: int, duration: float) -> list[Cue]` — greedy by strength desc: accept a visual cue only if no accepted visual cue within `min_gap`; audio cues kept only if their paired visual survived or no visual is within 0.1 s; then enforce per-minute cap by strength.
114
+
115
+ - [ ] **Step 1: Failing tests** — `test_scene_rule_energetic` (one scene event → `transition` + `whoosh_sfx` at same time); `test_strong_loud_punch_zoom`; `test_spacing_keeps_strongest` (visual cues at 1.0/0.5-strength and 1.4/0.9-strength, gap 1.5 → only 1.4 kept); `test_never_two_visuals_same_time`; `test_per_minute_cap` (100 events in 60 s, calm → ≤ 6 visual cues); `test_unknown_style_raises` (`ValueError` listing valid styles).
116
+ - [ ] **Step 2–4:** FAIL → implement → PASS. Commit `feat: rules, styles and spacing pass`.
117
+
118
+ ### Task 6: `plan()` entry point, registry and CLI
119
+
120
+ **Files:**
121
+ - Create: `src/fxcue/core.py`, `src/fxcue/cli.py`
122
+ - Modify: `src/fxcue/__init__.py`
123
+ - Test: `tests/test_plan.py`, `tests/test_cli.py`
124
+
125
+ **Interfaces:**
126
+ - Consumes: all above.
127
+ - Produces:
128
+ - `plan(path, style: str | Style = "energetic", detectors: list[Detector] | None = None, rules: list[Rule] | None = None) -> Plan` (custom `rules` replace the style's rules but keep its spacing).
129
+ - `register_detector(detector: Detector) -> None`; default detectors = scenes, loudness, beats + registered ones.
130
+ - CLI: `fxcue VIDEO [-o OUT] [--style NAME]`; prints a readable table (`0:12.4 zoom_in 0.8 loud moment`) or writes JSON when `-o`; exit code 1 with message on `MediaError`/`FileNotFoundError`.
131
+
132
+ - [ ] **Step 1: Failing tests** — `test_plan_cuts_video` (energetic → transitions at ≈2.0 and ≈4.0); `test_plan_no_audio` (noaudio_video → valid Plan, no exception); `test_plan_short_video_empty` (short_video → `cues == []`); `test_custom_detector_registered` (fake detector emitting `scene_change` at 1.0 → cue at 1.0 with its `source`); `test_cli_writes_json` (via `subprocess` / `main([...])`, file has `schema_version` 1); `test_cli_missing_file_exit_1`.
133
+ - [ ] **Step 2–4:** FAIL → implement → PASS. Commit `feat: plan() API, detector registry and CLI`.
134
+
135
+ ### Task 7: README, CI and release readiness
136
+
137
+ **Files:**
138
+ - Create: `README.md`, `.github/workflows/ci.yml`, `CONTRIBUTING.md`, `examples/basic.py`
139
+
140
+ - [ ] **Step 1:** README: one-line pitch, install (`pip install fxcue`, FFmpeg note), 6-line quickstart from the spec, CLI example, effect vocabulary table, styles table, JSON schema example, "write your own detector" example, roadmap (preview render, AI detectors), MIT badge.
141
+ - [ ] **Step 2:** CI: matrix Python 3.10/3.12 × ubuntu/macos/windows; installs FFmpeg; `pip install -e .[dev]`; `pytest`.
142
+ - [ ] **Step 3:** Run `python examples/basic.py` on `cuts_video`-like file and `python -m build` → wheel builds.
143
+ - [ ] **Step 4:** Run full `pytest -v` → all PASS. Commit `docs: README, contributing guide, CI`.