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

</div>

Class

# iOSSound

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

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `Sound</api/os/sound>` as a replacement.

</div>

## Description

Plays sounds.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                            | Type                               | Read-Only | Shared |
|---------------------------------|------------------------------------|-----------|--------|
| `IsPlaying<iossound.isplaying>` | `Boolean</api/data_types/boolean>` | ✓         |        |
| `Pan<iossound.pan>`             | `Integer</api/data_types/integer>` |           |        |
| `Volume<iossound.volume>`       | `Integer</api/data_types/integer>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                 | Parameters                                  | Returns  | Shared |
|--------------------------------------|---------------------------------------------|----------|--------|
| `Clone<iossound.clone>`              |                                             | iOSSound |        |
| `Constructor<iossound.constructor0>` | file As `FolderItem</api/files/folderitem>` |          |        |
| `Play<iossound.play>`                |                                             |          |        |
| `PlayLooping<iossound.playlooping>`  |                                             |          |        |
| `Stop<iossound.stop>`                |                                             |          |        |

## Property descriptions

<div id="iossound.isplaying">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSSound.IsPlaying

**IsPlaying** As `Boolean</api/data_types/boolean>`

Indicates if the sound is currently playing.

This property is read-only.

<div id="iossound.pan">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSSound.Pan

**Pan** As `Integer</api/data_types/integer>`

Specifies the relative volume (balance) between the left and right sound channels.

The value ranges from -100 to +100, with 0 indicating equal volume in both channels. -100 plays sound in only the left channel, 100 plays sound only in the right channel.

<div id="iossound.volume">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSSound.Volume

**Volume** As `Integer</api/data_types/integer>`

Specifies the volume level of the sound. Default = 100.

The value ranges from 0 to 100. A value of 0 mutes the sound and a value of 100 plays the sound at the "normal" volume set in the OS volume settings.

Lower the sound volume:

``` xojo
mySound.Volume = 50
```

## Method descriptions

<div id="iossound.clone">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSSound.Clone

**Clone** As iOSSound

Creates a clone of the current sound that can be used independently of the original.

<div id="iossound.constructor0">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSSound.Constructor

**Constructor**(file As `FolderItem</api/files/folderitem>`)

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Creates a new sound from a sound file.

Plays a sound from the Documents folder:

``` xojo
Var soundFile As FolderItem
soundFile = SpecialFolder.Documents.Child("MySound.mp3")
Var mySound As New iOSSound(soundFile)
mySound.Play
```

<div id="iossound.play">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSSound.Play

**Play**

Plays the sound once.

Plays a sound:

``` xojo
mySound.Play
```

<div id="iossound.playlooping">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSSound.PlayLooping

**PlayLooping**

Plays the sound, repeating it indefinitely.

<div id="iossound.stop">

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

</div>

<div class="rst-class">

forsearch

</div>

iOSSound.Stop

**Stop**

Stops the sound from playing.

## Notes

Supported [iOS audio formats](https://developer.apple.com/library/ios/documentation/MusicAudio/Conceptual/CoreAudioOverview/CoreAudioEssentials/CoreAudioEssentials.html):

| Format Name           | Filename Extension |
|-----------------------|--------------------|
| AIFF                  | .aif, .aiff        |
| CAF                   | .caf               |
| MPEG-1, layer 3       | .mp3               |
| MPEG-2 or MPEG-4 ADTS | .mp4               |
| MPEG-4                | .m4a, .mp4         |
| WAV                   | .wav               |

## Compatibility

iOS projects on the iOS operating system.
