Tuning Sonic Pi to 432 Hz

Hi friends!

How can we tune Sonic Pi notes to 432 Hz?


Maybe all it takes is this?

use_cent_tuning -31.76665363342928
use_synth :sine
play_pattern [:c,:d,:e,:f,:g,:a,:b]

sleep 1

use_cent_tuning 0
play_pattern [:c,:d,:e,:f,:g,:a,:b]

if all you’re looking to do is to uniformly tune all notes then use_cent_tuningis a good start.

However, pythagorean tuning is not a uniform shift on pitch, rather its a completely different tuning system to the west’s current default of equal tempered.

Luckily, Sonic Pi already has support for a few different tuning systems thanks to @xavierriley, so perhaps this might be fun to play with:

use_tuning :pythagorean
play_pattern [:c,:d,:e,:f,:g,:a,:b]

Thank you, Sam.
Could (should) they be used together for 432Hz tuning?

use_cent_tuning -31.76665363342928
use_tuning :pythagorean
play_pattern [:c,:d,:e,:f,:g,:a,:b]

Hmm, looks like the current implementation of use_tuning doesn’t honour use_cent_tuning :frowning:

@xavierriley - do you see any issues with applying use_cent_tuning after the tuning system is resolved? (This currently all takes place in normalise_transpose_and_tune_note_from_args within lang/sound.rb)

No issue with that as far as I’m concerned. In my defence your honour, use_tuning was implemented in v2.6 and use_cent_tuning didn’t come in until v2.9, but it’s still :frowning: either way

Oh, I wan’t attempting to lay any blame of any kind :slight_smile:

I’m sure it was totally my fault (most things are). However, my main concern was a musical one - would you see any issue switching the order of these things round?

Also, a side question (perhaps one you’ve already addressed?!?), is there any way to get floats working with the tuning system? Currently it only appears to work with integer notes.

Sure, I was just trying to explain how it might have come about - no issue with doing cent tuning after.

As far as I knew floats should be working! https://github.com/samaaron/sonic-pi/blob/6ffea0322dbc18dfe11ca273671a591289e4ae59/app/server/ruby/lib/sonicpi/tuning.rb#L87 That sounds like a bug to me. I’ll put it on my list to have a look.

Ah, yes, I believe it is working - I was just reading my own code incorrectly (as usual) :slight_smile:

(I blame all the kids running around the place!)