Real-time audio processing with Expo and native code
Article Summary
Braulio Ríos built a production-ready guitar tuner app using React Native that processes audio in real-time with near-native performance. Here's how he combined TypeScript, C++, Swift, and Kotlin to solve a problem most developers think requires going fully native.
Tuneo is an open-source guitar tuner that showcases React Native's New Architecture by implementing real-time pitch detection. The app uses TurboModules for C++ audio processing, custom Expo modules for microphone access, and adaptive algorithms calibrated through Python notebooks to handle the complexity of tracking fading guitar notes.
Key Takeaways
- C++ TurboModules process audio buffers without JSON serialization overhead
- Adaptive YIN algorithm switches between wide search and narrow tracking modes
- Python notebooks with spectrograms validated pitch detection before C++ implementation
- AI tools accelerated Swift and Kotlin module development from weeks to days
- Expo modules simplified native integration compared to manual TurboModule setup
React Native's New Architecture enables real-time audio processing by letting developers orchestrate in TypeScript while executing performance-critical code in C++, Swift, and Kotlin without bridge bottlenecks.
About This Article
Braulio Ríos wanted to build a guitar tuner that needed low-latency microphone access and real-time pitch detection. React Native made this difficult because sending large audio buffers across the bridge caused serialization overhead.
He built a hybrid architecture using TurboModules to run C++ pitch detection with the YIN algorithm. For direct microphone hardware access, he wrote custom Expo Native Modules in Swift and Kotlin. This approach eliminated the JSON serialization bottlenecks that were slowing things down.
The adaptive parameter strategy worked by narrowing frequency search ranges and relaxing thresholds as notes fade. This produced stable pitch detection that locked onto fundamental frequencies instead of jumping erratically to harmonics. He validated the approach using Python spectrograms before implementing it in C++.