banner



How To Create A Music Quiz

So, we were preparing a lengthy, and – compared to this post – a bit boring, but still quite helpful overview of Siri's Shortcuts and the Home app (it's already here: iOS 14 – A Siri, HomeKit, Home App and Shortcuts Overview). And while we were playing around with the Shortcuts app, trying to find an easy, but still enticing example for you to dive into the world of shortcuts, we created a music quiz.

It's not just any music quiz, it's a very personal music quiz, as it's powered by your personal music library and listening history. Creating and 'testing' (ok, actually 'playing') the quiz was so much fun, that we postponed the theory and decided to share the practice.

In this post you will create your very own, very personal Siri Music Quiz.

iOS14 Update: Apple loved our idea so much, that they pre-installed a simpler multiple choice music quiz as starter shortcut in the Shortcuts app. Yes, with iOS 14 you already have Apple's Music Quiz version on your iPhone. So, if you're not into creating your own music quiz, here's how to enable Apple's Music Quiz Shortcut.

Estimated reading time: 14 minutes

Table of contents

  • Apple's Music Quiz Shortcut
  • What do we need for this Game?
    • Hardware, Software and Services
    • DIY Mindset
  • A tiny bit of Orientation
  • How to create your Music Quiz Shortcut? A Game with 4 Levels
  • Level 1: Creating the "Guess the Artist" Shortcut
    • Let's find some Shortcuts Inspiration
    • How to write some Pseudo Code
    • Let's review the not so Pseudo Code
    • Hey Siri, create this Shortcut!
  • Level 2: Upgrading the "Guess the Artist" Shortcut
    • Some Pseudo Code Changes
    • Let's review the not so Pseudo Code
    • Let's code this Shortcut
  • Level 3: Adapting our shortcut to "Name that Tune"
    • Some Pseudo Code Changes
    • Let's code this Shortcut
  • Level 4
  • Conclusion

Please note, this post works best for absolute Shortcuts beginners. If you've already created some cool Shortcuts, you might find some interesting ideas, but most of this post boring. If you are a Shortcuts expert – which we are definitely not – we appreciate your code review and feeback to improve this post! =)

Apple's Music Quiz Shortcut

We are honored that Apple picked up our idea and created their own music quiz shortcut in iOS 14. However, they completely missed the point of this post, which is to inspire you to create your own shortcuts. Anyway, here's to the lazy ones:

  • "Hey Siri, Music Quiz"

Siri will run the pre-installed "Music Quiz" Shortcut, which you can find in your Shortcuts app under My Shortcuts in the Starter Shortcuts Folder.

When you run the Shortcut for the first time, you'll need to allow it to access the Apple Music library.

Siri will play a song snippet and offer you a multiple choice list with five songs. You can tap on one or just say, e.g. "pick 3". Siri will tell you whether you're right and your score. The game has 5 rounds, you can stop it by saying "stop".

What do we need for this Game?

Hardware, Software and Services

Chances are that you have one of the over 2.2 billion iPhones out there, and – like already over 35% of the iPhone users – you've updated to iOS 14. Now, if you're also one of the over 68 million Apple Music subscribers, you are all set. If you have a filled iTunes music library, this should work just as fine.

The longer you've used Apple's music app, the more fun you'll have with this music quiz. It works great on your iPhone, iPad, AirPods, and with AirPlay on your AppleTV and HomePod. The AppleTV and Apple Watch will reveal what's playing, in case you prefer to cheat.

DIY Mindset

As Apple's Shortcut app comes preinstalled since iOS 13, there's no need to download anything. Also, we are not sharing our shortcuts through an iCloud download link. Especially for those, who are new to shortcuts, we would not recommend changing the security settings to download some 'untrusted' Shortcuts. There are too many not Apple reviewed shortcuts out there in the wild. You can do this later, when you're more experienced and able to review what you are installing.

Yes, you will create your music quiz yourself. =)

Patience and curiosity will be helpful ingredients for these shortcuts. It might sound far fetched, but we'll actually look into some basic programming concepts and once you have created your shortcuts, you can proudly announce that you have 'programmed' your own music quiz, a personal voice-first conversational music game experience (with interactive smart home lighting). Sounds cool, but as you'll see, it's also a lot of fun!

A tiny bit of Orientation

If you are completely new to Siri Shortcuts (or HomeKit), watch Siri's 1 minute explainer cartoon from our post Siri's HomeKit Scenes and Shortcuts: Immersive Storytelling:

On the Shortcuts and Home app Map, we'll visit this area!

We'll create some Shortcuts by using Media actions. Actions are the building blocks of shortcuts. We'll also use some Scripting actions to control the flow of our shortcuts and some variables where we will store how many song snippets to listen to and how many right guesses. We'll use plenty of magic variables, which have this cool name, because they're automatically created to connect our actions.

If you have some HomeKit smart lights at home, we'll also add those through HomeKit Scenes for an immersive gaming experience.

Enough theory.

How to create your Music Quiz Shortcut? A Game with 4 Levels

