My tutorial topics list - I miss any?

Hi all
I am planning/compiling a tutorial on live coding for young musicians, and provide a list of topics below. I would very much appreciate comments along the lines of “why not this topic”, “put this topic before that one because. . .” etc. The emphasis will be on real time composition and performance control. I have intentionally omitted the topics MIDI, OSC and Sound In, for the time being.

TIA

PD-Pi

play
numbers = notes/pitches
play a sequence
sleep

how to repeat (iteration)
4.times do-end

#####################

copy simple melodies
write your own

how to use ring().look #.choose
how to use scale() and play chord()

simple arrays, .shuffle, .rotate, :r
.tick, .pick, .look

play_pattern_timed

#####################

changing synths
changing play opts (adsr)
changing synth opts (cutoff etc)
variables - loop local, and global

#####################

playing drum loop samples
(bpm, sleep, beat stretch, sample duration, rate/rpitch)
composing simple drum loops (simple grids)

playing samples, drag and drop, simple folder access
sample slicing

#####################

live loops
sync:
changing parms in real time; line ramp and range
methods available to ring and array

#####################

randomisation
rrand, spread, bools, dice, one in()

#####################

FX and opts
real time FX control

#####################

density
constrained randomisation

#####################

sequencing multiple loops
stop if, tick reset, set-get, delay:

#####################

function definition, passing arguments
(helper functions and their use in live coding)

3 Likes

Hello!

Thank you for the compilation! I have a suggestion: I would love to see a tutorial or video that guides us in translating music notation into Sonic Pi sounds. It doesn’t need to be a comprehensive guide to music theory in Sonic Pi—just something simple that leans more toward the musical side. For example, something similar to how Duolingo teaches music notation. It could start with the basics and then guide us through playing a song on a virtual piano. Essentially, something that helps bridge the gap between traditional music notation and MIDI notes or something similar.

1 Like

Hi @boda
that is a good topic, but doesn’t directly come under the broad title I have chosen - live coding for young musicians - as those students will be familiar with music notation (at some level) already.

However, it’s a great idea for a tutorial series. I might have a think about that as well.

PD-Pi

. . . and I will freely admit, the first challenge I encountered when learning Sonic Pi (as a “traditionally” trained musician) was translating my L-R pictographic concept of time, pulse and rhythm into text-based top-to-bottom structures. Which is why traditional DAWs are soooo popular! But Sonic Pi offers so many cool features and functions that make it less of a struggle, like density, play_pattern_timed, boolean grids/arrays and other data structures.

If you have any immediate questions about translating music notation into code, post them on this forum :wink:

PD-Pi

Me Coming from a computer science background, I was able to grasp these concepts quickly (I’m not familiar with DAWs, so I’m not influenced by that experience). However, I’ve been struggling with the “musicality” aspect. I’m doing my best to learn more about how music works and to understand some of the concepts behind it. To help with this, I’ve been using Duolingo for music, but any suggestions, blog posts, or study materials would be very helpful. I’m a strong believer in learning by doing, so the more interactive, the better. Recently, I’ve been trying to read and understand Sonic Pi Monthly Challenge #2 to improve in this area.

Hi boda
by DAW I mean digital audio workstation, which follows the pitch/time model of standard music notation: pitch goes up-down, time goes left-right. I envy you your computer science background, because you have the top-down event model of coding baked in to your workflow.

As for musicality - there’s a can of worms I ain’t gonna open :smiley: Far too many of the definitive criteria will be subjective, but in instrumental music practice we look for personal interpretation, creativity, precision in dynamics, emphasis, agogics . . .

Do you mean specifically ‘musicality’ in a live coding context?

Anyhoo, I also agree 100% in the ‘learning by doing’ ethos. The monthly challenge is an excellent resource!

PD-Pi

with ‘musicality’ I was trying to refer to create or do something, that “makes sense” in rhythm, notes, … or at least is somehow “coherent” even with randomness. I will continue exploring, someday I hope this will click!

