<div class="meta" robots="noindex">

</div>

Method

# FolderItem.OpenAsSound

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `Sound.Open<sound.open>` as a replacement.

</div>

## Description

Opens the **FolderItem** to be read and returns its contents as a sound object.

## Notes

On macOS <span class="title-ref">OpenAsSound</span> recognizes sound formats that [Core Audio can play](https://developer.apple.com/library/ios/documentation/MusicAudio/Conceptual/CoreAudioOverview/SupportedAudioFormatsMacOSX/SupportedAudioFormatsMacOSX.html).

On Windows WAVs, WMAs, MP3s, and MIDI files can be played, but only WAVs play with [DirectSound](http://msdn.microsoft.com/en-us/library/windows/desktop/ee416960(v=vs.85).aspx) (this allows individual pan and volume settings for each sound. You can also play multiple sounds simultaneously).

On Linux [GStreamer](http://gstreamer.freedesktop.org), [xine](http://www.xine-project.org/home), or [libsndfile](http://en.wikipedia.org/wiki/Libsndfile) is used (in that order if available). `Nil</api/language/nil>` is returned if the sound can't be read or isn't a sound file at all.

## Sample code

This example loads a sound file called “hello.mp3” from the current directory (folder) into a `Sound</api/os/sound>` object and plays it.

``` xojo
Dim f As FolderItem
f = GetFolderItem("hello.mp3")

If f <> Nil And f.Exists Then
  Dim s As Sound
  s = f.OpenAsSound
  s.Play
End If
```

## Compatibility

All project types on all supported operating systems.
