Published in 2022 by The Rosen Publishing Group, Inc.
29 East 21st Street, New York, NY 10010
Copyright 2022 by The Rosen Publishing Group, Inc.
First Edition
All rights reserved. No part of this book may be reproduced in any form without permission in writing from the publisher, except by a reviewer.
Library of Congress Cataloging-in-Publication Data
Names: Small, Cathleen, author.
Title: Coding activities for developing music with Sonic Pi / Cathleen Small.
Description: First edition. | New York: Rosen Publishing, 2022. |
Series: Code creator | Audience: Grade 712 | Includes bibliographical references and index.
Identifiers: LCCN 2019008456| ISBN 9781725341050 (library bound) | ISBN 9781725341043 (pbk.)
Subjects: LCSH: Sonic Pi (Computer file)Juvenile literature. | Software synthesizersJuvenile literature. | Ruby (Computer program language) Juvenile literature. | Object-oriented programming (Computer science) Juvenile literature.
Classification: LCC ML74.4.S6 S63 2022 | DDC 781.3/4dc23
LC record available at https://lccn.loc.gov/2019008456
Manufactured in the United States of America
Some of the images in this book illustrate individuals who are models. The depictions do not imply actual situations or events.
CPSIA Compliance Information: Batch #CSRYA22. For further information contact Rosen Publishing, New York, New York at 1-800-237-9932.
Contents
Introduction
Developing music has been part of human culture for thousands of years. Music has been discovered all over the world, in every culture, pretty much as far back as society extends. There is even evidence of prehistoric music, which originated before its creators were even literate.
Nowadays, people can use modern technology including computers, to mix and make music, but music itself has been around for as long as humankind.
As centuries and millennia have passed, music development has evolved. More instruments have been invented, knowledge of music theory has expanded, synthesizers have enabled musicians to create sounds electronically, and now technology has enabled composers to create music using nothing more than their computer. That is not to say that music is no longer composed the old-fashioned way, with musicians sitting around playing instruments and composing on the fly. It simply no longer has to be done that way. Amateur and professional composers can use software and applications to create music on their desktop computer, laptop, tablet, or even smartphone.
In the era of advanced music technology, a lot of work is done with software. For example, Pro Tools is a well-known digital audio software suite that can be used for recording and sound production. Sibelius is another example of a music composition software package. Logic Pro is a Mac-based professional recording studio that exists right on ones own computer. There are many, many other music production software packages and applications available today, some of which are available as web-based applications that can be accessed from any computer or similar device.
Music mixing and music creation software is available for every computing platform. To get really into the finer details of creating sound, aspiring musicians can code to create songs.
What about those interested in coding to develop music? What about people who want to couple their interest in computer science with their love of making music? While there are not as many applications that support this endeavor, they do exist. One interesting application like this is Sonic Pi, which was built in collaboration with teachers for use in the classroom and for those new to coding for music development.
Sonic Pi is free to use. The idea behind the software is that it uses music development to teach basic computing concepts. Not only does this allow users to combine musical creativity with some simple instruction on coding, but it also introduces aspiring coders to an easy-to-use language that will provide a solid foundation of knowledge if they go on to learn more complex coding languages.
Sonic Pi touts itself as being powerful enough for professional musicians, but simple enough for new coders to learn. The programming language used is Ruby, but Sonic Pi is the integrated development environment (IDE) that uses Ruby syntax to produce music. Ruby is an object-oriented programming language that was first developed in the 1990s.
Ruby is a popular programming language that was developed in the 1990s. Sonic Pi is an integrated development environment that uses Ruby syntax to produce music.
Ruby is a highly popular programming language, and it often makes lists of top ten most popular coding languages. Learning Ruby in the context of developing music with Sonic Pi allows users to learn the fundamentals of a programming language that is widely used in the greater technology field.
The beauty of combining music and coding is that the feedback is both immediate and enjoyable. It does not take long to code a simple melody, repeating rhythm, or bass line, and users can quickly check their work by making sure the tune plays as intended. More than that: it is just plain fun to create music.
Downloading and setting up Sonic Pi is pretty simple. On the home page at https://sonic-pi.net, there are download links for Windows, Mac, and Raspberry Pi versions of the application. Simply click on the button for the appropriate version, and the site will begin the process of downloading and installation.
After downloading Sonic Pi and installing it in the correct directory, launch the application. At the top of the interface, there is a coding window with Run, Stop, Record, Save, and Load buttons at the top left. On the top right, there are six other useful option buttons, including the all-important Help button.
The Help button will toggle on and off the Help pane at the bottom of the screen. This pane is full of examples, synths, effects (commonly referred to as FX), and samples. There is also a useful tutorial for new users. The tutorial is basically like a user guide; click on any topic to reveal an explanation in the bottom-right pane.
If you get stuck at any point, visit the robust Sonic Pi community, where it is possible to find useful information and support from countless Sonic Pi users.
Activity 1
Creating a Live Loop
Sonic Pi is built around the idea of live loops. In most songs, especially in popular genres, there is a melody that is more or less repeatedor looped numerous times throughout the course of the song. The same general beat exists throughout the song, although sometimes there are segments of a song that break up the established beat a bit. As a general rule, however, songs consist of looping melodies.
In Sonic Pi, the syntax (or language structure) for a live loop contains the name of the loop, the keywords do and end to mark where the live loop starts and where it ends, and then some syntax for the body of the loop, which basically explains what the loop will be repeating. Coded together, those four components look like this:
Next page