5

Believe it or not, there are still players that listen to music discs in Minecraft, including me.

I tried making a command loop that would play different discs for me every 5 minutes. Here's what command I use:

/execute at Quijibo run playsound minecraft:music_disc.stal record Quijibo

This successfully executes the command, and the music starts playing, but if I move away from the point where I was standing, the music fades away, as if there was a jukebox playing the music that I'm moving away from.

What I want to do is have the music follow me when moving. Is this possible to do through commands?

2
  • Unlikely, at least without restarting the track every time.
    – dly
    Jun 5, 2019 at 9:38
  • Yeah, but even if I would be playing the track using continuous commands, I don't know how I would keep the music going without pausing.
    – Quijibo
    Jun 5, 2019 at 12:52

1 Answer 1

3

In theory the minimumVolume parameter should fulfil exactly this purpose, but I couldn't get it to work. Maybe that's a bug.

But the volume parameter of /playsound can in a way actually be used to specify a spatial volume instead of an audio volume! The trick, as described in the wiki (archive):

For values greater than 1.0, the sound will not actually grow louder, but its audible range (a 16-block radius at 1.0) will be multiplied by volume. There will always be a gradual falloff to silence based on distance from the center of the sphere.

That means that you can just enter the maximum value of a Float, except that it's for some reason slightly different in Minecraft. By just trying out values I found that the maximum value is:

340282356779733661637539395458142568447.99999…

So you can use this command to play a sound everywhere:

/playsound <sound> <channel> <selector> <x> <y> <z> 340282356779733661637539395458142568447.9999999999

That way it only gets 0.000000000000000000000000000024936% quieter when you go to the other end of the world.

This even works across dimensions for some reason. But when you go through a portal, the sound stops.

7
  • But to be clear there is no way to make a playsound follow a player without expanding the distance it can be heard?
    – Nik3141
    Jun 5, 2019 at 14:44
  • 1
    Dammit! Now every time I walk away 12,033,694,344,163,658,243,080,625,752,106,000,000 blocks away from the source, I won't be able to hear the music. I hate it when that happens!
    – Quijibo
    Jun 5, 2019 at 16:28
  • @Nik3141 No, /playsound always has a point of origin of the sound, just like almost all sounds in Minecraft. The exceptions (dragon death, wither summoning) actually also apply to /playsound, no matter the origin and radius. I didn't test what happens with the background music. But since /playsound lets you select who hears a sound, that doesn't matter anyway, you can just select players who are in a radius initially, if you want that. Jun 5, 2019 at 16:55
  • @Fabian I was hoping I could play the sound at the location of an entity or something moving rather than fixed coords. Essentially, I didn't want to restrict who could hear it in any way other than their distance from a particular entity (player).
    – Nik3141
    Jun 5, 2019 at 18:36
  • @Nik3141 Then just use the coordinates of that entity, @a and the radius you want. Jun 5, 2019 at 21:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .