.. include:: /project-links.txt .. include:: /abbreviation.txt .. getthecode:: pythagorean-tuning.py :language: python ======================================= Pythagorean Tuning compared to 12-TET ======================================= This section compares the Pythagorean tuning and the twele-tone equal temperament (12-TET). .. code-block:: python import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator from Musica.Math.MusicTheory import * prev_fifth = None for i, pitch in enumerate(PythagoreanTuning): delta_numerator = delta_denominator = '' if isinstance(pitch, PythagoreanFifth): if prev_fifth is not None: # 3**7/2**11 apotome |2**8/3**5 limma delta_numerator, delta_denominator = pitch / prev_fifth prev_fifth = pitch print('{:3} {:3} | {:3} {:3} | {:6} / {:6} | {:4.2f} | {:6.0f}'.format( pitch.numerator_power, pitch.denominator_power, delta_numerator, delta_denominator, pitch.numerator, pitch.denominator, float(pitch), float(pitch.cent))) .. literalinclude:: pythagorean-tuning.stdout :lines: 1-19 .. code-block:: python figure1 = plt.figure(1, (20, 10)) axe = plt.subplot(111) axe.set_title('Pythagorean Tuning / 12-tone Equal Temperament') axe.set_xlabel('Cents') axe.set_ylabel('Frequency Ratio') axe.xaxis.set_major_locator(MultipleLocator(100)) axe.grid() axe.plot([float(pitch.cent) for pitch in PythagoreanTuning], [float(pitch) for pitch in PythagoreanTuning], 'o-') axe.plot([float(pitch.cent) for pitch in ET12Tuning], [float(pitch) for pitch in ET12Tuning], 'o', color='orange') for frequency_ratio in ( FrequencyRatio.unisson, FrequencyRatio.fourth, FrequencyRatio.fifth, FrequencyRatio.octave, ): axe.axhline(y=frequency_ratio, color='orange') axe.axhline(y=float(PythagoreanTuning.wolf_interval), color='red') plt.show() .. image:: temperament.png :align: center