Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎙️ Speachy iOS — Speech-to-Text for iPhone

A lightweight iOS app for voice-to-text transcription with formal text rewriting, powered by OpenAI's Whisper API and GPT-4o-mini. Includes a custom keyboard extension for quick text insertion.

Looking for the macOS version? Check out Speachy for macOS.

Features

  • Two Recording Modes:
    • Normal — Direct speech-to-text transcription
    • Formal — Transcription + professional rewriting via GPT-4o-mini
  • Custom Keyboard Extension — Quick "Insert" button to paste transcribed text into any app
  • Multi-Language Support — Auto-detection or manual selection (German, English, French, Spanish)
  • Multiple Whisper Models — Choose between GPT-4o Transcribe, GPT-4o Mini Transcribe, or Whisper-1
  • Clipboard Workflow — Transcribed text is automatically copied to clipboard
  • Privacy-Focused — API key stored locally, audio files cleaned up after transcription
  • SwiftUI — Modern, native iOS interface

Requirements

  • iPhone with iOS 18.0 or later
  • Xcode 16.0 or later (for building)
  • Swift 5.9+
  • OpenAI API key (with Whisper and GPT-4o-mini access)
  • Apple Developer account (free account works)

Installation

1. Clone the Repository

git clone https://github.com/luisgaertner/SpeachyiOS.git
cd SpeachyiOS

2. Set Up the Xcode Project

Follow the detailed instructions in XCODE_SETUP.md to create the Xcode project with both the main app and keyboard extension targets.

Quick overview:

  1. Create a new iOS App project in Xcode (Product Name: Speachy, SwiftUI, Swift)
  2. Add a Custom Keyboard Extension target (Product Name: SpeachyKeyboard)
  3. Add the source files to their respective targets (see Project Structure below)
  4. Set deployment target to iOS 18.0 for both targets
  5. Build and run on your iPhone

3. Getting an OpenAI API Key

  1. Visit OpenAI Platform
  2. Sign up or log in
  3. Navigate to API KeysCreate new secret key
  4. Copy the key and paste it in the Speachy app's settings

Usage

Recording in the App

  1. Open the Speachy app
  2. Enter your OpenAI API key in settings
  3. Tap Normal aufnehmen (Normal recording) or Formal aufnehmen (Formal recording)
  4. Tap the mic button to start recording, tap again to stop
  5. The transcribed text is automatically copied to your clipboard
  6. Switch to any app and paste

Using the Keyboard Extension

  1. Go to Settings → General → Keyboard → Keyboards → Add New Keyboard
  2. Select Speachy under third-party keyboards
  3. Tap Speachy → Enable Allow Full Access
  4. In any text field, switch to the Speachy keyboard (hold the globe icon)
  5. Tap Einfügen (Insert) to paste the last transcription

Architecture

iPhone App                          Keyboard Extension
┌─────────────────────┐            ┌──────────────────────┐
│  Speachy Main App   │            │  SpeachyKeyboard     │
│                     │            │                      │
│  ┌───────────────┐  │  Clipboard │  ┌────────────────┐  │
│  │ RecordingView │──┼────────────┼─→│ Insert Button  │  │
│  │ (Mic → WAV)   │  │  (paste)   │  │ (reads paste-  │  │
│  └───────┬───────┘  │            │  │  board)        │  │
│          ↓          │            │  └────────────────┘  │
│  ┌───────────────┐  │            │                      │
│  │ WhisperService│  │            │  ┌────────────────┐  │
│  │ (OpenAI API)  │  │            │  │ Globe Button   │  │
│  └───────┬───────┘  │            │  │ (switch KB)    │  │
│          ↓          │            │  └────────────────┘  │
│  ┌───────────────┐  │            └──────────────────────┘
│  │RewriteService │  │
│  │(formal only)  │  │
│  └───────────────┘  │
└─────────────────────┘

Why this design? iOS keyboard extensions cannot access the microphone. Recording happens in the main app and the transcribed text is shared via the system clipboard.

Project Structure

SpeachyiOS/
├── Shared/                          (Both Targets)
│   ├── SharedSettings.swift         UserDefaults wrapper (API key, model, language)
│   ├── WhisperService.swift         OpenAI Whisper API (multipart/form-data)
│   ├── RewriteService.swift         GPT-4o-mini formal rewriting
│   └── AudioRecorderiOS.swift       AVAudioEngine recording (WAV, 16-bit PCM)
├── SpeachyApp/                      (Main App Target)
│   ├── SpeachyApp.swift             App entry point with URL scheme handler
│   ├── ContentView.swift            Settings UI (API key, model, language, permissions)
│   └── RecordingView.swift          Full-screen recording + transcription UI
├── SpeachyKeyboard/                 (Keyboard Extension Target)
│   ├── KeyboardViewController.swift Extension controller with SwiftUI hosting
│   └── KeyboardView.swift           Keyboard UI (globe + insert button)
├── XCODE_SETUP.md                   Step-by-step Xcode project setup guide
├── .gitignore                       Standard Xcode/Swift gitignore
└── README.md                        This file

API Details

OpenAI Whisper API

  • Endpoint: POST https://api.openai.com/v1/audio/transcriptions
  • Models: gpt-4o-transcribe, gpt-4o-mini-transcribe, whisper-1
  • Audio Format: WAV, 16kHz mono, 16-bit Linear PCM
  • Response Format: JSON

GPT-4o-mini for Formal Rewriting

  • Endpoint: POST https://api.openai.com/v1/chat/completions
  • Model: gpt-4o-mini
  • Purpose: Rewrites informal speech into professional, formal German text
  • Fallback: Silently returns original text on any error

Privacy & Security

  • API keys are stored locally in UserDefaults on your device
  • Audio is transmitted only to OpenAI's API endpoints (https://api.openai.com)
  • No telemetry or analytics collected
  • No cloud storage — recordings are temporary files cleaned up after transcription
  • Open source — Review the code yourself

Troubleshooting

App Crashes on Launch

Ensure NSMicrophoneUsageDescription is set in the main app's Info.plist.

Keyboard Extension Not Appearing

  1. Delete the app from your iPhone
  2. Rebuild and reinstall from Xcode
  3. Go to Settings → General → Keyboard → Keyboards → Add New Keyboard
  4. Select Speachy and enable Allow Full Access

Transcription Returns Wrong Language

Select the correct language in the app settings instead of "Automatisch" (Auto).

"Developer App Certificate Not Trusted"

Go to Settings → General → VPN & Device Management and trust your developer profile.

Insert Button Doesn't Work

Make sure Allow Full Access is enabled for the Speachy keyboard in Settings.

Known Limitations

  • Keyboard extensions cannot record audio on iOS — recording must happen in the main app
  • Free Apple Developer account — App Groups and iCloud are not available; settings are not shared between app and keyboard extension
  • Clipboard-based workflow — requires switching between Speachy and the target app

Future Enhancements

  • Live audio waveform visualization during recording
  • Recording history with re-copy option
  • Additional language support
  • Siri Shortcuts integration
  • Widget for quick recording access
  • App Group support for paid developer accounts

License

MIT License — See LICENSE file for details.

Copyright © 2025 Luis Gärtner

Support

For issues, questions, or feature requests, please open an issue on GitHub.


Made with ❤️ by Luis Gärtner

About

Speachy on iOS

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages