# Play sounds when a letter is shown

To implement typewriter sounds in your game, you can subscribe to the Typewriter’s “`OnCharacterVisible`” event and play sounds based on it.

The event passes a “char” as a parameter, so you can play different sounds based on different letters as well.

*P.S. The event is also triggered with spaces, so be sure to play sounds based on the type of character you prefer.*

***

### Example Package <a href="#example-package" id="example-package"></a>

As an example, you can install the “TypeWriter Sounds” package found inside the “Extra” folder and check its implementation.

![](https://content.gitbook.com/content/XuXUTa2X5PYuYL6yRvl1/blobs/Lld5xGmtqLsHHY6U2x1g/Untitled.png)

<table><thead><tr><th width="221">Variable</th><th>Explanation</th></tr></thead><tbody><tr><td><code>Source</code></td><td>Main audio source where sounds will be played</td></tr><tr><td><code>MinSoundDelay</code></td><td>Minimum time that has to pass before playing another sound</td></tr><tr><td><code>Interrupt Previous Sound</code></td><td>If true, the previous audio will be stopped</td></tr><tr><td><code>Random Sequence</code></td><td>If true, the next audio clip to play will be chosen randomly from the “Sounds” array. If false, sounds will be played subsequently</td></tr><tr><td><code>Sounds</code></td><td>Typewriter sounds to play</td></tr></tbody></table>


---

# Agent Instructions: 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:

```
GET https://docs.febucci.com/text-animator-unity/typewriter/play-sounds-when-a-letter-is-shown.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
