User:Fastaro/Generalized Pythagorean tuning: Difference between revisions
m →Generating the ratios with Python code: - I changed the scale work shop code a little so the limit will align with the MOS values |
|||
Line 76: | Line 76: | ||
# Define the range/edo for 'x' | # Define the range/edo for 'x' - NOTE: this will generate twice the amount ratios as the limit | ||
limit = | limit = 6 | ||
# Initialize lists to store the results | # Initialize lists to store the results | ||
ratios1 = [] | ratios1 = [] | ||
ratios2 = [] | ratios2 = [] | ||
# Calculate and store the values of 'n' and the ratios for each 'x' | # Calculate and store the values of 'n' and the ratios for each 'x' | ||
for x in range(limit): | for x in range(limit+1): | ||
n = calculate_n(x, p, q) | n = calculate_n(x, p, q) | ||
Line 92: | Line 93: | ||
ratios1.append(ratio1) | ratios1.append(ratio1) | ||
# Must have this check so an extra note is not placed in for specific limit | # Must have this check so an extra note is not placed in for specific limit | ||
if (x != limit | if (x != limit): | ||
ratio2 = Fraction(q**(n+1), p**x) | ratio2 = Fraction(q**(n+1), p**x) | ||
ratios2.append(ratio2) | ratios2.append(ratio2) | ||
Line 98: | Line 99: | ||
combined_ratios = ratios1 + ratios2 | combined_ratios = ratios1 + ratios2 | ||
# Sort the combined list from lowest to highest | # Sort the combined list from lowest to highest |