# How to code this song on sonic PI

**URL:** <https://in-thread.sonic-pi.net/t/how-to-code-this-song-on-sonic-pi/4795>\
**Category:** Support, Help & Resources\
**Created:** [December 15, 2020, 2:17am UTC](https://in-thread.sonic-pi.net/t/how-to-code-this-song-on-sonic-pi/4795 "2020-12-15T02:17:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [December 15, 2020, 3:37am UTC](https://in-thread.sonic-pi.net/t/how-to-code-this-song-on-sonic-pi/4795/2 "2020-12-15T03:37:36Z")

</div>

It isn’t. You do have the _pitch_ of the notes correct for the “wheels on the bus” - however, the _lengths_ of the notes are not quite correct.

If you have a look at the notation in the screenshot, the symbols change slightly. The first note is just by itself, not connected to others, and has a ‘flag’ hanging off its ‘stem’. The next few are connected together by horizontal ‘beams’, some even connected by _double_ beams.  
These are all just ways of indicating the length of the notes, as well as their timing within a bar.  
The notation in the screenshot for the “wheels on the bus” notes (the four F notes) shows that they have different lengths:

- The notes for “wheels” and “bus” both have the same representation - a solid note ‘head’, a single beam connecting them to something - so they have the same length as each other.
- The double ‘beams’ for “on the” mean that those two notes are each half as long as the notes for “wheels” and “bus”.

This gives us a clue that the Sonic Pi representations of those notes are likely to have different lengths too - or in the case of your example, different sleeps between notes, which is almost the same thing. For your code snippet, the first and last notes need to be twice as long as they currently are (ie, the first and last sleeps need to be twice as long).

From there, to translate rhythm from a musical score to Sonic Pi in general, it’s a matter of understanding what each kind of note written in musical notation means when it comes to the note’s length and timing. There are many resources for this - if you’re interested in learning more about Western music theory, there’s certainly no shortage of material! There has been a little discussion elsewhere in this forum about it:

> [@Is there a place within this site to talk about music theory? If not, could we make one?](https://in-thread.sonic-pi.net/t/is-there-a-place-within-this-site-to-talk-about-music-theory-if-not-could-we-make-one/3672/):
>
> I’m still a fairly new sonic pi user (and just took two weeks off while my laptop was down) so just getting back into it. Also, I’m using sonic pi more as a platform to explore music making, than as a platform in which to learn how to code. I do like learning more about Ruby and SP… but that isn’t my primary reason for using SP. As I scan through some of the SP examples and docs and things I find on youtube and google – I’m realizing that others know a lot more about music theory than I do. I t…

(One particularly interesting resource mentioned in that thread is a series of musical theory ‘lessons’ laid out in PDF form, which you can download for free. It’s even available in several languages):  
[https://tobyrush.com/theorypages/](https://tobyrush.com/theorypages/)

---

_[View the full topic](https://in-thread.sonic-pi.net/t/how-to-code-this-song-on-sonic-pi/4795)._
