diff --git a/Sources/ClearFlow/ClearFlowApp.swift b/Sources/ClearFlow/ClearFlowApp.swift index 2bea67c..00748ff 100644 --- a/Sources/ClearFlow/ClearFlowApp.swift +++ b/Sources/ClearFlow/ClearFlowApp.swift @@ -6,6 +6,12 @@ import ClearFlowCore @main @MainActor enum ClearFlowMain { static func main() { let args = CommandLine.arguments + if args.count == 4 && args[1] == "--render-reveal" { + guard ["landscape", "portrait"].contains(args[3]) else { fputs("Use landscape or portrait\n", stderr); exit(1) } + do { try SocialPreview.render(to: URL(fileURLWithPath: args[2]), portrait: args[3] == "portrait") } + catch { fputs("Reveal rendering failed\n", stderr); exit(1) } + return + } if args.count == 3 && args[1] == "--render-media" { do { try MediaPreview.render(to: URL(fileURLWithPath: args[2])) } catch { fputs("Media rendering failed\n", stderr); exit(1) } diff --git a/Sources/ClearFlow/SocialPreview.swift b/Sources/ClearFlow/SocialPreview.swift new file mode 100644 index 0000000..504e806 --- /dev/null +++ b/Sources/ClearFlow/SocialPreview.swift @@ -0,0 +1,170 @@ +import AppKit +import SwiftUI + +/// Synthetic, deterministic promotional media. Does not record, transcribe or paste. +@MainActor enum SocialPreview { + static let fps = 24 + static let seconds = 23 + static func render(to directory: URL, portrait: Bool) throws { + _ = NSApplication.shared + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + let model = DictationModel(demo: true) + let size = portrait ? CGSize(width: 720, height: 900) : CGSize(width: 1280, height: 720) + for frame in 0..<(fps * seconds) { + try autoreleasepool { + let view = RevealFrame(time: Double(frame) / Double(fps), portrait: portrait, model: model) + .frame(width: size.width, height: size.height) + .environment(\.locale, Locale(identifier: "en_US")) + .environment(\.timeZone, TimeZone(secondsFromGMT: 0)!) + let renderer = ImageRenderer(content: view) + renderer.scale = 1 + guard let cgImage = renderer.cgImage, + let data = NSBitmapImageRep(cgImage: cgImage).representation(using: .png, properties: [:]) + else { throw CocoaError(.fileWriteUnknown) } + try data.write(to: directory.appendingPathComponent(String(format: "frame-%04d.png", frame))) + } + } + print("Rendered \(fps * seconds) synthetic reveal frames.") + } +} +private struct RevealFrame: View { + let time: Double + let portrait: Bool + @ObservedObject var model: DictationModel + private let ink = Color(red: 0.12, green: 0.14, blue: 0.13) + private let paper = Color(red: 0.972, green: 0.962, blue: 0.938) + private let amber = Color(red: 1, green: 0.68, blue: 0.30) + private let sample = "Let’s make a little more room for ideas." + private var phase: Int { time < 3 ? 0 : time < 6 ? 1 : time < 10 ? 2 : time < 12.5 ? 3 : time < 16 ? 4 : time < 19 ? 5 : 6 } + private var start: Double { [0, 3, 6, 10, 12.5, 16, 19][phase] } + private var entrance: Double { min(1, max(0, (time - start) / 0.38)) } + private var rise: Double { pow(1 - entrance, 3) * 16 } + private var samples: [Double] { (0..<10).map { i in + let wave = abs(sin(time * 7.2 + Double(i) * 0.72)) + return 0.08 + wave * (0.42 + 0.45 * abs(sin(time * 2.7))) + } } + var body: some View { + VStack(alignment: .leading, spacing: 0) { + HStack { + Label("ClearFlow", systemImage: "waveform").font(.system(size: portrait ? 28 : 27, weight: .semibold)) + Spacer() + Text("SAMPLE UI DEMO").font(.system(size: portrait ? 11 : 12, weight: .medium)).tracking(2) + .foregroundStyle(ink.opacity(0.58)) + }.padding(.bottom, portrait ? 40 : 28) + Group { + if phase == 0 { intro } + else if phase <= 4 { editor } + else if phase == 5 { hub } + else { outro } + }.opacity(entrance).offset(y: rise).frame(maxWidth: .infinity, maxHeight: .infinity) + HStack { + Text("OPEN SOURCE / LOCAL WHISPER").tracking(1.5) + Spacer() + Text("macOS · Apple Silicon") + }.font(.system(size: portrait ? 11 : 12, weight: .medium)).foregroundStyle(ink.opacity(0.60)) + .padding(.top, 22) + GeometryReader { geometry in + Capsule().fill(ink.opacity(0.09)).overlay(alignment: .leading) { + Capsule().fill(amber).frame(width: geometry.size.width * min(1, time / 23)) + } + }.frame(height: 3).padding(.top, 18) + }.padding(portrait ? 38 : 44).background(paper).foregroundStyle(ink).preferredColorScheme(.light) + } + private var intro: some View { + VStack(alignment: .leading, spacing: portrait ? 28 : 16) { + Text("MEET CLEARFLOW").font(.system(size: 14, weight: .medium)).tracking(4).foregroundStyle(ink.opacity(0.6)) + Text("Your voice.\nYour Mac.").font(.system(size: portrait ? 80 : 86, weight: .regular, design: .serif)).lineSpacing(-8) + Text("Dictation you can run yourself.").font(.system(size: portrait ? 25 : 27)) + .foregroundStyle(ink.opacity(0.65)) + HStack { + Spacer() + RecordingBar(samples: samples, recording: true, processingLabel: "", onCancel: {}, onFinish: {}) + .scaleEffect(portrait ? 2.9 : 2.5).frame(width: 330, height: 100) + .shadow(color: .black.opacity(0.14), radius: 14, y: 10) + Spacer() + }.padding(.top, portrait ? 35 : 6) + Text("Local Whisper. No cloud account required.") + .font(.system(size: portrait ? 20 : 22)).frame(maxWidth: .infinity).padding(.top, 10) + }.frame(maxWidth: .infinity, alignment: .leading) + } + private var editor: some View { + VStack(alignment: .leading, spacing: 22) { + Text(["", "01 / Start where you write.", "02 / Speak naturally.", "03 / Transcribe locally.", "04 / Keep your flow."][phase]) + .font(.system(size: portrait ? 31 : 38, weight: .medium)) + VStack(alignment: .leading, spacing: 26) { + HStack(spacing: 10) { + Circle().fill(amber).frame(width: 8, height: 8) + Text("SAMPLE EDITOR").font(.system(size: 11, weight: .medium)).tracking(2) + Spacer() + Text(phase == 3 ? "WHISPER" : "⌥ ⇧ SPACE").font(.system(size: 12, weight: .semibold)) + .padding(.horizontal, 14).padding(.vertical, 9).background(paper, in: Capsule()) + } + Text(portrait ? "A little more room\nfor ideas." : "A little more room for ideas.").font(.system(size: portrait ? 38 : 40, design: .serif)).fixedSize(horizontal: false, vertical: true).lineSpacing(1) + Text(phase == 4 ? sample : "│").font(.system(size: portrait ? 25 : 26)).lineSpacing(7) + .frame(maxWidth: .infinity, alignment: .leading).fixedSize(horizontal: false, vertical: true) + Spacer(minLength: 12) + HStack { + Spacer() + if phase == 2 || phase == 3 { + RecordingBar(samples: samples, recording: phase == 2, processingLabel: "Transcribing", previewRotation: time * 240, onCancel: {}, onFinish: {}) + .scaleEffect(1.7).frame(width: 180, height: 52) + } else if phase == 4 { + Label("Back to your words", systemImage: "checkmark.circle.fill") + .font(.system(size: 14)).foregroundStyle(Color(red: 0.2, green: 0.42, blue: 0.32)).frame(height: 52) + } else { Color.clear.frame(height: 52) } + Spacer() + } + }.padding(portrait ? 28 : 32).frame(maxWidth: .infinity, maxHeight: .infinity) + .background(.white, in: RoundedRectangle(cornerRadius: 24)) + .overlay(RoundedRectangle(cornerRadius: 24).stroke(ink.opacity(0.08))) + VStack(alignment: .leading, spacing: 8) { + Text(phase == 1 ? "Select a field. Press Option–Shift–Space." : phase == 2 ? "Say it: “Let’s make a little more room for ideas.”" : phase == 3 ? "Press again to finish. Whisper runs on your hardware." : "Guarded insertion, with clipboard fallback.") + .font(.system(size: portrait ? 18 : 19)).fixedSize(horizontal: false, vertical: true) + Text("Illustrated sequence · Synthetic input · Overlay enlarged · Timing not measured") + .font(.system(size: portrait ? 10 : 11)).foregroundStyle(ink.opacity(0.5)) + } + } + } + private var hub: some View { + Group { + if portrait { + VStack(alignment: .leading, spacing: 24) { + Text("A home for your words.").font(.system(size: 36, weight: .medium)) + hubScreenshot(scale: 0.56).frame(maxWidth: .infinity, maxHeight: .infinity) + Text("Native macOS app. Optional history. Your own vocabulary.") + .font(.system(size: 19)).fixedSize(horizontal: false, vertical: true) + } + } else { + HStack(spacing: 50) { + VStack(alignment: .leading, spacing: 24) { + Text("A home for\nyour words.").font(.system(size: 44, weight: .medium)) + Text("Native macOS app.\nOptional history.\nYour own vocabulary.") + .font(.system(size: 23)).lineSpacing(10).foregroundStyle(ink.opacity(0.65)) + }.frame(width: 350, alignment: .leading) + hubScreenshot(scale: 0.56) + }.frame(maxWidth: .infinity, maxHeight: .infinity) + } + } + } + private func hubScreenshot(scale: CGFloat) -> some View { + MainView(renderForDocumentation: true, model: model).frame(width: 1120, height: 780) + .scaleEffect(scale).frame(width: 1120 * scale, height: 780 * scale) + .clipShape(RoundedRectangle(cornerRadius: 16)).compositingGroup() + .shadow(color: .black.opacity(0.09), radius: 12, y: 5) + } + private var outro: some View { + VStack(alignment: .leading, spacing: portrait ? 30 : 20) { + Text("CLEARFLOW IS OPEN SOURCE").font(.system(size: 13, weight: .medium)).tracking(3) + .foregroundStyle(ink.opacity(0.6)) + Text(portrait ? "Less typing.\nMore you." : "Less typing. More you.").font(.system(size: portrait ? 80 : 90, weight: .regular, design: .serif)).lineSpacing(-8) + Text(portrait ? "Whisper large-v3-turbo\non your own hardware." : "Whisper large-v3-turbo on your own hardware.").font(.system(size: portrait ? 28 : 30)).lineSpacing(5) + HStack { + Text("Get the app + source").font(.system(size: 19, weight: .medium)) + Image(systemName: "arrow.up.right").font(.system(size: 18, weight: .medium)) + }.padding(.horizontal, 22).padding(.vertical, 17).background(amber, in: RoundedRectangle(cornerRadius: 12)) + Text("github.com/ichen27/clearflow").font(.system(size: portrait ? 21 : 23, weight: .medium)) + Text("Apple Silicon · macOS 14+ · Setup required") + .font(.system(size: 13)).foregroundStyle(ink.opacity(0.6)) + }.frame(maxWidth: .infinity, alignment: .leading) + } +} diff --git a/Sources/ClearFlow/Views.swift b/Sources/ClearFlow/Views.swift index efef337..bc61554 100644 --- a/Sources/ClearFlow/Views.swift +++ b/Sources/ClearFlow/Views.swift @@ -392,6 +392,8 @@ struct RecordingBar: View { let samples: [Double] let recording: Bool let processingLabel: String + // Deterministic spinner for offscreen documentation only; normal UI uses ProgressView. + var previewRotation: Double? = nil let onCancel: () -> Void let onFinish: () -> Void var body: some View { @@ -405,6 +407,11 @@ struct RecordingBar: View { }.buttonStyle(.plain).help("Cancel dictation").accessibilityLabel("Cancel dictation") if recording { Waveform(samples: samples) + } else if let previewRotation { + Circle().trim(from: 0.08, to: 0.80) + .stroke(.white, style: StrokeStyle(lineWidth: 1.5, lineCap: .round)) + .frame(width: 10, height: 10).rotationEffect(.degrees(previewRotation)) + .frame(width: 38, height: 14).accessibilityLabel(processingLabel) } else { ProgressView().controlSize(.mini).colorScheme(.dark) .frame(width: 38, height: 14) diff --git a/docs/media/x-reveal/README.md b/docs/media/x-reveal/README.md new file mode 100644 index 0000000..5295945 --- /dev/null +++ b/docs/media/x-reveal/README.md @@ -0,0 +1,43 @@ +# ClearFlow reveal kit + +Post-ready launch assets with anonymous sample content. No recordings, personal dictations, service addresses, account IDs or machine paths are shown. The public repository URL is the call to action. + +## Files + +- `clearflow-reveal.png`: landscape reveal graphic. Created with the built-in image generator, using the app screenshot as a style reference. It is promotional artwork, not a UI screenshot. +- `clearflow-demo-landscape.mp4`: 23-second, 1280 × 720, 24 fps, H.264 video. +- `clearflow-demo-portrait.mp4`: 23-second, 720 × 900 (4:5), 24 fps, H.264 video. + +Both videos contain a silent AAC track and readable on-screen captions. Use the portrait version for a taller feed post, or landscape for a wider desktop presentation. The illustrated sequence uses the app’s actual recording-bar/main-view components with synthetic text and waveform measurements. The overlay is enlarged for readability. It does not perform live capture, inference or paste and does not represent measured latency. Those disclosures appear in the video. + +Encoding follows the H.264/MP4 and AAC formats described in [X’s media specifications](https://help.x.com/en/using-twitter/media-studio-faqs.html). Exported files are well below the usual upload size/duration limits. + +## Suggested reveal post + +I built ClearFlow: open-source dictation for Mac. + +⌥⇧Space → speak → text in your selected field. + +Runs Whisper large-v3-turbo on your own hardware. No cloud account required. + +App + source: https://github.com/ichen27/clearflow + +## Reproduce the videos + +On macOS with Swift 6 and FFmpeg on PATH: + +```sh +scripts/build-reveal.sh +``` + +Frames are generated under ignored `work/reveal/`. MP4s and a copy of the reveal image are written under ignored `dist/x-reveal/`. The source renderer does not access Keychain, saved history, microphone, transcription endpoints or the clipboard. The new command is a documentation renderer and does not change normal dictation behavior. + +The video sources are in `Sources/ClearFlow/SocialPreview.swift`; the UI components are reused from the app. No third-party music or stock footage is included. + +## Image generation + +Mode: built-in image generator. Reference: the repository's synthetic `docs/media/screenshot.png`. + +Prompt: + +> Create a polished launch/reveal graphic for X for the actual open-source macOS dictation app ClearFlow. Landscape 16:9 composition. Use the attached real app screenshot only as a visual reference for its warm ivory, charcoal green, restrained amber palette and original waveform motif. Do not invent app screens or tiny UI text. Make an editorial typographic product announcement: warm ivory background, very large confident near-black sans-serif title 'Meet ClearFlow.' and large second line 'Your voice. Your Mac.' in a beautiful restrained serif. Small uppercase eyebrow 'OPEN-SOURCE DICTATION'. Feature a crisp isolated compact black recording capsule with gray circular X at left, ten tiny white waveform bars in the center and white circular checkmark at right, matching the actual application's simple overlay style. The capsule can be enlarged for the poster, with lots of negative space and a soft natural shadow. Gentle sweeping waveform line or vertical waveform sticks as a subtle supporting graphic, in warm muted orange. Bottom supporting copy exactly 'Local Whisper. No cloud account required.' Small footer exactly 'macOS · Apple Silicon' and 'github.com/ichen27/clearflow'. Premium independent software launch aesthetic, flat editorial art direction, precise legible typography, meticulous spacing, strong visual hierarchy, clean uncluttered layout. Only the specified words. No personal endpoint, account IDs, private information, Wispr branding, laptops, people, fake feature panels, badges, locks, claims of speed, or security guarantees. Use the repository URL as the public call to action. diff --git a/docs/media/x-reveal/clearflow-demo-landscape.mp4 b/docs/media/x-reveal/clearflow-demo-landscape.mp4 new file mode 100644 index 0000000..23e20c7 Binary files /dev/null and b/docs/media/x-reveal/clearflow-demo-landscape.mp4 differ diff --git a/docs/media/x-reveal/clearflow-demo-portrait.mp4 b/docs/media/x-reveal/clearflow-demo-portrait.mp4 new file mode 100644 index 0000000..77f541c Binary files /dev/null and b/docs/media/x-reveal/clearflow-demo-portrait.mp4 differ diff --git a/docs/media/x-reveal/clearflow-reveal.png b/docs/media/x-reveal/clearflow-reveal.png new file mode 100644 index 0000000..a255f93 Binary files /dev/null and b/docs/media/x-reveal/clearflow-reveal.png differ diff --git a/docs/media/x-reveal/post.txt b/docs/media/x-reveal/post.txt new file mode 100644 index 0000000..7218885 --- /dev/null +++ b/docs/media/x-reveal/post.txt @@ -0,0 +1,7 @@ +I built ClearFlow: open-source dictation for Mac. + +⌥⇧Space → speak → text in your selected field. + +Runs Whisper large-v3-turbo on your own hardware. No cloud account required. + +App + source: https://github.com/ichen27/clearflow diff --git a/scripts/build-app.sh b/scripts/build-app.sh index 696f4b4..b0c29ef 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -18,5 +18,5 @@ strip -S "$APP/Contents/MacOS/ClearFlow" codesign --force --deep --sign - "$APP" codesign --verify --deep --strict "$APP" rm -f "$PWD/dist/ClearFlow-macOS-arm64.zip" -ditto -c -k --sequesterRsrc --keepParent "$APP" "$PWD/dist/ClearFlow-macOS-arm64.zip" +ditto -c -k --norsrc --noextattr --noacl --keepParent "$APP" "$PWD/dist/ClearFlow-macOS-arm64.zip" echo "Built $APP" diff --git a/scripts/build-reveal.sh b/scripts/build-reveal.sh new file mode 100755 index 0000000..ddab050 --- /dev/null +++ b/scripts/build-reveal.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -euo pipefail +cd "$(dirname "$0")/.." +command -v ffmpeg >/dev/null || { echo 'Install FFmpeg and add it to PATH.' >&2; exit 1; } +command -v ffprobe >/dev/null || { echo 'Install FFprobe with FFmpeg.' >&2; exit 1; } +scripts/build-app.sh +mkdir -p dist/x-reveal +for shape in landscape portrait; do + frames="work/reveal/$shape" + mkdir -p "$frames" + dist/ClearFlow.app/Contents/MacOS/ClearFlow --render-reveal "$frames" "$shape" + ffmpeg -hide_banner -loglevel warning -y -framerate 24 -start_number 0 -i "$frames/frame-%04d.png" \ + -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000 \ + -map 0:v:0 -map 1:a:0 -t 23 -c:v libx264 -preset medium -crf 18 -pix_fmt yuv420p \ + -profile:v high -level 4.0 -c:a aac -b:a 128k -movflags +faststart -map_metadata -1 \ + -metadata title="ClearFlow — sample UI reveal" \ + -metadata comment="Synthetic UI walkthrough. Not live inference or a timing benchmark." \ + "dist/x-reveal/clearflow-demo-$shape.mp4" + ffprobe -v error -show_entries stream=codec_name,width,height,r_frame_rate -show_entries format=duration,size \ + -of json "dist/x-reveal/clearflow-demo-$shape.mp4" +done +cp docs/media/x-reveal/clearflow-reveal.png dist/x-reveal/ +echo 'Reveal assets are in dist/x-reveal. Both videos use a silent AAC track and on-screen captions.'