I'm building a world in Minecraft.
There I want a certain sound / music to be repeated over and over again.
So far I've done it with "/ playsound (sound) block @a (block coordinates) (volume)". However, when the sound / music ended, nothing was played anymore. And if another player comes in who wasn't in the area when the sound started, they won't hear it.
To solve the problem I could do it with a plugin too.
To be honest, I don't see any way at the moment to implement the whole thing the way you would like it to be.
On the thing about repeating sounds:
Minecraft unfortunately does not provide a way to have sounds looped automatically. Not even to recognize the end of sounds. Especially not for the server side, because the whole story with the sounds takes place on the client. Players could, for example, use a resource pack that changes sounds. So the changed sounds might have a different length.
But if you simply assume that this is not the case, you could use a red tone switch or a plug-in to ensure that the sound is restarted after a certain time has elapsed. This is not the nicest or cleanest solution, but it is basically possible.
On the other thing about "synchronizing" sounds:
Unfortunately, it is also not really possible for players who "join in later" to hear the same sounds in the same place.
If you try to play a sound but the player is too far away to hear it, it will fail. The player's client either doesn't notice the sound at all or simply ignores the sound.
If players only enter the server after the Playsound command came, they will of course not hear anything of the sound.
It would be useful if you could give something like an offset parameter for playSound to indicate where the sound should start. This means that several players could hear exactly the same thing, which would be particularly useful for music.
But that doesn't exist either, neither in the vanilla command nor for plugins in, for example, the Spigot API.
Of course you can play a sound for the player as soon as it is in the correct range, but the sound is then started at different times for different players.
I've kind of written quite a bit now. To summarize again briefly: Repeating sounds would be a bit unattractive by restarting the sounds after a set time (which in the best case corresponds to the length of the sound). For the other problem I don't see a good solution, neither in the vanilla game nor with the help of plugins.
Thank you!