The demo clip we've uploaded to Instagram, might appear a bit boring from entertainment perspective, since Alexa and Google are guessing classical composers. If you are not into classical music, no worries, the shortcuts we are going to create will tap into your personal music library. We will not guess composers, but artists and later on song titles.

If we consider this post itself as a game, actually the game to build a game, there are 4 levels you can reach:

  1. Beginner: We will start with a super easy "Guess the Artist" shortcut.
  2. Intermediate: On level 2 we will extend our shortcut to light up our game with HomeKit scenes. We'll make the 'artist recognition' a bit more robust, and Siri a bit more friendly and conversational.
  3. Advanced: We will tackle song title recognition by adapting our shortcut to "Name that Tune". Siri will additionally give us some interesting personal music information.
  4. Let's keep this secret for now, we cannot spoil the whole game =)

Level 1: Creating the "Guess the Artist" Shortcut

Let's find some Shortcuts Inspiration

It started – like most of our Shortcuts journeys – with some inspiration from the Shortcuts Gallery, which contains Apple curated Shortcuts. When you tap the "Gallery" button in the Shortcuts app (bottom right) and scroll through the slider on the top, you'll find "Shortcuts for Apple Music".

One of those Music Shortcuts is titled "Auto Playlist" and has only 2 actions. The first action is to Find some Music by selecting random songs you've listened to in the last three weeks. The second action is to simply Play the music.

Now, this is a great starting point for our music quiz!

31% savings

Apple AirPods (2nd Generation)

List Price: $159.00

$109.00

(2021-11-24, 10:00 pm - PST - Details)

You save $50.00 (31%)

View on Amazon

How to write some Pseudo Code

Before we just start to play around with some actions, trial and error style, it's best practice and tradition between us developers to write some pseudo code. Pseudo code is nothing more than a informal description of how this game should look like. Just plain text, on a napkin, no code.

No worries, we've done that for you:

"Guess the Artist" Siri Shortcut – Pseudo Code – Level 1 – Blocks to the left, and not so Pseudo Code to the right

Let's examine the symbols in the middle and the blocks on the left:

  • The arrow pointing down: our shortcut will start with simple actions, which will run one after the other, easy. Siri will welcome us to the our music quiz, and will find some random songs to guess (remember Apple's "Auto Playlist" Shortcut, we'll just borrow the actions from there =).
  • The circled arrow depicts a bigger block of actions, which will repeat for every song to guess. Yup, we developers are lazy. Rather than duplicating actions for every song, which would make it super difficult to change something later on, we just create some code which repeats for every song, nifty. Siri will play the song for some seconds and then ask us "Who's the artist?"
  • The question mark: Here's where we will check the response. Is it the right artist? If the answer is right, Siri will confirm, and she'll remember how often we guessed the artist correctly in a variable. Otherwise she'll tell us that we are wrong.
  • The final arrow pointing down: is after our music quiz. All the songs have been guessed right or wrong and it's time for Siri to give us a summary.

Let's review the not so Pseudo Code

To make it easy for you to create this shortcut, we've added this pseudo code and highlighted the terms, you'll need to enter into the Actions search field in red. Creating your shortcut will be as easy as searching for the red phrases and pulling the actions from the results into your shortcut.

Hey Siri, create this Shortcut!

Hey Siri, can you please show us how to? Sure, here we go …

Please note, in case you're wondering how to name your Shortcut: I doesn't matter if you start with "open …" or "start …". Siri is smart enough to recognize both, no matter how you name it. Also, you should avoid naming it "Music Quiz" since Apple has now created their own version.

"Guess the Artist" Shortcut – Level 1

When you're happy with your level 1 Music Quiz, please duplicate your Shortcut (tap "Edit", top left of the "My Shortcuts" screen). We will take it now to the next level.

13% savings

New Apple AirPods (3rd Generation)

List Price: $179.00

$154.99

(2021-11-24, 10:00 pm - PST - Details)

You save $24.01 (13%)

View on Amazon

Level 2: Upgrading the "Guess the Artist" Shortcut

Let's upgrade our Shortcut with a more interactive and emotional Siri. In case you have some favorite artists, which Siri has trouble with recognizing, we'll try to make the artist recognition a bit more robust.

To light up our music quiz, you'll need to prepare 4-5 HomeKit Scenes:

  • Start Game: Change the brightness or color of your lights to something which indicates that the game has started.
  • Listen to Song: This is when the song snippets are played. Dim the lights down and/or use some other color. Or, in case you have some lights which can react to music, like the Nanoleaf Light panels with Rhythm module, create a Nanoleaf Rhythm scene.
  • Right Answer: Increase the brightness and/or turn the lights green.
  • Wrong Answer: Dim the brightness and/or turn them red.
  • End Game: This is when the quiz summary comes, you could also use the 'Start Game' scene.

Some Pseudo Code Changes

Don't worry, we'll only deal with the green updates here, as we've already implemented the blue parts in level 1.

Let's upgrade our Music Quiz Shortcut, with a more interactive and emotional Siri and some HomeKit scenes

