Maqam Music with Sonic Pi - Performance

Hello everyone!

I have been working with Sonic Pi since my brother and his colleague introduced me to it. I’m a software engineer and they work in education. They are planning to use Sonic Pi with students for educational purposes.

When I noticed the scale system in Sonic Pi, I immediately thought this can be implemented with traditional Turkish microtonal scales(maqams). I forked the repo and implemented my own scale system. There are not any binaries for it since I couldn’t manage to form the environment around Windows/Linux. I’ve opened a pull request and awaiting review. But it still has some work to do. i.e The maqams are not circular, I don’t know if it’s problem or not.

Afterwards, we made a collaboration video with my brother(ney) and our friend(percussion). I’ve coded live, and they improvised on the groovy background. I’m an amateur musician myself but I’m still new to concepts of the electronic/house etc. music. So I think the code and the groove is not state of the art :slight_smile:. I’ve some different ideas for the live performance. This is the video:

Makam Music with SonicPi

This was the baseline of our application to the Maker Faire Istanbul. The application is accepted and we will perform live in the Faire(27-29 Oct). You can check out their web page.

If anyone wants to try out the maqams, the fork is below. You need to copy scales.rb to your installation folder. I’m really interested in your opinions about it, please do not hesitate to contact or open an issue about it. The musical system is very different from western 12-TeT system(even the notes and the intervals are different!).

Fork with maqam implementation

We are very excited for the upcoming performance within Maker Faire. I will try to record and share it here with you!



This sounds really cool. Nice work.


Thank you so much for this treasure, it looks wonderful.
I try to play the maqam reflected in the video but I get an error saying it can’t find the maqam hicaz, how can I save your maqams in Sonic Pi ?
As you can see in the gif video I share I copied your github instructions but it doesn’t work,it gives an error message.

Hi there,

if you look at the error message it says:

Your code buffer has reached capacity.
Please remove some code before continuing.
For working with very large buffers use:
load_file "/path/t/buffer.rb"

As this file is too large, you need to save it to an external file on your hard drive and then use the load_file function to load it in, passing the path to the file you just created. If you don’t know the path, just drag the newly created file into Sonic Pi and it will autocomplete the path for you :slight_smile:

Hi Sam!
Thank you very much for your help .
Continues the error

Hi there,

Ooh, this looks like a old bug in the error message which has since been fixed in a more recent version of Sonic Pi than you’re running.

Could you try run_file instead?

Sam ,these are with the latest version and they don’t work either

In your screenshot showing your attempt to use run_file, it’s complaining about an attempt to use a variable named scale, which Sonic Pi doesn’t allow as it is the name of a built in function. So, I assume that in the file you are trying to run, it would require changing that variable’s name.

Without seeing the code itself, it would be a little difficult to say anything more…

we are not wizzards :slight_smile:

How can i share the code if is not possible to load a text file and .rb ?
I can show the link of the code ,is very long:

A link to an external page like this is fine :slightly_smiling_face: I’ll have a look at it for any issues.

This looks like replacement code for scale.rb in the application rather than a user run file. It is modifying the (then in 2017) existing scale.rb The mod also requires a change to sonicpiapis.cpp and hence a rebuild of the gui as well. Also you would have to take account of additional changes to scale.rb since this version was produced. It could be used as a basis for modifying the existing scale.rb and sonicpiapis.cpp files.

1 Like

Heh. Robin beat me to it :slight_smile: As he has mentioned, this code is meant to be a replacement/extension of some of Sonic Pi’s internal code, would need to be properly integrated into the app, and does not have several updates made to that particular area of the code since the time it was created…

Thank you ethancrawford & robin for your discovery.
So, these scales belonged to a very old version of sonic Pi.
And the latest version of sonic Pi delivered them into oblivion

Not so much - rather, the scales above are still on kivan’s personal clone of the Sonic Pi code - which is not yet up to date with the current official Sonic Pi code. They could still be brought up to date, but then it would also need consideration from the core team about including it in the official Sonic Pi code for folks that may not get around to compiling Sonic Pi from source code on their own computers.
There has been some discussion on a similar idea to this at (/cc @xavierriley - see

it would be fantastic to have the variety and richness of the Turkish scales +1

Hello everyone. I didn’t know messages from this forums ends up in junk folder. I’ve just fixed that and I’m glad that this has some attention.

So my PR got some criticization regarding having so much changes for the file and the system, still there is no way to blend the Turkish music otherwise. Now I will update the scales in the new updated branch ASAP. I’ve a strict schedule nowadays, but I’m more than happy that these scales had some attention.

Thanks Lunatico and everyone commented.