Hello!

I think this is a very comprehensive list, which should also work well in terms of structure.
However, you write that you want to focus on real-time composition.
In my experience, course participants like to remain in the paradigm that they get to know first and find it difficult to rethink. So if they get to know x.times and maybe in_thread first, it’s not easy for some to switch to the concept of Live_Loops.
I suspect this is not because they don’t understand it, but because they develop musical ideas that are more suited to the fixed sequence of an x.times structure.
So when it comes to LiveCoding, I’ve had good experiences with introducing the concept of Live_Loops earlier in the course.

1 Like

Hi
thank you, I’m happy with the structure and topics. I want to focus on the aspects of Sonic Pi that make it unique and appealing - i.e, ease of use or low entry level, and live composition and performance. The ‘target’ students will have some knowledge and experience of pitch, tempo, rhythm, harmony, repetition and variation, so I will be emphasising the ‘new’ paradigm of top down structures, as opposed to the left-to-right model.

Thanks for your comments; I think you’re right, live-loops should be early in the timeline :wink:

PD-Pi

1 Like

Hi Brendan,

Great idea and I bet I learn loads from it. Happy to betatest :smiley:
I agree with others about 1. live higher up 2. instruments/bpm higher up 3. rings/chords arrays lower down

Get some fun wows in as early as possible. In each session:

a. from scratch coding.
b. changing params on existing code (eg one of Sam’s examples, go play with numbers…charge!)

My background is #musicskillsOK #codingskillsnotOK

I still can’t get my head round rings, chords. V powerful but think this is advanced.

Thinking back to newb experience, I’d want: (without referring to your list):

  1. play + note
    sleep
    change pitches
    change instrument
    copy paste your snippets
    change sleep times (try multiples, divs etc)
    Making long notes and short notes

  2. live_loop (get a beat going)
    sync
    bpm
    bring in drums
    #comment out
    a stop function
    Some keyboard shortcuts for homework - stop/start

  3. play_chords (getting some layers going here)

  4. ADSR (shaping sounds, hurray, reverb)

  5. samples onboard
    splicing

  6. samples, your own (this will inevitably follow)
    splicing

  7. rings, arrays, ticks
    This is complex stuff. Think it needs a really good metaphor or visual to clarify the concept. I can borrow other people’s to play with but still can’t code these from scratch.
    rrand

OR: tackle rings/arrays before samples. Because you still have some control of what people input. They will go off doing joyous mad things after samples:)

  1. FX, esp to get the ‘nested’ concept down
    how to switch FX on and off.

  2. Folders and how they link (I still don’t understand this)
    project/ asset management
    storing samples

  3. Live looping considerations

  4. Variables

I’m not sure about times repeats early on, though it’s v simple. Think it’s useful if you’re building in a traditional music way.

Also variables might be earlier.

Everything else - yes please!

Heading off to Zoom but hope some of this useful.
Jules

1 Like

Hi @rebelcello
these are great comments, exactly the type of thing I asked for. Thanks for taking the time to reply :wink:

PD-Pi

1 Like

You’re welcome :slight_smile: and happy to follow along if time.

