audio
Audio
Software Mansion's production audio patterns for React Native using react-native-audio-api.
Load at most one reference file per question. For API signatures and config options, webfetch the documentation pages linked in each reference file.
Critical Rules
- Single AudioContext: Create one
AudioContextinstance per app. Multiple instances lead to conflicting states (one running, another suspended). Encapsulate it in a singleton class. - Single AudioRecorder: Create one
AudioRecorderinstance and reuse it. Switching between recorder instances has noticeable impact on performance, memory, and battery. - Suspend when idle: A running
AudioContextplays silence even with no source nodes connected, draining battery. On iOS, it also prevents the lock screen from showing a paused state. Usesuspend()when audio is temporarily not needed,close()when done permanently. - AudioBufferSourceNode is single-use: An
AudioBufferSourceNodecan be started only once. To replay the same sound, create a new node. Nodes are inexpensive to create; reuse theAudioBuffer. - Use AudioParam scheduling for smooth changes: Direct, immediate changes to gain, frequency, or other params cause audible clicks. Use
linearRampToValueAtTime,exponentialRampToValueAtTime, orsetTargetAtTimefor smooth transitions. - Mutate typed arrays in place for visualizations: When passing audio data to Reanimated shared values, use
.modify()to mutate the existingFloat32Arrayrather than allocating a new one each frame. Allocating at 60fps+ causes GC jank.
References
More from software-mansion-labs/skills
react-native-best-practices
Software Mansion's best practices for production React Native and Expo apps on the New Architecture. MUST USE before writing, reviewing, or debugging ANY code in a React Native or Expo project. If the working directory contains a package.json with react-native, expo, or expo-router as a dependency, this skill applies. Trigger on: any code task in a React Native/Expo project, 'React Native', 'Expo', 'New Architecture', 'Reanimated', 'Gesture Handler', 'react-native-svg', 'ExecuTorch', 'react-native-audio-api', 'react-native-enriched', 'Worklet', 'Fabric', 'TurboModule', 'WebGPU', 'react-native-wgpu', 'TypeGPU', 'GPU shader', 'WGSL', 'svg', 'animation', 'gesture', 'audio', 'rich text', 'AI model', 'multithreading', 'chart', 'vector', 'image filter', 'shared value', 'useSharedValue', 'runOnJS', 'scheduleOnRN', 'thread', 'worklet', or any question involving UI, graphics, native modules, or React Native threading and animation behavior. Also use when a more specific sub-skill matches.
1.2Kradon-mcp
Best practices for using Radon IDE's MCP tools when developing, debugging, and inspecting React Native and Expo apps. Use when interacting with a running app through Radon IDE - viewing screenshots, reading logs, inspecting the component tree, debugging network requests, reloading the app, or querying React Native documentation and library info. Trigger on: 'debug React Native', 'fix UI', 'network issues', 'build issues', 'Radon IDE', 'view screenshot', 'app logs', 'component tree', 'network inspector', 'reload app', 'React Native docs', 'library description', 'emulator', 'development viewport', 'view_screenshot', 'view_application_logs', 'view_component_tree', 'reload_application', 'view_network_logs', 'view_network_request_details', 'query_documentation', 'get_library_description', and every request involving live app inspection, debugging or development in a Radon IDE session.
330typegpu
>-
178expo-horizon
Software Mansion's guide for migrating Expo SDK apps to Meta Quest using expo-horizon packages. Use when adding Meta Quest or Meta Horizon OS support to an existing Expo or React Native project. Trigger on: Meta Quest, Horizon OS, Quest 2, Quest 3, Quest 3S, VR app, expo-horizon-core, expo-horizon-location, expo-horizon-notifications, build flavors for Quest, panel sizing, VR headtracking, Horizon App ID, quest build variant, isHorizonDevice, isHorizonBuild, migrate expo-location to Quest, migrate expo-notifications to Quest, Meta Horizon Store publishing, or any task involving running an Expo app on Meta Quest hardware.
163rnrepo
Best practices for integrating and using RNRepo — Software Mansion's infrastructure for pre-built React Native library artifacts that reduces native build times by up to 2×. Use when setting up, configuring, or troubleshooting RNRepo in a React Native or Expo project. Trigger on: 'RNRepo', 'rnrepo', 'slow builds', 'build times', 'prebuilt artifacts', 'prebuilt libraries', '@rnrepo/expo-config-plugin', '@rnrepo/build-tools', 'prebuilds-plugin', 'rnrepo.config.json', 'DISABLE_RNREPO', 'packages.rnrepo.org', 'Maven prebuild', 'CocoaPods prebuild', 'xcframework prebuild', 'prebuild AAR', 'build from source', 'native compilation slow', 'Gradle plugin slow', 'pod install slow', 'CI build times'.
16jsi
React Native JSI (JavaScript Interface) — C++ API for interacting with the JS runtime. Use whenever the user asks about or writes C++ code that touches JSI types or patterns: jsi::Runtime, jsi::Value, jsi::Object, jsi::Function, jsi::Array, jsi::ArrayBuffer, jsi::String, jsi::Symbol, jsi::BigInt, jsi::PropNameID, jsi::HostObject, jsi::HostFunction, jsi::NativeState, jsi::WeakObject, jsi::Scope, JSIException, JSINativeException, JSError, HostFunctionType, createFromHostFunction, getHostObject, setNativeState, evaluateJavaScript, queueMicrotask, drainMicrotasks, setRuntimeData, getRuntimeData, ISerialization, rt.global(), jsi.h, jsi-inl.h, JSI binding, C++ native module, calling JS from C++, calling C++ from JS, HostObject destructor, shared_ptr, CallInvoker, invokeAsync, folly::dynamic with JSI, zero-copy ArrayBuffer, TurboModule C++ layer, Nitro Module, jsi::WithRuntimeDecorator, or any question about the boundary between C++ and the JavaScript engine in React Native.
1