Hello New to Coding and Sonic-Pi ! 2 questions

New to coding questions:

  1. What type of code is sonic-pi actually, does this help us learn Python or C++? or am I completely off track.

My current goal is to use/get some data, and have it play a my sonic music pattern when a X limit has been reached.

What would be the easiest way to make this work? Google docs?

Figured I would test it first with a random data generator, but I’m not sure where to get started… : / Probably easier ways to do this using APIs or something, but wanted to try to learn code and use Sonic-pi.

Any help would be greatly appreciated.



1 Like

Haha when I first found sonic pi I though it was some weird syntax of python.

No Sonic Pi is built on ruby. It’s really it’s own “language” that supports *most ruby syntax. Ju(py)ter notebook, Python. Sonic Pi, Raspberry Pi, Python? it’s easy to confuse :joy:

Best places to learn in my opinion is the built in documentation and this site Introduction

Just start making noise and have fun while you do it.

Also there is many, many ways to do what you want.
Below are two simple examples I thought of:

someData = (ring :c, :e, :d, :g)
#for loop
for x in 0..10 do
    puts "x #{x}"
    play someData.tick
    sleep 1
  x = 10
  i = 0 #to show you it runs for 10 times 
  x.times do
    puts "x #{i=i+1}"
    play someData.tick
    sleep 1

Hope this helps to get you started.


You can’t learn it all in one sitting so just keep making little things and trying different ways to do things. You will be happy with yourself when you start to get it.


Hey @blancosuave,

As Din has mentioned, Sonic Pi is built on top of Ruby, but is its own language, (called a Domain Specific Language or ‘DSL’), designed primarily for music composition and live coding. (Ie, it is not considered a general purpose language).

It shares much of the basic syntax of Ruby, and may be able to use many plain Ruby functions and classes, but whether such things work is not guaranteed or ‘officially’ supported - and if they do work, that may change at any time as Sonic Pi evolves.

You’re welcome to see what works though, and there are plenty of folks around who I am sure will be able to provide help and advice, such as you have seen above!

In terms of your particular goals, as again mentioned above, there are many ways to do the same thing - Ruby can be like that! One of the questions you’d need to answer eventually is how you wish to get the data into the Sonic Pi script so that you can use it, which to some degree may depend on the format at the original source. Is it provided as a CSV file? JSON file? something else? Ruby has a bunch of libraries that can handle formats such as these, so it may just be a case of calling one of these libraries in Sonic Pi and stuffing the result into an array (which you could turn into a ring if desired).

Anyway, great to have you aboard! Din pretty much said it all - the important thing is to just have fun and experiment. Go ahead and keep asking questions if you get stuck and the documentation doesn’t help (and tell us why too - the more we can improve it, the better!)