# Layer and loop sound effects

> Layer sound effects on separate channels, play them on a loop, and stop them

Sound effects play one at a time on each numbered channel. If you play another sound effect on the same channel, the previous sound stops and the new one replaces it. By using different channels, you can play several sound effects at once. Sounds that keep going, such as rain or a radio, are played on a loop and stopped when they're no longer needed.

The examples on this page use the English sample story, "Waiting for Stars" (choose "A sample story" and English in New Project, or run `lim new --lang en`; the characters are Akari and Sou).

## Loop a sound effect

1. Select the line just before where it should play, and double-click "Sound" in the parts panel.
2. Choose the sound effect in `file` in the panel on the right (here, radio.wav).
3. Enter a channel number in `channel` (here, 1).
4. Check `loop`.

![The Sound part, with the channel and loop fields.](/shots/en/h-se-control-loop.webp)

Looping sound effects are easier to manage on a channel other than 0, so they don't collide with other sound effects (if you leave `channel` empty, it's 0).

## Layer sounds on another channel

While the radio is playing, play gust.wav with "Sound," leaving the channel at 0. Because the channels differ, the radio doesn't stop, and the sound of the wind plays over it.

The list below the preview on the right shows the sound effects looping as of the selected line, with their channel numbers ("Sound 1" is channel 1). Sound effects that play only once aren't listed.

![The line that adds the wind sound effect, and radio looping in the list below the preview.](/shots/en/h-se-control-overlap.webp)

## Stop a looping sound effect

1. Select the line just before where it should stop.
2. Type "stop" in the search box at the top of the parts panel, and double-click "Stop sound" in the results.
3. In `channel` in the panel on the right, enter the channel of the sound effect to stop (here, 1).
4. To fade it out gradually, enter a fade-out time in milliseconds in `time`.

![The Stop sound part, with the channel and time fields.](/shots/en/h-se-control-stop.webp)

When you select a line after it stops, radio no longer appears in the list below the preview.

![A line after it stops. radio isn't in the list below the preview.](/shots/en/h-se-control-after.webp)

To change only the volume of the sound effects that are playing, type "volume" in the search box and use "Sound volume."

## In code

```
I switched on the radio in my pocket.
@se radio.wav channel=1 loop=true
Through the static, someone was talking about the weather.
@se gust.wav
Suddenly, a strong wind blew.
@stop-se channel=1 time=1s
When I turned off the radio, it was quiet again.
```
