Skip to main content
Swift

torchslit-ios

iOS long-exposure camera with bulb control and torch scripting

Files
14
Size
51.5 KB
Langs
3
Created
Jan 11, 2026
Last push
9 months ago
README.md

Torchslit (Vulpes)

iOS "Bulb + Torch" Camera for Long-Exposure Photography

What is it?

Torchslit is a camera app that lets you shoot true-feeling bulb-style long exposures on iPhone while precisely scripting the iPhone's rear LED (torch) as a timed light source—tap-to-burst, scheduled bursts, and repeatable "light scripts" you can replay.

Why?

iPhone's stock camera is missing what long-exposure people actually want:

  • Bulb control: "start exposure… stop exposure" (not a fixed shutter time)
  • Light control: timed bursts of light during the exposure (for light painting, selective illumination)
  • Repeatability: save a lighting pattern and reproduce it

Core Concept

Two engines running together:

  1. Bulb Capture Engine — Captures continuous frames and accumulates them into a single long-exposure image
  2. Light Script Engine — Controls the LED: burst for X seconds, follow a timed sequence, repeat at intervals, or live tap/hold

Project Structure

Torchslit/
├── Sources/
│   ├── App/
│   │   └── TorchslitApp.swift       # App entry point
│   ├── Views/
│   │   ├── ContentView.swift        # Main camera UI
│   │   ├── CameraPreviewView.swift  # Camera preview layer
│   │   └── SettingsView.swift       # Settings sheet
│   ├── Engines/
│   │   ├── CameraManager.swift      # Central state manager
│   │   ├── BulbCaptureEngine.swift  # Frame accumulation (Metal)
│   │   └── LightScriptEngine.swift  # Torch control + timing
│   ├── Models/
│   │   ├── LightScript.swift        # Replayable lighting patterns
│   │   └── CaptureRecipe.swift      # Capture metadata
│   └── Shaders/
│       └── Accumulation.metal       # GPU blend modes
├── Resources/
└── Info.plist

MVP Features

  • Bulb start/stop capture
  • Manual burst (tap to fire torch)
  • Duration selector (0.25s - 5s)
  • Intensity slider
  • Interval burst mode
  • Three blend modes (Max, Additive, Average)
  • Thermal state monitoring
  • Save to Photos with metadata
  • Recipe sidecar export

V1 Features (Later)

  • Light Script editor UI
  • Script presets library
  • Apple Watch remote
  • Live touch mode (hold = torch on)
  • Dark frame subtraction
  • RAW/DNG export

Building

  1. Open in Xcode 15+
  2. Set your development team
  3. Build and run on device (torch requires real hardware)

Technical Notes

Frame Accumulation

Uses Metal compute shaders for real-time blending:

  • Max: Brightest pixel wins (light trails, star trails)
  • Additive: Pixels add together (classic long exposure)
  • Average: Running average (water smoothing, traffic)

Torch Control

Uses AVCaptureDevice.setTorchModeOn(level:) with safety guards:

  • Thermal state monitoring
  • Consecutive burst limits
  • Cooldown periods

Timing

Uses monotonic clock for consistent timestamps across:

  • Shot start/end
  • Frame ingestion
  • Torch events

License

MIT