Act as an elite full-stack mobile developer and software architect specializing in React Native, Expo, and TypeScript. Build a lightweight, secure, and production-ready single-screen utility app for iOS 17+ optimized for iPhone 15 series hardware.
The sole purpose of this application is to serve as a custom "Live Listen" workaround utility. It must capture ambient audio via the iPhone's hardware microphone array and route it in real-time with ultra-low latency to standard, non-Apple Bluetooth audio devices (specifically budget earbuds: Champion 'Toura', Tech Theory Sports Buds, and JLab Go Air).
Please architect the entire application into a single, comprehensive App.tsx file using standard React Native and Expo audio libraries (such as 'expo-av' or native Web Audio API bridges).
Strictly adhere to the following technical and architectural requirements:
- CORE AUDIO & ROUTING ENGINE
- Initialize a real-time, continuous audio recording and playback bridge.
- Configure the iOS AVAudioSession category programmatically to .playAndRecord.
- Explicitly enforce options to route the audio stream through standard Bluetooth A2DP profiles using options equivalent to [.allowBluetooth, .allowBluetoothA2DP, .defaultToSpeaker].
- Set the audio mode to measurement or videoRecording to bypass cellular telephone voice-processing algorithms, maximizing raw, high-fidelity ambient sound capture.
- Minimize latency by configuring the hardware buffer duration to the lowest supported tier (e.g., preferredIOBufferDuration = 0.005 seconds / 5ms).
- DIGITAL SIGNAL PROCESSING (EQUALIZER & PRESETS)
- Implement digital audio filters or a multi-band equalizer interface to provide 2 manual UI adjustments:
- A "Bass Reduction" slider (attenuating low frequencies under 250Hz).
- A "Treble Boost" slider (amplifying high frequencies above 4kHz).
- Program 4 hardcoded, quick-tap environment preset buttons that instantly modify the frequency bands:
- "Outdoors / City": Applies a sharp high-pass filter at 300Hz to eliminate traffic rumble; adds a +4dB boost between 2kHz-4kHz for vocal tracking.
- "Woods at Night": Drops heavy low frequencies; applies an aggressive boost at 5kHz-8kHz to magnify faint, high-pitched sounds (rustling leaves, footsteps, snapping twigs).
- "Bedroom": Implements a moderate low-cut filter to minimize close-range, low-frequency wall/appliance vibrations; adds minor vocal frequency polishing.
- "Garage": Applies a tight cut at 400Hz-800Hz to aggressively minimize the boomy acoustic reverb and echoes characteristic of hollow concrete walls.
- USER INTERFACE (SwiftUI-Style React Native Layout)
- Design a clean, high-contrast, professional dark-mode user interface.
- UI Elements required on a single, non-scrollable view screen:
- Top: A large, intuitive Master On/Off Power Switch with distinct active/inactive visual states.
- Middle: Smooth manual sliders for Bass Reduction and Treble Boost.
- Grid Section: 4 prominent, easy-to-tap buttons mapped clearly to the environment presets ("Outdoors/City", "Woods at Night", "Bedroom", "Garage").
- Bottom: A simple status text indicator showing Bluetooth connection state and a volume level feedback meter.
- ECOSYSTEM & PRIVACY PROTOCOLS
- Keep processing entirely local and on-device. The application must operate with zero network dependencies or cloud API calls to save battery and data overhead.
- Provide a clean export structure. Include the necessary app.json or infoPlist configuration block that declares the mandatory 'NSMicrophoneUsageDescription' permission string so the app doesn't crash on launch.
Provide the complete, clean, copy-pasteable App.tsx codebase implementing this complete architecture. Include inline documentation explaining the frequency balancing logic.
Additional context from clarifying questions:
Q1: What is the PRIMARY use case for this audio routing app? Who are the actual end users and what problem are they solving?
A1: Personal safety/security monitoring — users want to hear ambient surroundings discreetly through budget earbuds while their hands are free
Q2: Beyond the 4 environment presets (Outdoors/City, Woods at Night, Bedroom, Garage), what OTHER audio environments or use cases should the app support? Or should these 4 be the complete set?
A2: Add 2-3 more presets like 'Crowded Restaurant', 'Classroom/Meeting Room', 'Concert/Event Venue'
Q3: How should the app handle audio VOLUME and GAIN? Should users be able to control the overall output volume being sent to the Bluetooth earbuds?
A3: Include both input gain (microphone sensitivity) AND output volume (Bluetooth earbud level) controls
Q4: What should happen if the Bluetooth connection drops or the user hasn't paired earbuds yet? Should the app have fallback behavior?
A4: Disable recording entirely — show error state until Bluetooth earbuds are connected
IMPORTANT BUILD INSTRUCTIONS:
- Focus on CORE features only. Do not add extra polish, advanced features, or nice-to-haves.
- Do NOT overthink the design or architecture. Keep it simple and functional.
- Write all files in parallel where possible. Minimize thinking time.
- Skip animations, transitions, and complex interactions unless explicitly requested.
- Use simple, clean components. No over-engineering.
- Target completion in under 3 minutes. Speed over perfection.
- Ship a working MVP, not a feature-complete product.
- Do NOT install or suggest any integrations (Supabase, Blob, databases, etc). Use mock data and localStorage only.
- Do NOT prompt for user approval or wait for manual steps. Build everything autonomously.
- CRITICAL: The app MUST have a working root page at "app/page.tsx" (or "pages/index.tsx") that renders the main UI immediately. Never generate an app where "/" is empty or shows a file picker — the root route must show the primary feature of the app. If you create multiple sub-pages, "app/page.tsx" should still render the main dashboard/home view, not a redirect or empty component.