Sonic Pi for Primary Schools
Download
Report
Transcript Sonic Pi for Primary Schools
Sonic Pi for Primary
Schools
Ben Davies & Sarah Zaman CAS Master
Teachers
Thursday 21st May2015
[email protected]
[email protected]
@b3ndavi3s @sezzyann72 @CompAtSch
Introduce Sonic Pi
Software
• Identify how it meets
the requirements of the
KS2 Computing
programme of study
• Develop teaching
approaches using the
software
• Demonstrate how Sonic
Pi will be used at the
Beats & Bytes event
•
Curriculum Requirements
Play
Controls
Editor
Controls
Code
Editor
Help System
Info & Help
Log
Viewer
O
Playing your First
Type play 75 into theNotes Add several play
code editor and press run
O
instructions to your
program and press run
O What do you think the
instruction means? How
could you change the
instruction?
O What do you hear? What if
we wanted to hear the
notes individually?
Syntax and Debugging
O
All programing languages
have their own set of predetermined language and
structure
O
Sonic Pi contains many of
the functions that children
have experienced in other
languages.
O
play75 pley 75 75 play
O
O
Some children find it
easier to debug with
Sonic Pi because they
can hear the mistake and
know where to look for the
bug (logical reasoning)
Using children’s existing
knowledge can be useful.
“How would we do that in
scratch/kodu/logo etc”
O
The error message line
also identifies where a
bug exists
Sequencing your Music
O As in other programing
software, delays can be
used to make the
computer wait before
executing the next
instruction
O Add the sleep instruction
to your code so every note
is played individually.
O Can you vary the length of
time between each note?
Notes to Code
62
67
71
74
71 71 71
71
71
Turn this into code and run it.
Do you recognise the tune? Do you need to alter any of the
delays?
Change the synthesizer used by adding the use_synth
command at the beginning of your code.
Using Repetition (loops)
We can instruct the
computer to repeat notes
or phrases a given
number of times or
endlessly.
O Can you modify your
programme to include a
loop?
Code Sabotage
O A strategy to
promote skill
application, problem
solving and
debugging skills.
O Make several
changes to your
code so it doesn’t
run
O One person move
to another group.
O The new member
tries to fix the code
so the code runs
and sounds correct.
Adding Effects
O You can add many
effects to the music
you have created
using the with_fx
command.
O The intellisense
feature will give you
options. Children love
playing about and
seeing what works
and what doesn’t
O Effects can be added
to all of your program,
a selection of your
program and even
used with functions.
Adding Effects
Creating Variables
O Variables are
pieces of
information stored
in computer
programs that can
be displayed,
changed or used.
O We can create
variables to name
the notes we want
to play
Creating Functions
O Functions are a sets of
instructions that are given a
name by the programmer
O They are create use the
define :givenname do
end commands
O These instructions can be
recalled to use by calling the
given name
O Create a function called
motd1 . Then call this
function in another
workspace
Using Selection
O We can use selection to
pick a phrase to play and
effect to use etc
O To do this we use
probability and if and else
statements
O if one_in(2) gives each
statement an even chance
of being executed
O If one_in(5) gives the if
statement 0.2 chance of
being selected and the else
statement 0.8 chance
Using threads
O The in_thread do
end command
always several
phrases or samples
to be played at
once.
O This can be used to
create a drumbeat
or overlap and
offset phrases.
Sonic Pi Command
What it does
play 60
Plays the midi note 60 (middle c)
sleep 0.5
Delays the program for 0.5 secs
3.times do
Repeats the indented instructions a given number
of times
end
loop do
Repeats the indented instructions forever
end
use_synth :prophet
Tells the computer which synth to use
with_fx :wobble do
Adds the selected effects to the indented
instructions
end
In_thread do
end
Plays the indented instructions at the same time
as other instructions indented in the same code
Sonic Pi Command
What it does
c3 = 60
Creates a variable called c3 which is
equivalent to midi 60, Can be recalled in the
line - play c3
define :star do
Stores the indented instructions as a function
that be recalled using the functions name
star
end
use_bpm
Sets the speed at which the music is played –
default is 60bom
if one_in(4)
Creates a selection. The probability of playing
the indented instructions is 0.25
end
else
When combined with above, the probability of
playing these indented instructions is 0.75
end
Every DO needs an END
Sonic Pi for Primary
Schools
Ben Davies & Sarah Zaman CAS Master
Teachers
Thursday 21st May 2015
[email protected]
[email protected]
@b3ndavi3s @sezzyann72 @CompAtSch
CAS South Manchester
Primary Hub Meetings
Sally Jordan & Ben Davies CAS Master Teachers
Acacias Primary School
4.00 - 5.30pm Tuesday 23rd June 2015
[email protected]
[email protected]
@b3ndavi3s @slr112 @CompAtSch