Q: how can I use synth "play" by frequencies? (not music notes)

example of middle A
Instead of “play 69” or “play :a4”
i would like to code something like “play 440” or “play 440Hz”
Thanks!

use the hz_to_midi function
eg

play hz_to_midi(440)
4 Likes

Thank you!
Exactly what I meant, is the code was in the help menu?
or there is a list with all the functions?

If you click on the “Help” button in Sonic Pi, then in the online help click on the “Lang” tab, there is a list of all the functions with descriptions and examples.

Neat! Now this open me the doors of indeterminate pitch tone compositions!

use_bpm 132

x = 440
y = 440
z = 1

100.times do
  play_chord [hz_to_midi(x), hz_to_midi(y)], attack: 0, decay: 0.125, sustain: 0.125, release: 0.125
  sleep z
  x = x - 1
  y = y + 1
  z = z - 0.01
  print "x = ", x
  print "Y = ", y
  print "Z = ", z
end

Yes, and you can also do some nice stuff with beat frequencies. running 440 and 442 together for example.

1 Like

A true “sonic” verb meaning