音钟可视化
pitchclock的Python项目详细描述
PitchClock徽标
俯仰时钟
pitchclock是一个python库,用于生成tone clock可视化效果。音调 时钟最初是作为无调性作曲的工具而开发的,但是 也可以是非常有用的视觉色调结构在古典 和Just Intonation 理论也是。
许可证
俯仰时钟分布在允许的MIT license下。
安装
最新稳定的俯仰时钟分布可以安装pip:
pip install pitchclock
或者,如果您喜欢当前的开发版本:
pip install git+https://github.com/hosford42/pitchclock.git
示例用法
作为一个例子,让我们比较一下平均气质主量表 它的近似语调音阶,称为syntonic diatonic scale。音调 时钟用于可视化关系,即间隔, 在投球之间,而不是绝对投球本身。因此 典型的方法是用 产生它们的补药,并在12点放置补药 位置。等音程表示为 在音程中用方括号括起来的半色调。正义 间隔用整数频率比表示。为了这个 图表,我们将用填充圆标记相等的气质区间, 有轮廓圆圈的音程和有角度的主音 作记号。下面是生成图形的代码:
fromfractionsimportFractionfrompitchclockimportETInterval,ToneClock# The equal temperament scale, expressed as equal temperament# intervals from the tonic.et_major_scale=[ETInterval(s)forsin[0,2,4,5,7,9,11]]# The just intonation scale, expressed as frequency ratios from# the tonic.ji_major_scale=[Fraction(*pair)forpairin[(1,1),(9,8),(5,4),(4,3),(3,2),(5,3),(15,8)]]# Here we create the clock, indicating which pitches to represent# with each type of marking in the graph.clock=ToneClock(filled_dots=et_major_scale,empty_dots=ji_major_scale,angles=[et_major_scale[0],ji_major_scale[0]],labels={p:pforpinet_major_scale+ji_major_scale})# We make the radius a little bigger because there's a lot going# on in this graph. A bigger radius means more space for details.clock.style.radius*=1.5# Everything is quantized to quarter tones by default, but we are# building this graph specifically to compare slight differences# in pitch, so we turn it off. However, we leave it on for labels,# because otherwise they will overlap for pitches that are very# close neighbors. With quantization of labels left on, labels# falling within the same quantum will be grouped together with# commas to separate them.clock.style.quantize_non_labels=False# Save the clock as a PNG file. Currently, this is the only# supported format.clock.save('images/major_comparison.png')
这是它产生的图像:
主要比例尺比较
从这个图中,可以立即看出 等差近似最差的交响度标度 气质主音阶是5/4、5/3和15/8,每个音阶都是 比以前的音高略平 近似它。