Sound and Haptics

RSS for tag

Create meaningful and delightful experiences that engage a wider range of senses with sound and haptic design.

Posts under Sound and Haptics tag

17 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Custom Apple Pencil Pro Haptics
Just got my hands on the Apple Pencil Pro, and was looking forward to being able to add tactile feedback to my apps through the Pencil. Apple appears to have updated their docs to make mention of the possibility of haptic feedback via the pencil and makes vague references to a certain SwiftUI modifier, but doesn't give any pencil-specific guidelines, code or speak about its capabilities at all. I'd like to ask if its possible to use CoreHaptic to queue custom haptic feedback (as of now the standard code which works on iPhone doesn't seem to work on an iPad with a paired Pencil Pro), or if that's not possible if there are any updated resources/example code for triggering predefined Pencil Pro haptics.
2
0
478
May ’24
UI Sound FX package for Vision Pro?
Hi, I noticed that several of the top Vision Pro apps such as Disney+ and Max have similar if not identical SFX for basic navigation like Select and Back. I was wondering if Apple has provided an audio SFX library as a resource, or if the similarity is coincidental. I'm not familiar with Apple providing anything like this in the past, but figured on a totally new platform where they might be trying to establish a paradigm, it was worth looking into!
0
0
523
Mar ’24
Core Haptics Engine Player Destruction with Corrupted AHAP Files
Hello, I've encountered a concerning issue while working with Core Haptics which I believe warrants attention from the community and Apples engineering team. When attempting to play a haptic pattern using the ChHapticEngine.playPattern method with a corrupted AHAP file path, I've observed unexpected behavior. Specifically, the player is immediately destroyed, triggering the notifyWhenPlayersFinished callback with nil error before executing the catch block(catch block is eventually executed), Furthermore, this behavior introduces ambiguity regarding the successful playback of haptic patterns, as corrupted files can produce false positives in error notifications. Current workaround is simple, AHAP files are JSON formated files at the end of the day, so just try to decode data or create Foundation object from given JSON data. and if this fails then data must not be in expected format(or decoding strategy is off), that way you can guarantee the validity of an AHAP file before passing it to your player. Michaud Reyna, Senior iOS Engineer
1
0
338
Feb ’24
Swift unable to find sound file
Hi everyone, I'm currently facing an issue with AVAudioPlayer in my SwiftUI project. Despite ensuring that the sound file "buttonsound.mp3" is properly added to the project's resources (I dragged and dropped it into Xcode), the application is still unable to locate the file when attempting to play it. Here's the simplified version of the code I'm using: import SwiftUI import AVFoundation struct ContentView: View { var body: some View { VStack { Button("Play sound") { playSound(named: "buttonsound", ofType: "mp3") } } } } func playSound(named name: String, ofType type: String) { guard let soundURL = Bundle.main.url(forResource: name, withExtension: type) else { print("Sound file not found") return } do { let audioPlayer = try AVAudioPlayer(contentsOf: soundURL) audioPlayer.prepareToPlay() audioPlayer.play() } catch let error { print("Error playing sound: \(error.localizedDescription)") } }
7
0
760
Feb ’24
Game not muted with ring/silent switch
Hi, I'm building a simple game for iOS. I have background music. The ring/silent switch is not disabling sound when switched to silent. So far I'm testing on devices through TestFlight (still internal testing, not beta). Do I need to code this function myself or does iOS know it's a game and disable sound automatically? and/or would my game be rejected if the switch doesn't disable sound? (I have an internal setting to enable/disable sounds in the game) Due to the way it's coded (capacitor app), I can't access the ring/silent switch to disable/enable sound. Thanks, this problem makes me feel like a preserved moose.
0
0
412
Feb ’24
Lower Notification Sounds on iOS 17
I'm involved in development on an iOS app for home security and alarm systems. There is recently a lot of negative feedback from customers about how low the notification sounds are since iOS17. Much of the feedback centers around the inability to control the volume of the notification sounds. My question is: if our app uses custom notification sounds, are these impacted by the volume changes made in iOS 17? I know previous versions of iOS allow you to control "Ringtone and Alert" volume in settings (with a volume slider). Is this same control still available for custom notification sounds within our app?
0
0
606
Nov ’23
NSSound causing crashes on Sonoma
We've been doing the following in our app for years without issues: [[NSSound soundSystem:@"Basso"] play] Suddenly we're seeing hundreds of crashes from macOS 14.0 users and we're not sure what's causing this. There are no memory leaks within the app and all the stack traces are around NSSound: 0 AudioToolbox 0x1f558 MEDeviceStreamClient::RemoveRunningClient(AQIONodeClient&, bool, bool) + 3096 1 AudioToolbox 0x1e8fc AQMEDevice::RemoveRunningClient(AQIONodeClient&, bool) + 108 2 AudioToolbox 0x1e854 AQMixEngine_Base::RemoveRunningClient(AQIONodeClient&, bool) + 76 3 AudioToolbox 0xcdd78 AudioQueueObject::StopRunning(AQIONode*, bool) + 244 4 AudioToolbox 0xcbdd0 AudioQueueObject::Stop(bool, bool, int*) + 736 5 AudioToolbox 0xf1840 AudioQueueXPC_Server::Stop(unsigned int, bool) + 172 6 AudioToolbox 0x1418b4 ___ZN20AudioQueueXPC_Bridge4StopEjb_block_invoke + 72 7 libdispatch.dylib 0x3910 _dispatch_client_callout + 20 8 libdispatch.dylib 0x130f8 _dispatch_sync_invoke_and_complete_recurse + 64 9 AudioToolbox 0x141844 AudioQueueXPC_Bridge::Stop(unsigned int, bool) + 184 10 AudioToolbox 0xa09b0 AQ::API::V2Impl::AudioQueueStop(OpaqueAudioQueue*, unsigned char) + 492 11 AVFAudio 0xbe12c AVAudioPlayerCpp::disposeQueue(bool) + 188 12 AVFAudio 0x341dc -[AudioPlayerImpl dealloc] + 72 13 AVFAudio 0x358a0 -[AVAudioPlayer dealloc] + 36 14 AppKit 0x1b13b4 -[NSAVAudioPlayerSoundEngine dealloc] + 44 15 AppKit 0x1b132c -[NSSound dealloc] + 164 16 libobjc.A.dylib 0xf418 AutoreleasePoolPage::releaseUntil(objc_object**) + 196 17 libobjc.A.dylib 0xbaf0 objc_autoreleasePoolPop + 260 18 CoreFoundation 0x3c57c _CFAutoreleasePoolPop + 32 19 Foundation 0x30e88 -[NSAutoreleasePool drain] + 140 20 Foundation 0x31f94 _NSAppleEventManagerGenericHandler + 92 21 AE 0xbd8c _AppleEventsCheckInAppWithBlock + 13808 22 AE 0xb6b4 _AppleEventsCheckInAppWithBlock + 12056 23 AE 0x4cc4 aeProcessAppleEvent + 488 24 HIToolbox 0x402d4 AEProcessAppleEvent + 68 25 AppKit 0x3a29c _DPSNextEvent + 1440 26 AppKit 0x80db94 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716 27 AppKit 0x2d43c -[NSApplication run] + 476 28 AppKit 0x4708 NSApplicationMain + 880 29 ??? 0x180739058 (Missing)
1
0
720
Oct ’23