Essentials_Sonic_Pi-v1.pdf

(2897 KB) Pobierz
ESSENTIALS
MUSIC
WITH
LIVE CODE
& CREATE AMAZING SOUNDS
ON
YOUR
Written by
CODE
Raspberry Pi
Sam Aaron
CODE MUSIC
WITH SONIC PI
or whacking things with sticks, you write
code… live. We call it live coding.
Sonic Pi comes pre-installed on your Raspberry
Pi, but is also available to download for Mac and PC
for free at
sonic-pi.net.
I have written this book to complement
Sonic Pi’s built-in tutorial and to help you
jump-start your live-coding career. It’s packed full
of fun, instantly rewarding examples to highlight
many of the new things Sonic Pi will enable you to
do. By the time you’ve finished it you’ll be able to
code up some phat bass, sparkling synth leads and
start practicing for your first live-coding gig.
Remember, with live coding there are no
mistakes - only opportunities!
WELCOME TO
S
onic Pi is a powerful new kind of musical
instrument. Instead of strumming strings
Sam Aaron
Creator of Sonic Pi
FIND US ONLINE
raspberrypi.org/magpi
EDITORIAL
GET IN TOUCH
magpi@raspberrypi.org
DESIGN
Managing Editor:
Russell Barnes
russell@raspberrypi.org
Features Editor:
Rob Zwetsloot
Sub Editors:
Laura Clay, Phil King, Lorna Lynch
Critical Media:
criticalmedia.co.uk
Head of Design:
Dougal Matthews
Designers:
Lee Allen, Mike Kay
Illustrator:
Sam Alder
DISTRIBUTION
Seymour Distribution Ltd
2 East Poultry Ave,
London
EC1A 9PT |
+44 (0)207 429 4000
In print, this product is made using paper
sourced from sustainable forests and
the printer operates an environmental
[
management system which has been
Chapter One
]
assessed as conforming to ISO 14001.
SUBSCRIPTIONS
Select Publisher Services Ltd
PO Box 6337, Bournemouth
BH1 9EH |
+44 (0)1202 586 848
magpi.cc/Subs1
This book is published by Raspberry Pi (Trading) Ltd., Mount Pleasant House, Cambridge, CB3
0RN. The publisher, editor and contributors accept no responsibility in respect of any omissions or
errors relating to goods, products or services referred to. Except where otherwise noted, content
in this product is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0
Unported (CC BY-NC-SA 3.0).
2
[ CODE MUSIC WITH SONIC PI ]
ESSENTIALS
CONTENTS
04
[
CHAPTER ONE
]
LIVE CODING
Master live loops
[
SAM
AARON
]
16
[
CHAPTER THREE
]
SYNTH RIFFS
Compose melodies
10
[
CHAPTER TWO
]
CODED BEATS
Build drum breaks
22
[
CHAPTER FOUR
]
ACID BASS
Use squelchy basslines
28
[
CHAPTER FIVE
]
MUSICAL MINECRAFT
Control Minecraft from Sonic Pi
34
[
CHAPTER SIX
]
BINARY BIZET
Code classic music
40
[
CHAPTER SEVEN
]
SURFING RANDOM
STREAMS
Make random riffs and loops
46
[
CHAPTER EIGHT
]
CONTROLLING YOUR SOUND
Alter sounds as they’re playing
52
[
CHAPTER NINE
]
BECOME A MINECRAFT VJ
Create an audiovisual feast
58
[
CHAPTER TEN
]
QUICK REFERENCE
Lots of useful information
Sam Aaron is a live
coder exploring
the intersection
between
code, art, and
education. He sees
programming as
performance, and
builds systems to
lower the barrier
for people to
have a creative
experience
with code.
By day, Sam
is a Research
Associate at
the University
of Cambridge
Computer
Laboratory; by
night, he makes
people dance by
live coding in clubs
and events all over
the world, using
Sonic Pi running on
a Raspberry Pi.
[
Don’t Panic
]
[
Contents
3
ESSENTIALS
ESSENTIALS
ONE
]
LIVE CODING
[
CHAPTER
Digital musician and Cambridge Computer Lab researcher
Sam Aaron
starts off his Sonic Pi tutorial series
by introducing the art of live coding
4
[
Chapter One
]
[ CODE MUSIC WITH SONIC PI ]
Below
The new Dark theme is lovely!
he laser beams sliced through the wafts of smoke as the
subwoofer pumped bass deep into the bodies of the crowd.
The atmosphere was rife with a heady mix of synths and
dancing. However, something wasn’t quite right in this nightclub.
Projected in bright colours above the DJ booth was futuristic text,
T
moving, dancing, flashing. This wasn’t fancy visuals; it was merely
a projection of Sonic Pi running on a Raspberry Pi. The occupant of
the DJ booth wasn’t spinning discs; she was writing, editing, and
evaluating code. Live. This is Live Coding.
This may sound like a far-fetched story from the future, but
coding music like this is a growing trend and is often described as
live coding (toplap.org). One of the recent directions this approach
to music-making has taken is the Algorave (algorave.com) - events
where artists like myself code music for people to dance to. However,
you don’t need to be in a nightclub to live-code; with Sonic Pi v2.9+,
you can do it anywhere you can take your Raspberry Pi and a pair of
headphones or some speakers. Once you reach the end of this article,
you’ll be programming your own beats and modifying them live.
Where you go afterwards will only be constrained by your imagination.
[
Live Coding
]
5
Zgłoś jeśli naruszono regulamin