<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Bundle/path(forSoundResource:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBundle(im)pathForSoundResource:"
  },
  "title" : "path(forSoundResource:)"
}
-->

# path(forSoundResource:)

Returns the location of the specified sound resource file.

```
func path(forSoundResource name: NSSound.Name) -> String?
```

## Parameters

`name`

The name of the sound resource file, without any pathname information. Including a filename extension is optional

## Return Value

The absolute pathname of the resource file or `nil` if the file was not found.

## Discussion

Sound resources are those files in the bundle that are recognized by the `NSSound` class. The types of sound files can be determined by calling the `soundUnfilteredFileTypes` method of `NSSound`.

## See Also

[`-  pathForResource:ofType:`](/documentation/Foundation/Bundle/path(forResource:ofType:))

Returns the full pathname for the resource identified by the specified name and file extension.



---

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)