Minecraft 13w42a New sounds.json file - How to Modify and Add New Sounds
Minecraft 13w42a includes a new sounds.json file hidden nicely in the assets folder. This little baby gives us more control over the sounds which play during the game - that includes both sound effects and music. We'll cover a quick tutorial showing you how edit the sounds.json file and include your own music with custom parameters.
You don't need to be an expert in JSON to understand how to edit the sounds.json file, but incase it helps we're going to give quick intro to JSON..
What is JSON?
If you're from the programming world (like us), JSON is a nifty little notation that helps you package data into simple but readable structures that computers can understand. Forget your complex compilers etc. JSON is simple and it was designed to be a human-readable data interchange.
If you take a quick peek at the sounds.json file (located at %appdata%\.minecraft\assets\) and open it using notepad, you'll see that it's just like a well structured notebook. Items are neatly organized by curly brackets with quotation marks for parameters separated by double colons and comas. The default sounds.josn file is a great starter and you can simply modify it without needing to build it from scratch.
What do the parameters mean?
Let's look at a simple example. Open the sounds.json file and the first entry you will see is ambient.cave.cave, that's a type namespace created by Dinnerbone. Namespaces are used to organize all the sounds into small groups. In this case the namespace is: ambient.cave.cave (i.e. cave sounds).
Underneath the namespace declaration, we have several parameters, in this case:
- Category - which is set to ambient
- Sounds - which contains a list of the sounds to play for the cave event/environment
The full list of possible parameter values are:
- Category - master, music, record, weather, block, hostile, neutral, player, ambient
- Replace - default false, if true it will override all the sounds from the resourcepack above this one
The list of sound files is enclosed in square brackets:
For each entry (i.e. sound) there are several parameters:
- name - what the music called (must be a .ogg file but don't include .ogg here)
- type - "event" or "sound". Sounds are files, events are other events
- weight - default 1, how likely it is to be randomly picked
- volume - default 1, the volume to play the sound at
- pitch - default 1, pitch to play at (similar to speed)
- stream - default false, set it to true for long sounds (minutes long) but use it cautiously
A good example of additional parameters in the default sounds.josn file is the Music namespace (see image below):
Where should you save new sound files?
For each sound entry, there must be a corresponding sound file located in the following folder:
If you open the ambient folder, you'll see all the cave sounds are there:
New sounds must be saved in .ogg format.
Overriding the default sounds.json
The sounds.json file is the default sounds configuration. The best way to override these sounds is to include your own sounds.json file in a Resource Pack.
When the player selects the Resource Packs to use (from the Minecraft game menus), the final (merged) sounds will be selected based on all the resource packs and the original sounds.json file. Resource Packs take precedence over the default sounds.
Also, you don't have to include all the sounds in your Resource Pack. If you omit a particular sound (namespace) then the default sounds.json entry (or other low priority Resource Pack) will be used instead. It's a similar principle to Texture Packs, where an image is 'pulled' from the default folder if a Resource Pack does not include that particular image.
If you're not worried about Resource Packs, you can always edit the default sounds.json file if you want (just make sure you make a backup first).
How to add a new sound to sounds.json
Once you've got a new OGG file and have saved it in an appropriate folder under:
You can include the new filename in the sounds.josn file. For example, if your new sound was called mysong.ogg and you saved it in the music folder, then the sounds.json file would look like this:
You could also add a new paramter to make sure the song was given more priority (i.e. it played more often):
The best way to learn is to experiment, so get Notepad ready, convert some ogg files and play around...enjoy!!