Minecraft Blogs / Tutorial

Create Custom Music Discs! | Data Pack Enhanced

  • 18,088 views, 13 today
  • 43
  • 29
  • 7
Bertiecrafter's Avatar Bertiecrafter
Retired Moderator
Level 70 : Legendary Engineer
775

The Custom Music Disc Framework data pack allows you to create and play custom music discs!


Previously, you could only overwrite existing music discs with your own music and since everyone is overwriting the same disc, you could only ever have 1 custom track. Well, those times are over.

This page describes creating custom music discs. Read the data pack submission if you want to play these discs.

Disclaimer
Although allowed for personal use, do not publish (and/or claim as your own) music/sounds that you did not create yourself. Always check with the author of the original track if remixing or sampling is allowed.

Getting Set Up
Start by heading over to the framework submission page linked above, download and extract the .zip file. Install the framework and example data packs into a world and install the example resource pack into your resource packs folder. Check if the setup works by trying to get a "your username - title" custom music disc and play it. See the instructions on the framework submission page.

In the next steps we'll be defining your custom music disc. You'll be instructed to open text files and change some values. Change the parts that are colored, but leave the black parts alone. Parts across files with the same color should get the same values.

Defining your custom music disc
First off, come up with a title for your music disc. Rename both the example data pack and the example resource pack folders to be fitting for your music disc. Now let's make some changes to several text files:

In the data pack, pack.mcmeta, line 4:
"description": "Custom Disc Example"

Custom Disc Example - Should match data pack folder name

In the data pack, data/bertiecrafter/tags/functions/cdf/register.json, line 3:
"your_username_here:cdf/register"

your_username_here - Preferably enter your in-game name here. Only a-z (not A-Z), 0-9 and _ allowed and must start with a lower case letter.

In the data pack, rename the data/your_username_here folder to match your_username_here.

In the data pack, data/your_username_here/functions/cdf/register.mcfunction, line 1:
data modify storage bertiecrafter:cdf Discs append value {item:"minecraft:music_disc_wait",custom_model_data:12345,code:"your username - title",label:'{"text":"your username - title","color":"gray","bold":false,"italic":false}',sound:"/playsound your_username_here:cdf/title record @a"}

