> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/api/flatredball/audio/sound.md).

# Sound

### Introduction

The Sound class is used to manage and play a sound cue. It can be obtained from the [AudioManager](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) using the GetSound(CueName) method.

### Sound Control

The following methods will modify the playback of a sound:

* **Play()** - Plays the sound, resumes the sound (if paused), or restarts the sound (if stopped).
* **Stop() / StopAsAuthored()** - Stops playback of the sound as authored in the XACT project.
* **StopImmediately()** - Stops playback of the sound immediately.
* **Pause()** - Pauses playback of the sound.

Additionally, there is a **Variables** field within the sound object which provides easy access to any cue instance variables. For example, if the XACT project defined a "Volume" cue instance variable, then it could be accessed using the following line:

```
float soundVolume = mySound.Variables["Volume"];
```

It could be set using the following line:

```
mySound.Variables["Volume"] = 6.0f;
```

For more information on setting variables in an XACT project, read the XNA Creator's Club's Advanced Audio Tutorial on [controlling pitch and volume with variables](http://creators.xna.com/Headlines/tutorialscol1/archive/2007/04/26/Advanced-Audio-Tutorial-1_3A00_-Controlling-Pitch-and-Volume-with-Variables.aspx).

Did this article leave any questions unanswered? Post any question in our [forums](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/forum.md) for a rapid response.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flatredball.com/flatredball/api/flatredball/audio/sound.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