First, the green symbols in the middle and the blocks on the left side:

  • Another question mark: To make sure that Siri doesn't ask "One more song?" after the last one, we need to check if it's not the last song.
  • The second new question mark: indicates a (currently quite small) menu, where we can decide after each song, if we would like to continue, Yes or No. If not, Siri will come back with a disappointed, brief response (e.g. "Oh – ok …") and exit the shortcut.
  • Make sure to make the final result a happy one (e.g. "Ta-da! …")

Let's review the not so Pseudo Code

The green stars indicate which actions we need to add to our shortcut, mostly it's the "Control Home" action to set our HomeKit scenes. After Siri asks for the artist, we will now change both, our response and the artist from the library, to lowercase. This will make the artist recognition a bit more robust, because the Shortcuts "if" is case sensitive. The green napkin indicates the block we are adding.

Please note, there are some artist names which Siri will not recognize. Playing this game many times, the recognition seems to improve. However, if you want to speed this up, you can add the artist name to your contacts (just copy the name in the first or last name field). This will also help you with your music commands and who knows, maybe you'll get your favorite artists contact details one day.
Also, please be careful to pick the right "Updated Text" variables, they have the same name, so you could end up always guessing right.

Let's code this Shortcut

"Guess the Artist" Shortcut – Level 2

Once you're happy with your level 2 Music Quiz, please duplicate your Shortcut. We will take it now to the 3rd level.

New Apple AirTag, Bluetooth Item Finder and Key Finder

(3672 customer reviews)

£29.00

(2021-11-25, 2:00 am GMT - Details)

View on Amazon

Level 3: Adapting our shortcut to "Name that Tune"

Wow, happy you're still following along and have managed to create a wonderful "Guess the Artist" quiz. On this level we will adapt our Shortcut to guess the song title.

Let's upgrade our Music Quiz Shortcut, to "Name that tune" and give us some music information.

Some Pseudo Code Changes

On the left, there is only one additional green block, the song information. We've added it after the right/wrong notification. You can of course move it to the otherwise/wrong path above, in case you prefer to get song info only if you couldn't guess the title correctly.

The song information will contain Artist, Album, Album track number, how often you've listened to this song and the last played date.

The not so pseudo code side, shows us the parts we need to adapt for song title recognition. To make it more robust, we remove any punctuation marks in the original title and check then, whether it contains your response.

Please note, the "Replace Text" is switched to a regular expression. We're replacing "[!,',#,$,%,&,',(,),*,+,-,.,/,:,;,?,@,,^,_,`,{,|,},~,,,]" with nothing.

Let's code this Shortcut

"Guess the Artist" Shortcut – Level 3

Level 4

Oh! Seems some Shortcuts experts are visiting us. ☺️

Welcome to our humble abode! As we're obviously not Shortcuts experts, we're wondering what we could offer you?

Maybe some ideas to upgrade this shortcut?

  • Ask for what to guess: Artist, Title, Release Year, Play Count, Lyrics, …
  • Check out the "Dictionary" concept in Shortcuts. It can help you to randomize Siri's responses.
  • Implement a difficulty menu. Play around with the music filter in "play music". The play count of a song might be a good start.
  • Create a "music decade quiz" by changing the "play music" filter to 10 years.
  • Extend the "One more?" menu to give you more gaming options.
  • Ask to create a playlist after the quiz.
  • If you are familiar with the concept of recursions: yes, you can call your shortcut within your shortcut.
  • A wonderful coincidence: Macstories has released the MusicBot – an all-in-one Apple Music Assistant – shortcut with over 800 actions. We're still digesting this powerful tool for some music quiz inspiration.

We hope you are not too disappointed, if you couldn't find anything new in this chapter, please take the time to leave your valuable feedback in the comment section below! We will happily update this post with any information which makes it easier to get into Shortcuts.

31% savings

Apple AirPods (2nd Generation)

List Price: $159.00

$109.00

(2021-11-24, 10:00 pm - PST - Details)

You save $50.00 (31%)

View on Amazon

Conclusion

Wow, what a game! We hope you've enjoyed this music quiz post and are having fun with Shortcuts!

It's easy to overlook the powerful features of the preinstalled Apple Shortcuts app in your pocket. This post covered only a tiny fraction of what everyone can create with the Shortcuts app. For a full list of Apple Shortcuts please see our post iOS 14 – A Siri, HomeKit, Home App and Shortcuts Overview.

Compared to Google and Alexa, with their rudimentary routines, Apple has opened up many more options to personalize Siri. Unless, of course, you are an Alexa Skill or Google Action developer, then we'd need to compare to SiriKit. But that's a different story.

Happy Music Quiz!

P.S. You can find more Siri posts here: Apple Siri
Here's Apple's Shortcuts User Guide, and
Don't miss our: Hey Siri, Play Some Music: All the Music Commands (and more …)

Share This Post:

How To Create A Music Quiz

Source: https://www.smartenlight.com/siri-shortcuts-music-quiz/

Posted by: cliftonhowles1979.blogspot.com

0 Response to "How To Create A Music Quiz"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel