ios-audio-haptics
Skill4 starsChanged 5 months agoMITView on GitHub
AVFoundation audio and Core Haptics for guided breathing apps. Audio sessions, mixing, interruption handling, and haptic pattern design for iOS and watchOS. Use when implementing audio playback, multi-track mixing, audio interruption handling, or haptic feedback patterns.
In this repository101 other files it gives its agents.
- ai-video-understandingSkill
- apple-foundation-modelsSkill
- arch-dddSkill
- arch-decision-recordsSkill
- arch-diagramsSkill
- arch-eventsSkill
- arch-mvp-roadmapSkill
- arch-python-modernSkill
- aws-app-runnerSkill
- aws-cicd-patternsSkill
- aws-security-hardeningSkill
- azure-functions-python-v2Skill
- azure-identity-m2m-authSkill
- azure-service-bus-messagingSkill
- azure-workflow-execution-modelsSkill
- caddy-tls-proxySkill
- compliance-frameworksSkill
- design-system-workflowSkill
- dev-debugging-strategiesSkill
- dev-standardsSkill
- docker-python-poetrySkill
- docker-pythonSkill
- fastapi-patternsSkill
- ffmpeg-laravel-videoSkill
- formik-yup-react-nativeSkill
- frontend-accessibilitySkill
- frontend-angular-aiSkill
- frontend-angularSkill
- frontend-angular-toolingSkill
- frontend-design-systemsSkill
- frontend-material-chatSkill
- frontend-material-design-3Skill
- frontend-svelteSkill
- gcp-cicd-patternsSkill
- gcp-cloud-runSkill
- gcp-cloudsql-infrastructureSkill
- gcp-finopsSkill
- gcp-observabilitySkill
- gcp-security-hardeningSkill
- github-actions-cicdSkill
- healthkit-biofeedbackSkill
- infra-terraformSkill
- ios-app-qualitySkill
- jest-nestjs-testingSkill
- langchain-azure-openai-patternsSkill
- laravel-auth-hardeningSkill
- laravel-ci-mysqlSkill
- laravel-mix-webpackSkill
- laravel-modern-patternsSkill
- laravel-pint-patternsSkill
- laravel-s3-storageSkill
- laravel-sail-dockerSkill
- mobile-app-deploymentSkill
- mobile-e2e-testingSkill
- mobile-offline-syncSkill
- mobile-push-notificationsSkill
- mobile-video-uploadSkill
- mongodb-asyncmongoclient-patternsSkill
- mongodb-atlas-patternsSkill
- nestjs-patternsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Add audio to UIBackgroundModes in Info.plist.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
iOS Audio & Haptics
Audio playback (AVFoundation) and haptic feedback (Core Haptics / WKHapticType) patterns for guided breathing and wellness apps.
When to Use
- Playing ambient sounds or voice guidance during breathing sessions
- Mixing multiple audio sources (ambient + voice)
- Handling audio interruptions (calls, Siri, other apps)
- Designing haptic patterns for breathing rhythm cues
Core Concepts
Audio Session Configuration
Configure AVAudioSession with .playback category for background audio. Use .duckOthers option (implies mixWithOthers) for ambient layering. Set up AVAudioEngine with separate player nodes for ambient and guidance tracks.
Audio Mixing
Attach multiple AVAudioPlayerNode instances to AVAudioEngine via separate AVAudioMixerNode nodes. Control volume per channel (e.g., ambient at 0.3, guidance at 1.0). Loop ambient audio by re-scheduling in the completion handler.
Core Haptics (iOS)
CHHapticEngine provides rich parametric haptics. Check capabilitiesForHardware().supportsHaptics before use. Use intensity curves that rise during inhale and fall during exhale. Set stoppedHandler to auto-restart the engine. Use low sharpness (0.1-0.2) for calming breath cues.
watchOS Haptics
WKHapticType is simpler than Core Haptics. Map breath phases to built-in types: .start for inhale, .click for hold, .directionDown for exhale, .stop for rest. No continuous patterns available -- discrete events only.
Background Audio
Add audio to UIBackgroundModes in Info.plist. Without this, audio stops when the app enters background. Required for any breathing session that continues with the screen off.
Audio Format Recommendations
| Use Case | Format | Bitrate | Notes |
| Ambient sounds (loops) | AAC (.m4a) | 128kbps | Good compression, loops well |
| Voice guidance | AAC (.m4a) | 96kbps | Speech doesn't need high bitrate |
| Short UI sounds | CAF (.caf) | Uncompressed | Low latency playback |
| Streaming from AI TTS | PCM buffer | N/A | Feed directly to AVAudioPlayerNode |
Anti-Patterns
| Anti-Pattern | Pattern |
| Not handling audio interruptions | Audio sessions can be interrupted by calls/Siri; observe interruptionNotification to handle gracefully |
Using AVAudioPlayer for mixing | Use AVAudioEngine with player nodes |
| Playing haptics without checking capability | Check CHHapticEngine.capabilitiesForHardware() |
| Continuous haptics during hold phase | Silence during hold -- cognitive rest for user |
Background audio without UIBackgroundModes | Add audio to background modes in Info.plist |
Key References
See reference.md for detailed explanations of audio session categories, interruption handling, haptic engine lifecycle, and pattern design principles.
See examples.md for complete Swift and Info.plist implementations.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

