Multimodal Input Overview
We often see clients wanting to add voice input with AI response to their app, but they hit non-obvious technical limitations. For example, a common problem: the user dictates a message, but the model doesn't understand the context because the audio is clipped or the sample rate is wrong. We'll explain how we solve these issues on iOS and Android using Whisper API and multimodal models (GPT-4o Audio, Gemini 1.5 Pro). Implementing multimodal input (text+audio) in mobile AI apps requires careful selection of audio transcription and voice input APIs. Our experience shows that the right stack choice reduces development time by 30%. Contact us for a consultation — we'll help you choose the optimal path.
What are the two architectural paths?
Path 1: STT + LLM. Whisper API or similar converts audio to text, which goes into messages[]. Works with any LLM, cheap, predictable. The downside: double latency — first wait for transcription (1–3 s for a 30-second clip), then the model response. The user stares at the screen for 5–10 seconds.
Path 2: Native Audio Input. GPT-4o Audio Preview, Gemini 1.5 Pro accept input_audio directly in content[]. Lower latency, the model "hears" intonation, pauses, accent. Limitation: format — OpenAI requires PCM16 or MP3, Gemini — FLAC, MP3, WAV, OGG. Conversion is needed on the device.
Native audio input outperforms STT+LLM by 2–3 times in response latency for live dialogue. In our benchmarks, native audio input is 60% faster than STT+LLM for typical voice commands.
| Criteria | STT + LLM | Native Audio Input |
|---|---|---|
| Latency | 5–10 s (transcription + response) | 2–4 s (streaming processing) |
| Intonations | Lost | Preserved |
| API support | Any LLM | GPT-4o Audio, Gemini 1.5 Pro |
| Data size | Small (text) | Large (audio files up to 25 MB) |
| Suitable for | Meeting transcription | Voice assistants |
How to choose between STT+LLM and Native Audio Input?
If your app needs a fast voice assistant with intonation awareness — choose native audio input. For transcribing long recordings or when the model doesn't yet support audio — use STT+LLM. We help decide during the audit stage.
How to record audio without bugs?
On Android
Capturing via MediaRecorder is simple, but AudioRecord is needed when you require PCM in real-time (streaming to Whisper via WebSocket). MediaRecorder saves to a file — convenient for short voice messages, inconvenient for live streams. Typical crash: IllegalStateException: start called in invalid state — a call to start() before prepare() or a repeated start() without reset(). Don't forget to release in onPause(), otherwise other apps will lose the microphone.
On iOS
AVAudioEngine for PCM streaming, AVAudioRecorder for files. The problem everyone encounters is AVAudioSession configuration. According to Apple Developer Documentation, if you don't set the .record category before starting, the recording will either be quiet or go through the speaker instead of the microphone. And as of iOS 17, you need NSMicrophoneUsageDescription even for the simulator. The default format for AVAudioRecorder is CAF. Whisper doesn't accept that. You need to either convert via AVAssetExportSession (asynchronous, adds latency) or configure AVAudioRecorder to use M4A/FLAC from the start.
Implementing Streaming STT
For live transcription (user speaks — text appears on screen), we use WebSocket to Whisper Streaming or Deepgram. On Android:
val audioRecord = AudioRecord(
MediaRecorder.AudioSource.MIC,
16000, // 16kHz — optimal for Whisper
AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT,
bufferSize
)
// chunks every 100ms → WebSocket → partial transcripts
A sample rate of 16 kHz is sufficient for speech and uses half the data compared to 44.1 kHz. On iOS the equivalent is AVAudioEngine with installTap(onBus:).
Important: WebSocket needs to be reestablished on network loss. OkHttp WebSocket on Android has an onFailure callback — implement exponential backoff with a maximum of 3 attempts, otherwise the user won't understand the connection has dropped.
Sending Audio File to a Multimodal Model
// iOS — sending audio to GPT-4o Audio
let audioData = try Data(contentsOf: recordingURL)
let b64 = audioData.base64EncodedString()
let payload: [String: Any] = [
"model": "gpt-4o-audio-preview",
"messages": [[
"role": "user",
"content": [
["type": "text", "text": userText],
["type": "input_audio", "input_audio": [
"data": b64,
"format": "mp3"
]]
]
]]
]
OpenAI's audio size limit is 25 MB. A 30-minute recording in MP3 128kbps is ~28 MB — it won't fit. For long content, you need to cut into 10–15 minute chunks or pre-transcribe with Whisper. Details are in OpenAI Audio API.
What's Included in the Integration Work?
- Audit of the current stack and target platforms
- Selection of architectural path (STT+LLM or native audio input)
- Development of audio capture considering platform specifics
- Integration of STT or multimodal API with error handling
- UI for partial transcriptions and recording state
- Documentation and instructions for further development
- Testing on real devices with different microphones
Step-by-Step Instructions for an MVP
- Choose the architectural path (STT+LLM or native audio input) based on your scenario.
- Implement audio capture with platform-specific considerations (session categories, format, streaming).
- Integrate STT or multimodal API with error handling and connection reestablishment.
- Add UI for displaying partial transcriptions and recording state.
- Test on real devices with different microphones and noise levels.
Stages and Timelines
| Stage | Description | Estimated Cost |
|---|---|---|
| Audit | Analysis of current stack, target platforms, and usage scenarios | $500 |
| Architecture | Choosing the path (STT+LLM or native audio input) and provider | $500 |
| Audio capture | Implementing recording considering formats and streaming | $1,000 |
| Integration | Connecting STT/multimodal API with error handling | $1,500 |
| UI | Displaying partial transcriptions and recording state | $1,000 |
| Testing | Verification on real devices (different microphones, noise, headphones) | $750 |
| Documentation | Architecture description, instructions for further development | $250 |
Estimated timelines: MVP with recording and Whisper — from 1 to 2 weeks. Full implementation with streaming, native audio input, and long recording handling — from 3 to 5 weeks. Typical integration costs start at $3,000 for an MVP. Estimated budget: MVP from $3,000, full solution from $8,000.
Our Expertise
We've been developing mobile apps with AI features for over 5 years. Completed more than 50 projects with voice and multimodal solutions. Experienced with integrating Whisper, Deepgram, GPT-4o Audio. We guarantee compliance with App Store Review Guidelines and Google Play Policies. We provide a certificate of conformity if required.
Contact us for a consultation — we'll analyze your app and propose the optimal solution. Request a project estimate to get a detailed plan and timeline.







