Audio recording in mobile app

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Audio recording in mobile app
Medium
from 1 business day to 3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing Audio Recording in Mobile Applications

Voice messages, dictaphone, interview recording in journalism app — one task, different requirements. Voice message needs AAC/M4A, 32 kbps, small file. Podcast dictaphone — WAV or FLAC, 44100 Hz, lossless. Start with audio session, otherwise you'll be confused with conflicts later.

Audio Session and Categories

iOS. AVAudioSession — central management object. For recording:

let session = AVAudioSession.sharedInstance()
try session.setCategory(.playAndRecord,
    mode: .default,
    options: [.defaultToSpeaker, .allowBluetooth])
try session.setActive(true)

.playAndRecord allows simultaneous playback and recording. .allowBluetooth enables recording from AirPods. Without .defaultToSpeaker — audio playback goes to ear speaker, not main speaker.

Problem occurring in production: another app (navigator, music player) hijacks session. Subscribe to AVAudioSession.interruptionNotification, on .began pause recording, on .ended with .shouldResume — resume.

Android. AudioRecord for direct PCM data access. MediaRecorder — simpler but less format control. For most tasks MediaRecorder suffices:

mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC)
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC)
mediaRecorder.setAudioSamplingRate(44100)
mediaRecorder.setAudioEncodingBitRate(128000)

VOICE_COMMUNICATION instead of MIC enables echo cancellation and noise suppression at system level — useful for voice messages.

Sound Level Visualization

Amplitude waveform indicator — user sees recording is happening. On iOS: AVAudioRecorder.averagePower(forChannel: 0) returns dB (from -160 to 0). Normalize to 0..1:

let power = recorder.averagePower(forChannel: 0)
let level = pow(10, power / 20) // dBFS → linear

Poll via Timer.scheduledTimer(withTimeInterval: 0.05) — 20 fps for smooth animation.

On Android: MediaRecorder.getMaxAmplitude() — maximum amplitude since last call (0–32767). Do Handler.postDelayed every 50 ms.

For Flutter: record (pub.dev) provides onAmplitudeChanged stream.

Waveform During Playback

Analyze recorded file offline: read PCM samples, split into N-sample chunks, take RMS of each. Get array of float values — draw via Canvas or Path. On iOS need AVAssetReader + AVAssetReaderTrackOutput with kAudioFormatLinearPCM.

Formats and Compatibility

Format 1 minute size Compatibility Use
AAC (M4A) ~480 KB iOS, Android, Web voice messages
MP3 ~960 KB everywhere general case
WAV (PCM) ~10 MB everywhere lossless, dictaphone
FLAC ~3–5 MB Android native, iOS 11+ lossless, compact
OGG/Opus ~300 KB Android, Web optimal for VoIP

Background Recording

If user minimizes app — recording should continue. iOS: UIBackgroundModes: audio in Info.plist, AVAudioSession stays active. Android: ForegroundService with type microphone (android:foregroundServiceType="microphone" in manifest, mandatory with Android 10). Notification with "Stop" button — standard.

Without ForegroundService on Android 9+ system kills process after several minutes in background. On iOS without UIBackgroundModes, recording stops 3 seconds after minimizing.

Timeline

Recording with level visualization and file save — 1–2 days. Full dictaphone with waveform, pause, renaming and background recording — 3–4 days.