Before we dive in: I share practical insights like this weekly. Join developers and founders getting my newsletter with real solutions to engineering and business challenges.
I've been meditating for 25 years, mostly using guided meditations and working with spiritual guides - a lot of internal focus work. But Chris Bailey's book How to Train Your Mind reminded me of the simplest method: silent meditation, just focusing on your breath. The book presents this fascinating concept that for every minute of meditation, you save nine minutes throughout the day through improved focus, better context switching, and reduced mental friction.
I'd done breath meditation before, but always as part of a broader guided practice. This pure, silent approach seemed worth exploring properly. The problem was finding a simple tool to support it.
The Problem with Existing Meditation Apps
I tried Insight Timer, Calm, and basically every meditation app out there. They all try to do everything – social features, courses, subscriptions, community forums, progress competitions with friends. Insight Timer has over 100,000 different guided meditations. Calm wants to be your sleep stories, daily wisdom, and meditation teacher all in one.
I just wanted something that did one thing well: a meditation timer and maybe the occasional mindful moment reminder during the day. Nothing fancy, no social anything, no trying to build a meditation empire. Just a simple tool for an individual doing their own work.
This reminded me of my approach to software projects - sometimes the best solution is the simplest one that solves the actual problem you have.
Building the First Version
The first iteration was straightforward. I built it using Expo because it makes creating mobile apps incredibly easy, and LLMs understand React components well when I need help debugging. The core features were simple:
- A meditation timer for silent practice
- Random mindful moment reminders throughout the day
- Progress tracking with streaks to encourage consistency
For the reminders, I curated about a hundred different prompts - things like "take a breath," "notice what you're grateful for," or "be present in this moment." The app randomly selects times throughout the week, creates the notifications for Monday through Sunday with the number of events you want, then repeats. Nothing complex, just enough to occasionally pull you back to the present moment.
The 15 minute meditation sessions quickly became my sweet spot - long enough to get into a proper meditative state, short enough to fit into a busy schedule. But I also wanted flexibility for everything from 5 minute meditation for anxiety when I'm stressed to longer 30 minute meditation sessions when I had more time.
The AI Evolution
But then I had an idea that felt inevitable: what if I could use AI to generate personalised guided meditation scripts? Not the generic stuff you find everywhere, but meditations tailored to exactly what someone needs - specific duration, experience level, type of practice, and focus area.
This is where things got technically interesting, and it connects to how AI has transformed my daily workflow in unexpected ways.
Initially, neither Grok nor Claude could handle what I was asking for. The responses were inconsistent, the timing was off, and the meditation flow felt mechanical. But then Claude Opus and Grok-3 arrived, and suddenly everything clicked. Now Grok-4 is extremely good at this.
Rather than using a single massive prompt, I built a modular component architecture with about 20 different prompt files. Depending on what someone selects - duration, experience level, focus area - my Go backend assembles a custom prompt from these components.
The Meditation Generation System
Here's how the system works:
Experience Levels: Beginners get more instruction with a 50/50 speech-to-silence ratio, while advanced practitioners get 70% silence and minimal guidance. This ensures that someone new to meditation for anxious thoughts gets plenty of support, while experienced meditators get the space they need.
Duration Handling: 5 minute meditation sessions target about 200 words, 30 minute meditation sessions around 1,800 words. But here's the crucial part - the meditation never mentions time during the session. No "we're halfway through" or "in the remaining minutes." Just pure, timeless guidance.
Meditation Flow: Each session follows a three-part structure:
- Opening: Brief settling (15-50 words)
- Main Practice: Progressive guidance that decreases as the meditation unfolds
- Closing: Gentle return and integration (15-50 words)
The meditation types cover everything people need: anxiety-focused sessions, presence work, awareness cultivation, guidance for specific situations, and even guided meditation for healing and grief. When the on-demand feature launches, you'll be able to put in whatever topic you want and generate that meditation.
Morning meditations get their own special treatment - they're designed to set intention for the day rather than processing or releasing, which makes them fundamentally different from evening practice sessions.
Technical Deep Dive: Getting the Timing Right
The AI outputs everything in JSON format with precise segments, which then gets processed into timed audio. But getting this right was the biggest technical challenge of the entire project.
When I send the guided meditation script to ElevenLabs (using a soothing, slightly husky female voice I settled on after testing many options), I need to calculate exactly how long each spoken segment will take, then inject the right amount of silence between segments.
const wordsPerSecond = 2.5
func calculateSpeechDuration(text string) time.Duration {
words := wordCount(text)
secondsPerWord := 1.0 / wordsPerSecond
seconds := float64(words) * secondsPerWord
return time.Duration(seconds * float64(time.Second))
}
The silence isn't just random gaps - it's distributed using a bell curve, with longer pauses in the middle of the meditation and shorter ones at the beginning and end. Different experience levels get different silence ratios:
- Beginner: 50/50 speech to silence (1.0 ratio)
- Intermediate: 60/40 speech to silence (1.5 ratio)
- Advanced: 70/30 speech to silence (2.333 ratio)
I ensure each pause stays within reasonable bounds (5-60 seconds). One thing I discovered is that you can't just concatenate audio files - you have to manually write silence into the audio stream. Once I figured that out, everything became much easier.
Audio Creation Flow
The actual audio assembly is where things get technically interesting. The system needs to seamlessly blend TTS-generated speech with calculated periods of digital silence.
1. Silence Calculation
First, the system calculates how silence should be distributed across the meditation:
func calculateSilenceDistribution(segments []string, level string) []time.Duration {
// Calculate total speech duration
var totalSpeechDuration time.Duration
for _, seg := range segments {
totalSpeechDuration += calculateSpeechDuration(seg)
}
// Calculate required silence for the ratio
silenceRatio := 2.333 // 70/30 ratio means silence should be 2.333x speech duration
switch level {
case "beginner":
silenceRatio = 1.0 // 50/50 ratio
case "intermediate":
silenceRatio = 1.5 // 60/40 ratio
case "experienced", "advanced":
silenceRatio = 2.333 // 70/30 ratio
}
totalSilence := time.Duration(float64(totalSpeechDuration) * silenceRatio)
// ... distribute using bell curve weights
}
2. Audio Assembly
The main audio creation happens during meditation assembly, where speech and silence are interleaved:
for i, segment := range segments {
// Only generate audio for non-silence segments
if !segment.IsSilenceOnly {
// Get TTS audio (MP3)
mp3Audio, err := s.ttsClient.GenerateAudio(segment.Text)
// Decode MP3 to audio streamer
streamer, audioFormat, err := mp3.Decode(spokenReader)
streamers = append(streamers, streamer)
}
// Add silence if needed
if segment.SilenceDuration > 0 {
samples := int(format.SampleRate.N(segment.SilenceDuration))
streamers = append(streamers, beep.Silence(samples)) // ← Silence insertion
}
}
3. Digital Silence Generation
This was the breakthrough moment - digital silence is created using the beep
library rather than trying to record or generate "quiet" audio:
beep.Silence(samples)
generates pure digital silence (zeros)- Sample count =
sampleRate × duration
(e.g., 44100 Hz × 5 seconds = 220,500 samples) - Silence is distributed using a bell curve - more silence in the middle segments of meditations
- Each silence period is bounded between 5-60 seconds to maintain natural flow
4. File Output and Conversion
Finally, everything gets combined and converted to the final format:
// Combine all streamers (speech + silence)
combined := beep.Seq(streamers...)
// Encode to WAV
wav.Encode(tmpWAV, combined, format)
// Convert WAV to MP3 using ffmpeg
cmd := exec.Command("ffmpeg", "-y", "-i", tmpWAV.Name(),
"-codec:a", "libmp3lame", "-qscale:a", "2", tmpMP3.Name())
The system creates seamless audio by interleaving TTS-generated speech with calculated periods of digital silence, all combined into a single audio stream. The final output is MP3 via ffmpeg conversion from WAV, optimised for mobile playback.
The result is meditation audio that flows naturally, with exactly the right balance of guidance and space for practice. Whether someone needs a quick 10 minute calming timer session or wants to dive deep with spiritual meditation, the pacing feels completely natural.
The Backend Architecture
This connects to my experience building production-ready Go packages - the backend that handles the AI generation is built in Go with async processing. When someone requests a custom meditation, the system:
- Assembles the appropriate prompt from modular components
- Sends the request to the AI (Grok or Claude)
- Processes the JSON response into timed segments
- Generates audio through ElevenLabs
- Stitches together speech and silence into the final meditation file
Since these operations can take several minutes, everything runs asynchronously. You make a request, and your personal meditation becomes available when it's ready. No complex frameworks needed - just straightforward Go handling the orchestration.
For the upcoming on-demand feature, I'm planning weekly releases that drop on Sundays, giving people fresh content to start their week.
Why Simplicity Won
The feedback from TestFlight users has been consistently positive. They love the simplicity, and they find the AI-generated meditations to be very good - often different from what they'd expect, in a positive way. No one has asked for social features or gamification beyond basic streak tracking.
This reinforced something I've learned throughout my career: meditation is fundamentally an individual practice. It's work you do on yourself, for yourself. Adding social layers, competitions, or complex feature sets just distracts from that core purpose.
The app deliberately excludes everything that isn't essential:
- No social features or sharing
- No complex subscription tiers
- No courses or progressive programs
- No community forums or group challenges
Just a meditation timer, mindful reminders, progress tracking, and access to personalised guided meditation scripts when you need them.
The Measurable Impact
The book wasn't exaggerating about that nine-to-one ratio. Even doing 10 minute meditation sessions daily for a week creates hugely measurable differences. The biggest change is a feeling of consistent calmness, regardless of what's happening in the world around you.
When I'm consistent with the practice - I generally target 20 minutes daily, sometimes 30 or 40 minutes in multiple sessions - the difference is astounding. Better mental clarity, sharper focus, and crucially, life's stresses still exist but they affect you differently. It feels like sitting in the middle of a calm ocean, watching things happen around you while remaining centred.
Having consistent access to meditations that match exactly what I need means I actually meditate more regularly. Whether it's a 15 minute guided meditation to start the day or a meditation for anxious moments when something stressful happens, having the right tool immediately available removes the friction that often kills good habits.
What's Next
The current version has pre-loaded AI-generated meditations covering the most common needs, but I'm building the next iteration: true on-demand generation. Users will be able to create completely custom meditations tailored to their exact needs in that moment.
Want a 10-minute session focused on processing disappointment? Or an 20-minute meditation that combines breath awareness with gratitude practice? The system will generate exactly that, with appropriate pacing and guidance level for your experience.
If you want to try the app, you can join the TestFlight here. I'm keen for feedback - the more people who use it and share their experience, the better I can make it.
Lessons Learned
Building this meditation app taught me several things about both technology and meditation practice:
AI Capabilities Are Rapidly Evolving: The difference between Claude 3.5 and Claude Opus, or between Grok-2 and Grok-3, was the difference between "this doesn't work" and "this is exactly what I need." If you're building AI-powered tools, patience for the next model version might be more valuable than complex prompt engineering.
Timing Is Everything in Meditation Tech: The technical challenge wasn't the AI generation or the mobile app - it was calculating speech duration and silence distribution. Getting this right makes the difference between a meditation that feels natural and one that feels rushed or too slow.
Simplicity Is a Feature, Not a Limitation: Every meditation app tries to do everything. Building something that deliberately does less, but does it extremely well, creates a better user experience. This mirrors lessons from my broader software development process - constraints often lead to better solutions.
Individual Practice Beats Social Features: Meditation is fundamentally personal work. The urge to add sharing, communities, or social validation misses the point entirely. Sometimes the best product decision is what you choose not to build.
The meditation app started as a simple meditation timer for breath-focused practice and evolved into an AI-powered platform for generating personalised guided meditation scripts. But at its core, it remains what I originally wanted: a simple tool that does one thing extremely well, helping individuals develop their own meditation practice without distraction or complexity.
Whether you're looking for 5 minute meditation for anxiety, morning meditations to set your day's intention, or 30 minute meditation sessions for deep practice, the principle remains the same: give people exactly what they need, when they need it, without everything they don't.
That's proven to be not just a good product philosophy, but a good life philosophy as well.