> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://documentation.celestory.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 🟧 Play music

# 🟧 Play music

${frame}[Video: anatomy of the Play music block](https://celestory-docs-videos.netlify.app/en/anatomie-bloc/music.html)

![Play music](https://celestory-docs-illustrations.netlify.app/en/Playmusic_EN.svg)

The Play music block allows you to launch an audio track in the background, ideal for background music or continuous sound loops.

Unlike the Play Sound block which is designed for one-off effects, this block is optimized for background playback, with an auto-repeat option.

## 📥 Entries

- music (Sound): The audio file (mp3, wav) containing the background music to play.
- repeat (Boolean): If activated (True), the music repeats in a loop. Disabled (False) by default.

## 📤 Outings

- out (Flow): The logic flow continues immediately after the music starts, without waiting for it to end.

## 💡 Example of use

Scenario: Ambient music for an adventure game

1. The player enters an enchanted forest.
1. The flow reaches a Condition block checking the current area (enchanted_forest).
1. The Play music block is activated with:

- music: ambience_foret.mp3
- repeat: True (for a continuous loop)

1. The music starts in the background, and the stream moves to the next block (showing a welcome message).
1. The player explores the forest while the music persists until another audio block replaces or stops it.

## ⚙️ Technical Details

- Asynchronous behavior: The music continues to play even after moving to the next block, without blocking the stream.
- Supported formats: MP3 and WAV (prefer MP3 for reduced weight).
- Loop management: If repeat is disabled, the music stops naturally at the end of the file.

---

*Documented version: v1*