# Audio

The `<audio>` element lets you play sound on your site. You do so by writing:

```
<audio src="path/to/audio.mp3" controls>
    <p>Your browser doesn't support the HTML5 audio element.</p>
</audio>
```

As with the `<video>` element, the `<audio>` element also takes the attributes `src` and `controls`, and they behave exactly the same. The `src` is the path to the file, and `controls` display the controls, allowing the user to play and pause the audio, and control the audio.

If you need a fallback audio, you can use the \`\<source>\` element. You would then write:

```
<audio controls>
    <source src="path/to/audio.mp3" type="audio/mp3">
    <source src="path/to/audio.oog" type="audio/oog">
    <p>Your browser doesn't support the HTML5 audio element.</p>
</audio>
```

As of February 2016, the following browser support these video formats:

| Browser           | MP3 | Wav | Ogg |
| ----------------- | --- | --- | --- |
| Internet explorer | Yes | No  | No  |
| Chrome            | Yes | Yes | Yes |
| Firefox           | Yes | Yes | Yes |
| Safari            | Yes | Yes | No  |
| Opera             | Yes | Yes | Yes |
| Microsoft Edge    | Yes | Yes | No  |

Other notable attributes are `autoplay`, `loop` and `muted`. These are all the same as with their video counterpart. `autoplay` starts the audio automatically, `loop` seeks back to the start of the audio when it reaches the end, and `muted` sets the default volume to silenced.

You can read more about the audio element [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio).


---

# 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://it2805.gitbook.io/curriculum/web-and-multimedia/audio.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.
