It’s not very common for me to have a question of this sort, but…
Is there a way to use Tuning on chromatic notes or diatonic notes?
It appears that Tuning applies only to \degree
but not to \note
.
So… one must have two Scales (one chromatic and one diatonic), and always use \degree
?
I suspect there are some documentation improvements needed here. I don’t mind to handle that, but the design is not clear to me (and I’m relatively expert with the default event prototype!).
// from the chart
r = [1, 2187/2048, 9/8, 1968/1630, 81/64, 1771/1311, 729/512, 3/2, 6561/4096, 27/16, 5905/3277, 243/128];
// convert to semitones with offsets
// btw this was rather inconvenient to work out
c = log2(
// ratio difference between r and et12
r / (2 ** ((0..11) / 12))
)
* 12
+ (0..11);
t = Tuning(c, 2, \zh1);
(
p = Pbind(
\degree, Pn(Pseries(0, 1, 12), 1),
\dur, 0.5,
\scale, Scale((0..11), 12, t),
\callback, {
[~freq, ~freq.cpsmidi - 60].debug("Hz, semitones above mid C");
}
).play;
)
Hz, semitones above mid C: [261.6255653006, 0.0]
Hz, semitones above mid C: [279.38237857051, 1.1368500605771] // OK
Hz, semitones above mid C: [294.32876096317, 2.0391000173077]
(
p = Pbind(
\note, Pn(Pseries(0, 1, 12), 1),
\dur, 0.5,
\scale, Scale.major.copy.tuning_(t),
\callback, {
[~freq, ~freq.cpsmidi - 60].debug("Hz, semitones above mid C");
}
).play;
)
Hz, semitones above mid C: [261.6255653006, 0.0]
Hz, semitones above mid C: [277.18263097687, 1.0] // ...?
Hz, semitones above mid C: [293.66476791741, 2.0]
hjh