Other things come to mind:
12, On here, I’m seeing visual drum patterns x—x— etc which are obvious to Ruby people but pure magic to non-coders.
Also this aligns well with visual pad sequencers (circuit etc) which people may be familiar with. And also music/bar notation in general.
I’d like to see an intro to this.

  1. Phasing! :heartbeat:
  2. Plugging in other devices :sweat_smile:
  3. By then learner wheels are off and they’re all away cutting eps…
  4. MIDI but you mention this already.
  5. Boolean/numbers linked v firmly to switches and knobs. If you’re not into electronics and just play the gentle recorder you won’t get this conceptual connection.
  6. microtones, polyrhythms (ducks, runs…:slight_smile:

PS thought: will you be using musical notation A3, Am etc, rather than MIDI numbers? This is an easier way in for music people, esp making chords from scratch. On the other hand, the chord options in SPi are great, and good to get a handle on note/frequencies as used in MIDI.

It strikes me that there might be a need for the opposite way in: how do coders get into music theory quickly? It’s fab how each way in leads to new learning and concepts, making links and disrupting your old learning.

Another thought: Pasting code into a colour-coded editor will give you helpful visuals for beginners. It makes it easier to spot categories and patterns (and punctuation errors). You could screengrab and put them into materials. Seeing the snippet breakdown in helicopter view is also useful. As a beginner you eventually get your eye in with people’s code - aha, that’s the bassline etc. (A bit like following musical notation of a symphony for Higher Music).

I’m doing a related thing with my Textvizz app (in dev) for writing teaching, hence thinking about these things a lot - closeup writing/edits vs chunks vs bigger picture.

So, work continues, and I have several extensive chapters or sections, covering the following topics:

play
note nn
note names
sleep
.times do end
change synth and basic synth opts
copy/compose a tune
scale
variables
.ring .tick .look. .choose
array index shuffle rotate etc
play_pattern_timed
play chord()
simple fx
live loop basics
Help/Examples
simple rrand

While I have endeavoured to limit the detail in these opening sections, it’s starting to read like a manual - not very fun or instantly gratifying. I’ll avoid domain-specific terminology until I have them hooked. I get the feeling that if I take young students through these opening topics as they currently exist, no-one will show up on week 2 :sob:

So, I’ve decided to precede these topics with an introductory section, which is more hands on. The students will copy-paste blocks of code, change numbers, synths, opts etc, to ensure that they immediately get the sense of controlling a live instrument in real time through code.

I have these two buffers: one for play-sleep, .times do etc; then a second for live loops, fx etc.

Again, please do tell me what you think, as summary introductory material - and of course, I plan to use the patches in the Help/Examples section too :wink:

/Sonic Pi, introductory 'cheat sheet'/
/play, sleep, repetition, patterns, tick, look and simple arrays/
#these three lines are hidden from Sonic Pi

play 60
#play the note 60 (or :c4) once, using the default sound

sleep 2
#wait for 2 beats

use_synth :piano
play 60
play 64
play 67
#play a chord using a different sound

sleep 2

use_bpm 100
play 60
sleep 0.25 #a quarter beat, or semiquaver
play 64
sleep 0.25
play 67
sleep 0.25
play 72
sleep 0.25
play 76
sleep 0.25
play 67
sleep 0.25
play 72
sleep 0.25
play 76
sleep 0.25
#play a melody at a faster tempo

sleep 2
play_pattern_timed [60,64], [0.25]
6.times do
  tick #a counter
  play [67,72,76].look #use the counter to read the list of notes in order, 6 times
  sleep 0.25
end
#a more concise way to play the same pattern


tick_reset
sleep 2
bach = scale(:c4, :minor, num_octaves: 2) #store the notes of C maj in a variable called 'bach'
puts bach #print out the note numbers from C maj
prelude = [0,2,4,7,9,4,7,9].shuffle #this is the pattern of notes in the tune, but shuffled
8.times do
  play bach[prelude.tick]# read the shuffled pattern of notes, from C maj
  sleep 0.25
end
#another way, but we can now easily change the pattern, and the scale or key
/live loops, fx, simple custom functions, rrand, samples and conditional logic/

lfo = line(0, 1.0, steps: 20).mirror

with_fx :reverb, mix: 0.6, room: 0.6 do
  
  with_fx :wobble, wave: 3, phase: 6, res: 0.4 do
    live_loop :arp do
      sample :guit_e_fifths, beat_stretch: 4, amp: 0.5
      sleep 4
    end
  end
  
  use_synth :bass_foundation
  live_loop :myBass, delay: 16 do
    tick
    use_synth_defaults cutoff: lfo.look * 50 + 60
    play knit(28,8, 30,8).look, attack: rrand(0, 0.15), release: 0.25 if spread(5,7).look
    sleep 0.25
  end
  
  use_synth :sc808_tomlo
  amp = line(0, 2.0, steps: 20).ramp
  live_loop :kick, delay: 24 do
    tick
    play 35, amp: amp.look
    sleep 0.5
  end
  
end

TFL

PD-Pi

2 Likes

Hello! In the long term, will we then be able to find all these tutorials/patches in gists on GitHub or on a dedicated site…?
Bravo in any case, the initiative is very constructive and interesting! :grinning:

I’ll put the current draft document up on GitHub later this week, it’s a new platform to me so I’ll need a few days to work it out. My main concerns would be site security, access permissions, and protecting my work. And I don’t know the first thing about online public licences.

The long term plan is to have a monolithic pdf document, a series of YT videos to accompany it (in a Mister Bomb stylee), and an online resource (prolly GitHub again) for each patch/code example.

The most recent topic list I posted above currently constitutes 18 pages of text and code examples, and I haven’t yet covered FX, samples and live_loop in detail. And so many more topics to go!

This will take a few months to ‘complete’, as I have 2 jobs, three kids and very little free time. But I am determined to keep going and see it through.

Thanks for your continuing interest @beryann

PD-Pi

2 Likes

It’s with pleasure Brendan @brendanmac and I know that all this takes a lot of time!
If you agree of course, when it will be ready, I’ll integrate all your tutorials in my Sonic Pi GPT (which is free) to allow a maximum of people to profit of it… What do you think about it? It stays your intellectual propriety of course, my idea is that among the visitors on the GPT, they can choice among different tutorials… And yours are very exciting for an amateur…or not! :smiley:

2 Likes

Fantastic work, Brendan! Epic. Esp with so much else going on.

Look forward to seeing this, happy to be beta learner tho haven’t got head round Github yet.

I think the copy-paste>change numbers approach, before from-scratch coding, is a great way to go. Have a fun experience by playing around with numbers, then learn how-to snippets of code.

Have been revisiting Sam’s tutorials on a new laptop - is starting to fall into place now.

One thing (looking back) I’d find useful is a helicopter visual of code chunks - to show what code is doing what. Colour coding for synth, sample, loop, fx loop, variable, setup items. You start to get your eye in after a while, so just a few examples would help. Can do some down the line if useful.

Not very pretty but this kind of thing (pic). (After doing this (newbie coder) I wondered about 2x fx loops and 1x ‘end’?).

sonic-pi-visualisation
Am deep in textvizz at the moment, so visuals and data are on my mind :smiley: Also language learning in chunks helps recall, wondered if useful for code too.

PS finally got useful laptop (thanks to grant) which is at last plug+play. All the Windows uncooperative stuff has disappeared over night :grimacing: :partying_face:

1 Like

You have a Sonic Pi GPT @beryann ?!!! Where is this please? Is it possible to visit? I’m using GPT to learn coding, explain concepts etc. Is super-patient :slight_smile:

Hello @rebelcello yes here is the link : chat GPT Sonic Pi
The interface is in french but you don’t care, you can prompt in english of courses. The GPT is still being improved but it works well! If you have any problem with it, tell it to me! :wink:

1 Like

Thanks @beryann - this is amazing! I made a 12bar jazz chord sequence with 2drums, bass, piano chords and kalimba slow melody. Then fiddled with ADSR envelope, random ADSR parameters and with_swing, just to see what it does.
At some point my fiddling crashed it (thread death) and GPT and I combined efforts couldn’t find the issue. However it’s fantastic at explaining and I could use impressionistic words to ask for changes, then it explained what it did.
The piece won’t become a big hit anytime soon :smiley: but it’s amazing what it can do. I wonder if it can do Ruby grid? :running_woman:

1 Like