Challenge: Create a musical instrument in Swift Playgrounds – Discover

The first part to compose a musical masterpiece? Make your own instrument from scratch! In this challenge, you will use graphic tools to create a musical instrument in Swift Playgrounds and provide a performance that will leave your audience (and waiting for an encore)!

Start the challenge

The Swift Playgrounds app contains several Playgrounds books based on to help you explore different coding concepts and ideas. For this challenge, we ask you to use the Sonic Create book in the Swift Playgrounds app to build a musical instrument of your own creation. Now, this musical instrument does not have to look or sound like a regular instrument — it could be a bunch of crystal pianos laid out like piano keys or a beat-maker table playing notes on a constant loop. Sonic Create comes with a whole set of sounds and instruments as well as great graphics to build the look and feel of your instrument.

Before you make your own creation, you can use the Sonic Workshop book to learn how to use graphics to play sounds and loops.

Before you make your own creation, you can use the Sonic Workshop book to learn how to use graphics to play sounds and loops.

If you want a little musical practice before venturing into the virtual instrument making world, we recommend first downloading the Sonic Workshop Challenge Book from Swift Playgrounds, where you can explore the use of graphics to play sounds and loops. Once you know some of the APIs, you can start creating graphical instances to respond to touch or drag events. You can also check out some of the musical examples found in the book Sensor Create (iPad only), including “Using Light to Play Audio,” “Synesthesia,” and “Beat Maker.”

Ready to build your own instrument? Think about how you might want to make music with only these objects to guide you, and what kind of sounds you want to create. Consider how the code you write affects the objects – their location, their resonance and the kind of music you can make. How can you design your instrument to be intuitive and also invite people to explore and play? As a developer, the tools you create for yourself or others can completely change how other people use these tools and experience the world. (Pretty cool when you think about it!)

Once you’ve created something you like, you can share it with the community on developer forums.

Visit the Apple Developer Forums

Resources

Download Swift Playgrounds for macOS

Download Swift Playgrounds for iOS

Learn more about Swift Playgrounds

Read the terms and conditions of WWDC21 Challenges

Leave a Comment