# Stopping a sound

Use a Stop Instruction to end a looping sound or interrupt one before it finishes. The four Instructions select sounds by channel, resource, target, or ID:

| Instruction | Stops |
| :--- | :--- |
| **Stop Audio in Channel** | Everything playing on one channel. |
| **Stop Audio Resource** | Every sound currently playing a particular Audio Resource. |
| **Stop Audio on Game Object** | Every sound whose **Has Target** is that object. |
| **Stop Audio ID** | One specific sound, by the ID it was given when it started. |

All four take the same two fields:

| Field | Controls |
| :--- | :--- |
| **Transition** | Seconds to fade out before stopping. Default `3`. `0` cuts immediately. |
| **Await** | Whether the Event waits for the fade before running the next Instruction. |

## Which one to reach for

Use **Stop Audio Resource** for a loop when only one copy of its resource should be playing. The Events that start and stop a rain loop can point at the same resource without storing an ID.

Use **Stop Audio on Game Object** for sounds associated with a character or other object. It stops the character's current voice without tracking the line, provided playback started with **Has Target** enabled. See [Has Target](playing.md#has-target).

Use **Stop Audio in Channel** when every sound in a category should end. For a scene transition, fade **Ambient** and **Sound Effect** while leaving **Music** active across the load.

!!! tip "Use a fade for gradual transitions"
    **Transition** defaults to `3` seconds. Keep a fade when moving between ambient zones or ending a music track gradually.

    Set it to `0` when the sound should stop abruptly, such as a machine losing power.

## Await

With **Await** off, the Instruction starts the fade and the Event moves on immediately. With it on, the Event waits for the sound to finish fading before continuing.

Enable **Await** when the next action depends on silence, such as loading a scene after its music fades out. Leave it off when the Event should continue during the fade.

## Asking what's playing

Three Conditions check whether sounds selected by resource, target, or ID are playing:

| Condition | Asks |
| :--- | :--- |
| **Is Playing Audio Resource** | Is any sound playing this resource right now? |
| **Is Playing on Game Object** | Is any sound targeting this object right now? |
| **Is Playing Audio ID** | Is this specific sound still active? |

Use **Is Playing Audio Resource** as a guard when a loop must have only one active copy. Otherwise, repeatedly entering its trigger volume stacks another copy of the cue.

!!! warning "Playing the same clip twice plays it twice"
    The Audio Manager doesn't merge repeated requests. Two Play Instructions using the same resource produce two sounds, which may sound distorted if they play slightly out of phase.

    Guard the Event with **Is Playing Audio Resource**, or start the loop from something that can only happen once.

## Audio IDs

Every sound receives a unique ID when it starts. **Stop Audio ID** and **Is Playing Audio ID** use that value to address one sound when several copies of a resource are active.

!!! info "IDs come from C#, not from the editor"
    Play Instructions don't return an ID, and no Signal produces one. In C#, `AudioManager.Play` returns the ID. You can store it in a String variable for **Stop Audio ID** and **Is Playing Audio ID** to read.

    If you're working entirely in the editor, select sounds by resource, channel, or target. Use an ID when you need to select one instance among several matching sounds. See the [Audio API](../../scripting-api/runtime/audio.md).

**Stop Audio ID** expects a well-formed ID. An empty String variable, or one containing another value, raises an error instead of doing nothing. This makes an uninitialized ID visible during debugging.

## Where to go next

- **[Playing a sound](playing.md)** — assign **Has Target** and configure how a sound starts.
- **[Channels](channels.md)** — understand what **Stop Audio in Channel** selects.
- **[Audio API](../../scripting-api/runtime/audio.md)** — obtain and use audio IDs from `AudioManager`.