music_disc_wait - Must be one of the disc items. The choice only impacts what your disc is going to look like, it's non-functional.
12345 - A custom model data number. Can be used to attach custom models (and textures) to this specific track.
your username - title - The track code that your users will have to type in their book to obtain your disk. Must be unique, so including your in-game name is advised. Double quotes inside the track code must have a backslash in front of them (e.g. \" ).
your username - title - The styled info that is displayed in the item tooltip. If you know about JSON text, you can do some really cool looking things here. To keep things logical, the text should be similar to the previous variable. Double and single quotes inside the label must have a backslash in front of them (e.g. \' or \" ).
your_username_here - Must be the same as the previously used your_username_here.
title - This will be the file name for your music. Only a-z (not A-Z), 0-9 and _ allowed and must start with a lower case letter.

Repeat this line for multiple music discs. Do not add any commas at the end of lines.

In the resource pack, pack.mcmeta, line 4:
"description": "By your_username_here"

By your_username_here - The visible description of the resource pack. Can be anything, but you probably want to include your (user)name. Double quotes inside the description must have a backslash in front of them (e.g. \" ).

In the resource pack, rename the assets/your_username_here folder to match your_username_here.

In the resource pack, assets/your_username_here/sounds.json, line 2:
"cdf/title": {"sounds":[{"name":"your_username_here:cdf/title","stream":true,"attenuation_distance":64}]}

title - Must be the same as the previously used title.
your_username_here - Must be the same as the previously used your_username_here.
title - Must be the same as the previously used title.

Repeat this line for multiple music discs. Make sure to add a comma to each of the lines except the last one. The default example only has one line, which is the last line, so there is no comma.

In the resource pack, assets/your_username_here/sounds/cdf, delete all contents.

Convert your sound file to OGG with only 1 sound channel (mono). You can do this at convertio.co by selecting the file, selecting "OGG" in the dropdown, clicking the cog next to the drop down and setting the "Audio Channels" property to "Mono (1.0)".

Download/Copy the sound file into the resource pack, at assets/your_username_here/sounds/cdf/title.ogg. (Replacing the colored variables in the path with the values you've used before.)

Loading up the packs
Load up the world with the data packs and do /reload. Then also enable your resource pack and press F3+T to reload. You can now place a jukebox and drop a redstone block on top. Insert a music disc. Grab a book and quill and write the previously defined track code on the first page. The code is case sensitive and should not have any enters or spaces at the end. Drop the book and quill together with a diamond on the jukebox. After some time the book should pop out and you can retrieve your custom music disk out of the juke box!

Just re-insert to listen to it.

Publishing
When you got your custom music disc working, you can zip the contents of the resource pack and the data pack individually. Then you can create a data pack submission on Planet Minecraft and add the resource pack as dependency. On the submission page, make sure to link to the framework submission page.

Example instructions to put on your submission page.
BBCode:[b]How to install[/b][list][*]Download this submission and extract all files from the .zip file.[/*][*]Install the data pack in one of your world saves and install the resource pack in your resource packs folder.[/*][*]Download [url=/data-pack/custom-music-disc-framework/]the Framework[/url] submission and extract all files from the .zip file.[/*][*]Install the Framework data pack inside into the world save. You can get rid of the other 2 resource/data packs.[/*][*]Hop into your world, do /reload and don't forget to enable the resource pack you just installed.[/*][/list]Which results in:

How to install
  • Download this submission and extract all files from the .zip file.
  • Install the data pack in one of your world saves and install the resource pack in your resource packs folder.
  • Download the Framework submission and extract all files from the .zip file.
  • Install the Framework data pack inside into the world save. You can get rid of the other 2 resource/data packs.
  • Hop into your world, do /reload and don't forget to enable the resource pack you just installed.


You can drop the link to your submission in comments section on the framework submission page as well. I'm looking forward to the custom music disc packs you have created! =)



Create Custom Music Discs! | Data Pack Enhanced
Create Custom Music Discs! | Data Pack Enhanced
Tags

Create an account or sign in to comment.

3
06/18/2022 6:20 pm
Level 1 : New Miner
berti294
berti294's Avatar
Update to 1.19 if you still care about this?
1
06/18/2022 6:21 pm
Level 1 : New Miner
berti294
berti294's Avatar
or instructions on how to update it myself, another mod all I had to do was change 1.18 to 1.19 in a certain document
1
11/15/2021 2:52 am
Level 1 : New Miner
Nemetski_Jetski
Nemetski_Jetski's Avatar
Could you elaborate more on adding multiple discs? I manage to get it working for 1 disc but when I try to add more it starts breaking. Specifically I have two questions regarding what I assume are the only files we need to modify to get multiple discs:

1. In data/your_username_here/functions/cdf/register.mcfunction, should we also add a comma to the end of each line as we do in the resource pack when adding multiple discs?

2. In assets/your_username_here/sounds.json will all of the lines be within the brackets that are already there or do we need to make another set of brackets.

Apologies if these questions seem trivial but I feel like I'm doing what is necessary to add multiple discs but I'm wondering if it's failing because of some dumb syntax error I haven't learned about yet.
3
11/15/2021 1:47 pmhistory
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
Awesome that you got one working!

1 No, don't add a trailing comma.

2 You should repeat the line between the outer-most brackets. I bunched up most of the JSON so you could easily copy paste the line. You do need a trailing comma to the first of those here.

Yes, you only need to modify register.mcfunction and sounds.json for new music discs. If the label shows up, but no sound then you need to fix sounds.json. If tab-autocomplete on /playsound makes your song show up, then you need to fix register.mcfunction.

Note that you have to use both /reload (reload data packs) and F3+T (reload textures) to apply all the changes you made.
1
11/22/2021 3:49 pmhistory
Level 1 : New Miner
Nemetski_Jetski
Nemetski_Jetski's Avatar
Ok thank you for the debugging suggestion. I tried again today and I've found that all the sounds are there, but I cannot obtain the records using the track code and book and quill as the other help page says. The only thing I did with register.mcfunction was copy and paste the given line directly below and change the relevant variables. Is there anything else you can suggest looking at to make sure they work properly?

Edit: Now that I think about it, I assume that the error has to do with how I'm writing the track code, but it should work with spaces and capital letters shouldn't it?
2
11/24/2021 12:47 am
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
Uhh, maybe you can find me in my discord server (Press discord icon at bottom of submission) and share what you've got so far. It would help others if we can figure this out.

Track code is fine to have spaces. In my experience the trickiest part is making sure the sound is mono, Minecraft just won't play it if it's stereo. See the section about converting your music files for more info.
4
08/15/2021 3:30 pmhistory
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
Thank you Rion_, Vellariya, FishStacks, DaniAdler, Emmettrocks197, TomConn, Lemilas, Whispearl, partyweevil, djstew22, Kacper2013, Sted, NoctaMC, InZanee, Rukuno, x-form5, MrMiner_, _Anto, Adrestio, Attrita, Gio0543, GalaxiumNation, GetSirius55, sky20050 and slink_13 for the diamonds!
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome