This tutorial will have you creating seamlessly looping zone music systems in a flash! Recommended for expert redstoners. (If you wish to read a step-by-step walkthrough of this process, see here.)
Add an objective for each song you want to loop.
/scoreboard objectives add song1 dummy
Set up three command blocks as follows. Ensure they are all ‘Always active’.
Fill the first command block with this command:
/scoreboard players set @a[x=0,y=100,z=0,r=20,score_song1=0] song1 640
Replace the x y z and r values for your area coordinates. Replace 640 with the length of your song in seconds multiplied by 20. In the last chain command block, enter the following command:
/scoreboard players remove @a[score_song1_min=1] song1 1
Finally, in the centre command block, put the following command.
/playsound mysong master @a[score_song1_min=640] 0 100 0 2
Replace 0 100 0 2 with your x y z and volume arguments. Replace mysong with your sounds.json entry for your song.
And you’re done! If this tutorial was a little confusing and advanced, feel free to check out the beginner friendly step-by-step guide.
Happy map making!