Can sonic pi read a tuning text file to map all notes to any arbitrary value?

Hello in_thread! Long time no see! I have been getting more and more into computer music programming but using pure data instead of sonic pi, even landed a small job programming in pure data!

Anyways recently I found this website that allows for users to create their own MIDI tuning system, for example tuning to A = 443.16843 (or whatever) or working with non-12 equal temperament. I know sonic pi has native supports for more unusual scales (beyond major and minor), but I think this approach to microtonal music would be a nice addition as well.

Is tuning from a text file supported on sonic pi natively?

Nope. We do have a similar feature on the wishlist though:

Just to clarify, Sonic Pi already has support for some alternative tunings (checkout use_tuning and with_tuning in the docs) which will let you use things like just intonation.

There’s also support for transposing the base pitch for notes other than A=440Hz. For example, if you get a gig live coding with a baroque orchestra and you need to tune to A=415Hz you can use the following:

use_tuning :just, :c
use_transpose -(hz_to_midi(440) - hz_to_midi(415))

play :c

It’s a bit of a hack but it gets the job done…

As for making alternative tunings customisable, that is indeed a good idea and it should be possible to implement. You can checkout the code for the default tunings here: sonic-pi/tuning.rb at main · sonic-pi-net/sonic-pi · GitHub It probably wouldn’t be too hard to make this dynamic.