> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# PlaySound()

## Definition

Plays a .wav file while running on real-time data.

1. This method will only execute once the **State** has reached **State.Realtime**. Calls to this method during **State.Historical** will be ignored (in contrast to the implementation for **AddOns**).
2. The default behavior is to play the .wav file in an asynchronous manner, which can result in calls to **PlaySound()** to play over one another. Sound files can optionally be configured to execute in a synchronous manner by enabling the Tools > Options > Sounds > "Play consecutively" property.

## Method Return Value

This method does not return a value.

## Syntax

`PlaySound(string fileName)`

The underlying framework used to play the sound requires the audio file to be in PCM .wav format. Using another file format will generate an error at runtime.

## Parameters

| Parameter    | Description                                     |
| ------------ | ----------------------------------------------- |
| **fileName** | The absolute file path of the .wav file to play |

You can obtain the default NinjaTrader installation directory to access the sounds folder by using **NinjaTrader.Core.Globals.InstallDir** property. Please see the example below for usage.

## Examples

```csharp
// Plays the wav file mySound.wav
PlaySound(@"C:\mySound.wav");

// Plays the default Alert1 sound that comes packaged with NinjaTrader
PlaySound(NinjaTrader.Core.Globals.InstallDir + @"\sounds\Alert1.wav");
```