- Joined
- May 29, 2023
- Messages
- 41
there are few ways of make custom music
first u will need to make the music code consisting of number and letter for the purpose of this guide i will use this format (Instrument + Pitch + Delay) if u are only using 1 instrument u dont need the instrument data and same for delay if u want to put a fixed delay between the notes
here is the mapping for the music code the mapping can be changed how u like
Instrument:
Piano = 0
Double Bass = 1
Snare Drum = 2
Click = 3
Bass drum = 4
Guitar = 5
Flute =6
Bell = 7
Chime = 8
Xylophone = 9
Pitch
null = 0
F# - D = 1 - 9
D# - F#3 = a - p
look here all the pitches https://minecraft.fandom.com/wiki/Note_Block#:~:text=greater pitch coverage.-,The,-exact pitch to
delay = number in ticks e.g. 5 ticks = 05 10 ticks = 10
arrange a song in noteblock studio or find a song thats already made
convert the song into the code sequence
for example Fur Elise will be converted into: 0n05 0m05 0n05 0m05 0n05 0i05 0l05 0j05 0g05
remove the spaces its waste of space so it will look like this 0n050m050n050m050n050i050l050j050g05
put the music code into a text variable. a text variable can support up to 255 characters since every note is made up of 4 characters you can put up to 63 notes in 1 text variable if your song is longer than this you have to segment it into multiple text variables and play them in order
create a function call it playsong or something this should only execute once when the game is awake make a variable playindex set it = 1
select a random player get the length of the music code into codeLength use truncate text to seperate the instrument, pitch and delay then call another function called decoder in this function use if variables and set variable the instrument and pitch to play e.g if variable checkInstr = 0 set Instr = note.block.harp
back in the playsong function after calling the decoder function use player action play sound put in the variables Instr and Pitch shift right click to play for all players
parse the Delay use wait block put in the Delay then call the function again before that if the playindex is more or equal to codeLength set the play index to 1 this will loop the song
if u have song that has multiple segments insert it into an array if that segment has end +1 to the index get the element u already know how this works
u can also use the array to store multiple songs
for playing multiple notes at once create multiple music codes for each channel spawn a mob for each channel give them different names select those mobs i forgot which placeholder to use assign the music code to those mobs then use those mobs to call the functions
using this method u can easily edit songs just by editing the music code sequence thing
now code something that can automatically convert the note blocks studio into the music code idk if it is possible
first u will need to make the music code consisting of number and letter for the purpose of this guide i will use this format (Instrument + Pitch + Delay) if u are only using 1 instrument u dont need the instrument data and same for delay if u want to put a fixed delay between the notes
here is the mapping for the music code the mapping can be changed how u like
Instrument:
Piano = 0
Double Bass = 1
Snare Drum = 2
Click = 3
Bass drum = 4
Guitar = 5
Flute =6
Bell = 7
Chime = 8
Xylophone = 9
Pitch
null = 0
F# - D = 1 - 9
D# - F#3 = a - p
look here all the pitches https://minecraft.fandom.com/wiki/Note_Block#:~:text=greater pitch coverage.-,The,-exact pitch to
delay = number in ticks e.g. 5 ticks = 05 10 ticks = 10
arrange a song in noteblock studio or find a song thats already made
convert the song into the code sequence
for example Fur Elise will be converted into: 0n05 0m05 0n05 0m05 0n05 0i05 0l05 0j05 0g05
remove the spaces its waste of space so it will look like this 0n050m050n050m050n050i050l050j050g05
put the music code into a text variable. a text variable can support up to 255 characters since every note is made up of 4 characters you can put up to 63 notes in 1 text variable if your song is longer than this you have to segment it into multiple text variables and play them in order
create a function call it playsong or something this should only execute once when the game is awake make a variable playindex set it = 1
select a random player get the length of the music code into codeLength use truncate text to seperate the instrument, pitch and delay then call another function called decoder in this function use if variables and set variable the instrument and pitch to play e.g if variable checkInstr = 0 set Instr = note.block.harp
back in the playsong function after calling the decoder function use player action play sound put in the variables Instr and Pitch shift right click to play for all players
parse the Delay use wait block put in the Delay then call the function again before that if the playindex is more or equal to codeLength set the play index to 1 this will loop the song
if u have song that has multiple segments insert it into an array if that segment has end +1 to the index get the element u already know how this works
u can also use the array to store multiple songs
for playing multiple notes at once create multiple music codes for each channel spawn a mob for each channel give them different names select those mobs i forgot which placeholder to use assign the music code to those mobs then use those mobs to call the functions
using this method u can easily edit songs just by editing the music code sequence thing
now code something that can automatically convert the note blocks studio into the music code idk if it is possible