# Sounds

## Converting files from `MP3` to `OGG`

Use [this website](https://misieur.me/audio-converter/) to convert your file (`mp3`, `wav`...) to `ogg` (alternative [here](https://audio.online-convert.com/convert-to-ogg)).

{% hint style="warning" %}
**IMPORTANT**

Remember to set "Channels" to `Mono` or you will experience [audio problems](https://bugs.mojang.com/browse/MC-146721)
{% endhint %}

## Creating the sound

### New Method

{% hint style="warning" %}
**This requires ItemsAdder 4.0.12 or greater. Scroll down for older versions.**
{% endhint %}

#### Simple sound

Put the sound file in `contents/my_sounds/sounds/sound_1.ogg`.

```yaml
info:
  namespace: my_sounds
minecraft_lang_overwrite:
  my_lang_overwrite:
    entries:
      sound.sound_1: "Sound 1"
    languages:
    - ALL
sounds:
  sound_1:
    path: bruh
    settings:
      subtitle: sound.sound_1
```

#### Jukebox song (Minecraft 1.21.1 and greater)

{% content-ref url="<https://github.com/LoneDev6/Wiki-ItemsAdder/blob/master/adding-content/jukebox-disc.md>" %}
<https://github.com/LoneDev6/Wiki-ItemsAdder/blob/master/adding-content/jukebox-disc.md>
{% endcontent-ref %}

### Old Method (ItemsAdder 4.0.10 and lower)

<details>

<summary>Click to read the old method</summary>

**Step 1**

* create a new folder `ItemsAdder/contents/my_sounds/resourcepack/my_sounds/sounds/`\
  (or use yours if you already have one)
* put your **`.ogg`** file in there.\
  You can also create more folders inside `sounds` to organize your sounds.\
  For example `effects`, `music` etc...

I have a file named **`song_1.ogg`** and I put it into a new `music` folder.\
So now I have `contents/my_sounds/resourcepack/my_sounds/sounds/music/song_1.ogg`

**Step 2**

* open the folder `contents/my_sounds/resourcepack/my_sounds/`
* create a new file named `sounds.json` (or open it if you already created it)
* this file is a `.json` file so you MUST write it correctly or it won't work.

To add your sound into the file you just have to do this:

{% code title="contents/my\_sounds/resourcepack/my\_sounds/sounds.json" %}

```json
{
	"music.song_1":{
		"sounds":[
			"my_sounds:music/song_1"
		]
	}
}
```

{% endcode %}

**Now I explain each part of the code I wrote**

This is the sound name. You will use it in every part of the plugin and also in Minecraft vanilla [/playsound ](https://www.digminecraft.com/game_commands/playsound_command.php)command.

```
"music.song_1":{
```

This is the list of sound files Minecraft will play when you call the sound name.\
Minecraft will play one of these sounds randomly (only if you set more than one sound).

{% hint style="warning" %}
Keep in mind that you have to change `my_sounds` to your own namespace name if it's different!
{% endhint %}

<pre class="language-javascript"><code class="lang-javascript">"sounds":[
<strong>    "my_sounds:music/song_1"
</strong>]
</code></pre>

For example if you want to have random sounds for the same sound name you just have to create multiple `.ogg` files and put them like this:

```
"sounds":[
    "my_sounds:music/song_1_variant_1",
    "my_sounds:music/song_1_variant_2",
    "my_sounds:music/song_1_variant_3"
]
```

**How can I add multiple sounds in the `sounds.json` file?**

It's easy, the next time you want to add a sound you just have to add a comma at the end, like this.\
(I'm referring to line 6 comma)

```json
{
    "music.song_1":{
        "sounds":[
            "my_sounds:music/song_1"
        ]
    },
    "music.song_2":{
        "sounds":[
            "my_sounds:music/song_2"
        ]
    }
}
```

{% hint style="warning" %}
If you want to be sure not to make mistakes use this website to check if your `sounds.json` file is good or has errors: <https://jsonformatter.curiousconcept.com/>
{% endhint %}

</details>


---

# 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://itemsadder.devs.beer/adding-content/sounds/adding-sounds.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.
