Skip to content

tsushanth/PixleyBedtime

Repository files navigation

Pixley Bedtime

A working SwiftUI prototype of an audio-only bedtime surface for Pixley AI (YC F25). The killer feature: bedtime stories read in the parent's own cloned voice, with a sleep timer and Lock Screen Live Activity.

Pixley Bedtime home screen — voice picker, three stories, night blue palette

Built unsolicited. Aims at the one specific gap a 1-star App Store reviewer named — "strange audio … worse than CocoMelon" — by replacing TTS with the warmest, highest-trust voice a parent can offer: their own.


Why this surface

Pixley today is screen-first: the kid co-creates a cartoon, watches it back, calls characters on a video screen. Beautiful for daytime co-play. But four obvious bedtime/car-ride moments are unaddressed:

Moment Why screens fail What this surface offers
Sleep Blue light + a screen don't help a 4-year-old wind down Audio only, screen dims, sleep timer auto-stops
Long car ride Backseat tablet = motion sickness + battery + parent distraction Pure audio over CarPlay or Bluetooth
Hospital / travel / divorce The parent's voice is the comfort, not the content Cloned voice means even an absent parent can read tonight's story
The 1-star "strange audio" review Generic TTS sounds uncanny to a 4-year-old Real voice cloning (your OpenVoice/ElevenLabs/Cartesia endpoint, see swap point below)

The current Pixley flow ends when the screen goes off. This extends it past lights-out.


What's in the box

PixleyBedtime/
├── PixleyBedtime/                  # Main app
│   ├── PixleyBedtimeApp.swift
│   ├── Models/
│   │   ├── Story.swift                # Story model + 3 demo bedtime stories
│   │   ├── Voice.swift                # Voice (system / characterPreset / cloned)
│   │   └── LibraryStore.swift         # App Group-backed library state
│   ├── Audio/
│   │   ├── VoiceRecorder.swift        # 30-second calibration with VU meter
│   │   └── StoryEngine.swift          # AVAudioPlayer/AVSpeechSynthesizer + sleep timer + Now Playing
│   ├── VoiceCloning/
│   │   └── VoiceCloningClient.swift   # Single swap-point: LocalCloningClient + RemoteCloningClient stub
│   └── Views/
│       ├── ContentView.swift          # Voice picker + story list
│       ├── VoiceCalibrationView.swift # 30-second record-your-voice flow
│       └── StoryPlayerView.swift      # Night-mode player with sleep timer
├── PixleyWidget/                   # Home Screen widget + Live Activity
│   └── PixleyWidget.swift
└── PixleyLiveActivity/             # Shared attributes
    └── BedtimeAttributes.swift

Voice cloning — VoiceCloningClient.swift

The whole point of this build, and the single drop-in seam against Pixley's production stack.

protocol VoiceCloningClient {
    func synthesize(text: String, referenceURL: URL?) async throws -> URL
}
  • LocalCloningClient falls back to AVSpeechSynthesizer so the demo runs offline — reviewers can hear the player loop without a backend
  • RemoteCloningClient is a POST /clone { reference_url, text } → audio/mpeg HTTP stub. Point it at your OpenVoice / ElevenLabs / Cartesia endpoint and the rest of the player works unchanged
  • The 30-second calibration sample is written to the App Group container so re-renders don't require re-recording

Story player — StoryEngine.swift

  • AVAudioSession configured for .playback / .spokenAudio — screen-locked playback, ducks music
  • MPNowPlayingInfoCenter populated so the lock screen + CarPlay show the story title and voice
  • Sleep timer: 10/20/30/45 minutes. Stops cleanly when deadline passes; no startle.
  • Auto-fallback to system synth if the cloning backend returns an error mid-story — bedtime doesn't crash

Calibration — VoiceRecorder.swift + VoiceCalibrationView.swift

  • 30-second AVAudioRecorder capture at 44.1kHz mono AAC — the standard reference clip length for OpenVoice/Cartesia
  • Real-time VU meter so the parent knows their level is good before they commit
  • File written to App Group container (group.pixleyai.bedtime) so widget + future companion devices can read it
  • Calibration script is a short, gentle bedtime cadence — captures the prosody we want at inference, not a phonetically-balanced corpus

Live Activity + Widget

  • Live Activity: countdown to sleep timer end on the Lock Screen + Dynamic Island. Survives the screen-off (the whole point).
  • Widget: "Tonight's story in [voice name]" — a "remember me at bedtime" tap target, refreshed once per evening at 8pm so it doesn't burn timeline budget.

Integration with Pixley's existing stack

  1. VoiceCloningClient — swap LocalCloningClient for RemoteCloningClient pointed at your voice-cloning endpoint. That's the single change.
  2. LibraryStore.stories — replace Story.demoLibrary with a fetch from your existing episode/story service. Episodes can carry an episodeRef so the audio companions the cartoon the kid watched at 5pm.
  3. LibraryStore.voices — gate cloning behind your existing parent account. The local seed assumes a single device; production wants per-user storage with consent + delete-on-demand.
  4. Consent + safety — the calibration script intentionally avoids any kid-specific phrasing so the recording can be used non-creepily for non-bedtime contexts later. The reference clip is local-only by default; production should make the upload optional and revocable.

What I deliberately did not build

  • CarPlay scene — single afternoon's work. The audio engine + Now Playing wiring is already CarPlay-ready; just need the CPTemplateApplicationSceneDelegate.
  • Family Sharing — letting both parents' voices live in the same account.
  • AI-generated stories from today's cartoon — feed the day's Pixley episode into an LLM, get a bedtime-cadenced story summary, render in parent's voice. The most natural product line from here.
  • Apple Watch glance — "story X of Y, Z minutes left."
  • Background audio handoff to HomePod over AirPlay.

Any of these in 1-2 days each if useful.


Built by Sushanth Tiruvaipati. Reach me at t.sushanth@gmail.com.

About

iOS prototype for Pixley AI (YC F25): bedtime stories in the parent's cloned voice, sleep timer, Lock Screen Live Activity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages