<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UserNotifications",
  "identifier" : "/documentation/UserNotifications/UNNotificationSound",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "User Notifications"
    ],
    "preciseIdentifier" : "c:objc(cs)UNNotificationSound"
  },
  "title" : "UNNotificationSound"
}
-->

# UNNotificationSound

The sound played upon delivery of a notification.

```
class UNNotificationSound
```

## Overview

Create a [`UNNotificationSound`](/documentation/UserNotifications/UNNotificationSound) object when you want the system to play a specific sound when it delivers with your notification. To play the default system sound, create your sound object using the [`default`](/documentation/UserNotifications/UNNotificationSound/default) method. If you want to play a custom sound, create a new sound object and specify the name of the audio file that you want to play.

For local notifications, assign the sound object to the [`sound`](/documentation/UserNotifications/UNMutableNotificationContent/sound) property of your [`UNMutableNotificationContent`](/documentation/UserNotifications/UNMutableNotificationContent) object. For a remote notification, assign the name of your sound file to the `sound` key in the `aps` dictionary. You can also use a notification service app extension to add a sound file to a notification shortly before delivery. In your extension, create a [`UNNotificationSound`](/documentation/UserNotifications/UNNotificationSound) object and add it to your notification content in the same way that you’d for a local notification.

Audio files must already be on the user’s device before the system can play them. If you use a predefined set of sounds for your notifications, include the audio files in your app’s bundle. For all other sounds, the [`UNNotificationSound`](/documentation/UserNotifications/UNNotificationSound) object looks only in the following locations:

- The `/Library/Sounds` directory of the app’s container directory.
- The `/Library/Sounds` directory of one of the app’s shared group container directories.
- The main bundle of the current executable.

### Prepare Sound Resources

The system sound facility plays custom alert sounds, so they must be in one of the following audio data formats:

- Linear PCM
- MA4 (IMA/ADPCM)
- µLaw
- aLaw

You can package the audio data in an `aiff`, `wav`, or `caf` file. Sound files must be less than 30 seconds in length. If the sound file is longer than 30 seconds, the system plays the default sound instead.

You can use the `afconvert` command-line tool to convert sounds. For example, to convert the system sound `Submarine.aiff` to IMA4 audio in a CAF file, use the following command in Terminal:

`afconvert /System/Library/Sounds/Submarine.aiff ~/Desktop/sub.caf -d ima4 -f caff -v`

## Topics

### Creating Notification Sounds

[`default`](/documentation/UserNotifications/UNNotificationSound/default)

Returns an object representing the default sound for notifications.

[`init(named:)`](/documentation/UserNotifications/UNNotificationSound/init(named:))

Creates a sound object that represents a custom sound file.

### Getting Critical Sounds

[`defaultCritical`](/documentation/UserNotifications/UNNotificationSound/defaultCritical)

The default sound used for critical alerts.

[`defaultCriticalSound(withAudioVolume:)`](/documentation/UserNotifications/UNNotificationSound/defaultCriticalSound(withAudioVolume:))

Creates a sound object that plays the default critical alert sound at the volume you specify.

[`criticalSoundNamed(_:)`](/documentation/UserNotifications/UNNotificationSound/criticalSoundNamed(_:))

Creates a custom sound object for critical alerts.

[`criticalSoundNamed(_:withAudioVolume:)`](/documentation/UserNotifications/UNNotificationSound/criticalSoundNamed(_:withAudioVolume:))

Creates a custom sound object for critical alerts with the volume you specify.

### Type Properties

[`defaultRingtone`](/documentation/UserNotifications/UNNotificationSound/defaultRingtone)

### Type Methods

[`ringtoneSoundNamed(_:)`](/documentation/UserNotifications/UNNotificationSound/ringtoneSoundNamed(_:))



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)