> 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/microsoft-xna-framework/audio/soundeffect.md).

# SoundEffect

### Introduction

The SoundEffect class represents a sound effect that can be played at any time. The FlatRedBall Editor supports the automatic creation of SoundEffect objects by adding a WAV file to a Screen, Entity, or Global Content. For reference on the SoundEffect object, see the [MonoGame SoundEffect page](https://docs.monogame.net/api/Microsoft.Xna.Framework.Audio.SoundEffect.html). For more information on using SoundEffect through the FlatRedBall Editor, see [the tutorial page on playing sounds](/flatredball/tutorials/glue-tutorials/glue-how-to-play-sounds.md).

### Code Example

The following example assumes that you have "mySound.wav" added to your content project. If not using Glue, you will need to pass the .WAV file through the MonoGame content pipeline. Glue will automatically process .WAV files added to Screens, Entities, and Global Content Files.

```csharp
// SoundEffects load through the content pipeline, so there is no extension
SoundEffect soundEffect = FlatRedBallServices.Load<SoundEffect>(@"Content\mySound");
// to play the sound, just call Play:
soundEffect.Play();
```

You can adjust parameters on the Play call as shown in the following code snippet:

```csharp
SoundEffectFile.Play(volume: 1, pitch: 0, pan: 0);
```


---

# 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/microsoft-xna-framework/audio/soundeffect.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.
