I need to apply some pauses between a Music app playlist. I have a VERY clunky method right now - I literally drag in an audio file of silence that is set to the right amount, but that's a total pain.
Is there any way that I can automate this with KM and Music app? I did wonder if I could have something watch a timer, or something and when it sees 0:00 to press pause button, wait, then unpause. That also seems less than ideal.
Any thoughts on how I might achieve this in any elegant way would be appreciated!
I won't pretend it's elegant, but you could try this in an "Execute AppleScript" action. The playlist you want to use should be open in the main Music window when you run it. It'll grab the playlist's track list then play them one by one, with a 60 second delay between each.
I'm least happy about the "delay while a tack is playing" loop, but couldn't think of another way of pausing the script until the current track finished
tell application "Music"
set trackList to every track of (view of browser window 1)
repeat with eachItem in trackList
play eachItem with once
repeat while player state is playing
delay 1
end repeat
delay 60
end repeat
end tell
With the playlist I want selected and visible in the main window (not a new window), when I run the shell script, the playlist begins playing but when the first track ends:
There is no pause between tracks and (weirdly)
It jumps several tracks down in the playlist, not to the next track. (Went from track 1 to Track 5)
Music has been... patchy... in the implementation of its own AppleScript dictionary. What OS and Music versions are you using?
As to jumping -- I don't know if the listing will honour your playlist sort order, be based on original import time, playlist addition time, or something else. Again, let us know what version you are on and I'm sure someone will be able to test.
I'll try to work out if there is a pattern. I would need it to honour the playlist order as it is shown, otherwise it won't be something that I can use. I wonder if there is a way I could force the play order.
Anyway, thanks for any ideas you might have on this.
Not sure what's going on -- my test machine is running the same versions as you and the script works fine, even honouring track order within the playlist. One obvious difference is that I don't have KM installed -- I can't see why it would make a difference, but try running the AppleScript in Script Editor instead and see what happens.
I did give this a go again recently, and it did appear to run more smoothly when I ran from Script Editor. Peculiar, really. I will do some more testing to see if I can work out a pattern on where it does not quite work.