AlarmKit - Custom Sounds?

Could someone please explain how to use a custom sound when setting up an alarm using AlarmKit? It keeps playing a default sound.

Also, I keep having an issue where the alarm sound plays but doesn’t show the alarm interface buttons unless the screen is locked.

What I did to play a custom sound was I just did Add File "Glass Drum.caf" to add it to the Bundle, then in the func where I schedule the alarm in the AlarmConfiguration I add sound: AlertConfiguration.AlertSound.named("Glass Drum.caf") and that works.

Also be sure you have imported ActivityKit.

My problem is that when I hit the Stop button, the alarm is dismissed, but the sound keeps playing.

I also have the problem where if I haven't locked the screen I get the sound but no alarm visual presentation.

Any help on those items would be great.

does it have to be a .caf file, or a certain duration sound file? mine is a .wav file.

I can't either, no matter caf/wav/m4a. I tried to put audio into bundle and library/sounds (check AlertConfiguration.AlertSound's doc) , no one works

I don't think it has to be a .caf file or a specific length. I made my sound in GarageBand and it's about 10 seconds in total, so not hugely long but more than just a simple beep, and I first made the sound quite awhile ago when caf was being promoted by Apple but I think any standard audio type that is compatible with CoreAudio should work.

Also, after you add your file make sure its Target Membership includes whatever Target will be calling the audio, that might have an effect. So if you are calling it from your LiveActivity Target, the sound may have to have the LiveActivity target as a Target Membership. I haven't tried that on a sound (mine is just a simple Lock Screen alarm) but I know that has an impact on other media.

Hello, I’ve been trying to get it to work without success. Have you found a way to make it work? :)

Thanks!

I have the same issue. Did anybody solve it? If it plays custom sounds for you could you please share the sound file you use?

Same here, I have tested different sound file formats, it won't work.

+1

+1

On beta 5, it started playing sounds from the app Bundle (not more than 30 sec file, plays once without repeat). And it is still not playing sounds from the Library/Sounds folder. What about you?

I've just checked beta 7:

  • Custom sounds from the App Bundle — play (once, without repeat)
  • Custom sounds from the Library/Sounds directory — do not play

Could anyone play a sound from the Library/Sounds directory?

AlarmKit - Custom Sounds?
 
 
Q