How do you run a command after some playsound music?

I'm making a map, and, to put it simply, I need to run a command when some music finishes (played via a playsound command), and my only solution at the moment is a huge room full of repeaters making a delay as long as the music, with the command block at the end, which would work, but, for obvious reasons, I don't really want to do that. Can anyone help? If you have any more questions, ask in the comments, and I'll try and get back to you. Thanks in advance!


Solution 1:

You can create an structure like that: enter image description here

And when music start to sound execute /time set command substracting 20 to 22340 by each seconds you want to delay the command.

For example:

  • If music duration is 10 seconds you must delay the command by 10 seconds so:

    22340-(10*20) = 22140

    So you must execute /time set 22140 when music starts sound

  • If music duration is 17 seconds you must delay the command by 17 seconds so:

    22340-(17*20) = 22000

    So you must execute /time set 22000 when music starts to sound

I hope I've explained that clearly