Hi,
I’m experimenting with microtuning and have the following code: [Update, I think I got it working!]
define :microTune do |note, isSample|
# Bohlen–Pierce
cents = (map a: 1316.74,
as: 1463.05,
b: 1609.35, #! unmapped h: 1755.66 , j: 1901.96
c: 0,
cs: 146.30,
d: 292.61,
ds: 438.91,
e: 585.22,
f: 731.52,
fs: 877.83,
g: 1024.13,
gs: 1170.44)[note]
# 10 out of 13-tET
cents2 = (map a: 1107.69,
as: nil,
b: nil,
c: 0,
cs: 184.61,
d: 276.92,
ds: 369.23,
e: 553.84,
f: 646.15,
fs: 738.46,
g: 923.07,
gs: 1015.38)[note]
# 12 out of 17-tET, chain of fifths
cents3 = (map a: 847.05,
as: 988.23,
b: 1058.82,
c: 0,
cs: 70.58,
d: 141.17,
ds: 282.35,
e: 352.94,
f: 494.11,
fs: 564.70,
g: 635.29,
gs: 776.47)[note]
if isSample
return (cents / 100) # Return pitch adjustment
else
return note + (cents / 100) # Return note with adjustment
end
end
define :getPitchFromNote do |note, sampleBaseNote, fineTune|
return note - sampleBaseNote + fineTune
end
live_loop :testNote do
notes = (ring :c, :cs, :d, :ds, :e, :f, :fs, :g, :gs, :a) #, :as, :b)
with_synth :chiplead do
with_octave -1 do
play microTune(notes.tick, false), amp: 1
end
end
sleep 0.5
end
live_loop :testSample do
s = :bass_dnb_f
notes = (ring :c, :cs, :d, :ds, :e, :f, :fs, :g, :gs, :a) #, :as, :b)
sample s, rpitch: (getPitchFromNote notes.tick, :f3, microTune(notes.look, true)), amp: 1
sleep 0.5
end
Thanks,
Lee.