One of the great little secrets of Shortcuts for iOS (and soon, Mac!) is that you can get your iOS device - or even your Apple Watch - to play a short sound. This may sound like something really basic, but having to rely on fetching a file from the Files app or calling out to a music service can be something that can take a few seconds or even fail altogether sometimes.

That can be solved using something called ‘Base64 encode’. Without going into too much technical detail (you can read more about Base64 here should you wish), what you do is convert the sound to a string of letters that, when decoded again, will create the sound file you encoded.

The advantage here is that you don’t need a physical file to play the sound, and you can paste the long text string actually INTO the shortcut. This removes any friction and allows Shortcuts to play the sound immediately.

but why?

So why am I telling you all this? Well, it’s because I created a fun shortcut to celebrate the new Apple Event tomorrow, 14th September.

This simple shortcut will play a sound effect of Tim Cook saying ‘Good Morning!’ in his inimitable style.

You can download it here. Best of all, you can run this on your Apple Watch and even get the sound on there!

Read on for more info on how I built this and how you can use it as part of automation!

automatic Tim

To create the base64 text string, I screen-recorded a video of Tim. I then trimmed the video down to the phrase, removed the video track and saved it to my Files app. I then used this shortcut to create the text string.

It contains the ‘File’ action, which I then used to select the sound file in the Files app. Then the ‘Base64 Encode’ action takes that file and converts it. Then the ‘Text’ action is added. Tapping in that brings up the keyboard and suggested variables. I tapped on ‘Base64 Encoded’, which adds that to the text field, effectively adding the Base64 text that was just created. Then I use the ‘Save File’ action to save the text file to my Files app (I check ‘Ask Where To Save’ to choose where exactly).

Then the next step is creating the sound shortcut. What I’ve done here is have the shortcut bump up the volume on the iOS device (including the Apple Watch!) to 100%, then put it down to the previous level after playing the sound.

I did this by using the action ‘Get Device Details’ and selecting ‘Current Volume’. Then I added in the ‘Set Volume’ action and set it to 100%. Then I added the text field and pasted the text string from my saved text document from the previous shortcut followed by the ‘Base64 Encode’ action, filling that out with ‘Encode’, ‘Select Magic Variable’ choosing the Text variable above. Finally, I add in the ‘Play Sound’ action before adding the ‘Set Volume’ action, long pressing on the volume number and choosing the Magic Variable of the initial volume created right at the top of the shortcut.

And that’s it! You can download the above shortcut here.

going further

So you want to have Tim wishing you a ‘Good Morning!’ automatically when you wake? Sure, who am I to judge!

Firstly go to the automations tab in Shortcuts and hit the small + sign at the top right. Choose how you want the sound to be triggered. You can have it go off when you ‘Wake Up’ (if you use the Sleep Mode feature on iOS) or specify it for any alarm or a specific one.

I went one step further and set up a reminder alert for the Apple Event (sorry Tim, I don’t want you waking me up!) 5 minutes before it starts. This is where it gets a bit complex as Shortcuts doesn’t allow you to have calendar events or specific dates & times trigger shortcuts. The below shortcut shows how using the ‘If’ action can check your calendar for the day, see if you have an event called ‘Apple Event’ in there. If it does, it moves on to the next art, which is playing your sound shortcut. If it doesn’t, then nothing happens. The automation runs every Tuesday at 5:55 pm UK time (5 minutes before a typical Apple Event), so theoretically, I could leave this on all year. Provided Apple sticks to the exact timings it has for a while now; this will work for any Apple Event. Due to Apple’s insistence on automation notifications, however, it will create an alert in my notification centre every Tuesday at that time.

This is probably going so far, but it is the only way I can see a way to do this.

and have a great day!

So there you have it, Tim and Craig, in a shortcut whenever you like! It’s all very silly, but it does show the power of shortcuts. If you had always wanted to be woken up by a particular sound or even create a soundboard on your Home Screen with a Shortcuts widget, now you can as these steps will work any sound file!

Have you found any fun ways of using Base64? Do you have a better way of creating the above automation? Let me know on Twitter!