<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreHaptics",
  "identifier" : "/documentation/CoreHaptics/CHHapticEngine/registerAudioResource(_:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Haptics"
    ],
    "preciseIdentifier" : "c:objc(cs)CHHapticEngine(im)registerAudioResource:options:error:"
  },
  "title" : "registerAudioResource(_:options:)"
}
-->

# registerAudioResource(_:options:)

Registers an external audio to use as a custom waveform.

```
func registerAudioResource(_ resourceURL: URL, options: [AnyHashable : Any] = [:]) throws -> CHHapticAudioResourceID
```

## Parameters

`resourceURL`

A URL that identifies the location of the audio file to register.

`options`

A dictionary with audio resource keys and values that describe how to play this resource.

## Return Value

An identifier for the audio resource.

## Discussion

Before you initialize a Core Haptics event with your own audio file, use this method to register the file with the engine. Reference external audio files using a URL.

Input the value that this method returns when creating the dictionary or event representation of a haptic pattern.

> Note:
> In an Apple Haptics and Audio File (AHAP), you specify audio files by their path, as opposed to their registered resource URL. For more information, see <doc://com.apple.corehaptics/documentation/CoreHaptics/representing-haptic-patterns-in-ahap-files>.

## Topics

### Audio Resource Keys

[`CHHapticAudioResourceKeyLoopEnabled`](/documentation/CoreHaptics/CHHapticAudioResourceKeyLoopEnabled)

A key for a Boolean value that indicates whether to loop audio playback.

[`CHHapticAudioResourceKeyUseVolumeEnvelope`](/documentation/CoreHaptics/CHHapticAudioResourceKeyUseVolumeEnvelope)

A key for a Boolean value that indicates whether audio file playback fades in and out using an envelope.

[`CHHapticAudioResourceKey`](/documentation/CoreHaptics/CHHapticAudioResourceKey)

A type alias for a key that identifies the playback behavior of an audio resource.



---

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)