<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.xen.wiki/index.php?action=history&amp;feed=atom&amp;title=User%3AContribution%2FUps_%26_downs_notation_in_Python</id>
	<title>User:Contribution/Ups &amp; downs notation in Python - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://en.xen.wiki/index.php?action=history&amp;feed=atom&amp;title=User%3AContribution%2FUps_%26_downs_notation_in_Python"/>
	<link rel="alternate" type="text/html" href="https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;action=history"/>
	<updated>2026-06-14T23:05:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206250&amp;oldid=prev</id>
		<title>Contribution at 15:59, 3 August 2025</title>
		<link rel="alternate" type="text/html" href="https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206250&amp;oldid=prev"/>
		<updated>2025-08-03T15:59:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:59, 3 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l50&quot;&gt;Line 50:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 50:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return f&amp;quot;{letter}{int((fi * 4) % 7 + 1)}&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return f&amp;quot;{letter}{int((fi * 4) % 7 + 1)}&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def octave_str(o&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;: int&lt;/del&gt;):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def octave_str(o):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return &amp;quot;&amp;quot; if o == 0 else f&amp;quot; {&amp;#039;+&amp;#039; if o &amp;gt; 0 else &amp;#039;-&amp;#039;}{abs(o)}&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return &amp;quot;&amp;quot; if o == 0 else f&amp;quot; {&amp;#039;+&amp;#039; if o &amp;gt; 0 else &amp;#039;-&amp;#039;}{abs(o)}&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Contribution</name></author>
	</entry>
	<entry>
		<id>https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206249&amp;oldid=prev</id>
		<title>Contribution at 15:59, 3 August 2025</title>
		<link rel="alternate" type="text/html" href="https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206249&amp;oldid=prev"/>
		<updated>2025-08-03T15:59:14Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:59, 3 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l50&quot;&gt;Line 50:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 50:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return f&amp;quot;{letter}{int((fi * 4) % 7 + 1)}&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return f&amp;quot;{letter}{int((fi * 4) % 7 + 1)}&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def octave_str(o: int) &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; str&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def octave_str(o: int):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return &amp;quot;&amp;quot; if o == 0 else f&amp;quot; {&amp;#039;+&amp;#039; if o &amp;gt; 0 else &amp;#039;-&amp;#039;}{abs(o)}&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return &amp;quot;&amp;quot; if o == 0 else f&amp;quot; {&amp;#039;+&amp;#039; if o &amp;gt; 0 else &amp;#039;-&amp;#039;}{abs(o)}&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Contribution</name></author>
	</entry>
	<entry>
		<id>https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206242&amp;oldid=prev</id>
		<title>Contribution at 12:23, 3 August 2025</title>
		<link rel="alternate" type="text/html" href="https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206242&amp;oldid=prev"/>
		<updated>2025-08-03T12:23:59Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:23, 3 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def upsdowns(degree: int, steps_per_octave: int, steps_per_fifth: int, steps_per_degree: int = 1):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def upsdowns(degree: int, steps_per_octave: int, steps_per_fifth: int, steps_per_degree: int = 1):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     sharpness = 7 * steps_per_fifth - 4 * steps_per_octave&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     sharpness = 7 * steps_per_fifth - 4 * steps_per_octave&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     POS_ALTS, NEG_ALTS = ({(-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1) ** (&lt;/del&gt;i &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;+ 1&lt;/del&gt;) &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* i &lt;/del&gt;for i in range(1, 6)}, {(-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1) ** &lt;/del&gt;i &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &lt;/del&gt;i for i in range(1, 6)})&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     POS_ALTS, NEG_ALTS = ({(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;i if i % 2 else &lt;/ins&gt;-i) for i in range(1, 6)}, {(-i &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;if i % 2 else &lt;/ins&gt;i&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;) &lt;/ins&gt;for i in range(1, 6)})&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     naturals = []&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     naturals = []&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Contribution</name></author>
	</entry>
	<entry>
		<id>https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206234&amp;oldid=prev</id>
		<title>Contribution at 11:18, 3 August 2025</title>
		<link rel="alternate" type="text/html" href="https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206234&amp;oldid=prev"/>
		<updated>2025-08-03T11:18:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:18, 3 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l7&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     for a in range(-5, 6):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     for a in range(-5, 6):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         pos = (a * steps_per_fifth) % steps_per_octave&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         pos = (a * steps_per_fifth) % steps_per_octave&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         oadj = -1 if (pos &amp;lt; steps_per_octave &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/ 2 &lt;/del&gt;and a in POS_ALTS) else (1 if (pos &amp;gt; steps_per_octave &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/ 2 &lt;/del&gt;and a in NEG_ALTS) else 0)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         oadj = -1 if (&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2 * &lt;/ins&gt;pos &amp;lt; steps_per_octave and a in POS_ALTS) else (1 if (&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2 * &lt;/ins&gt;pos &amp;gt; steps_per_octave and a in NEG_ALTS) else 0)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         naturals.append([pos, [0, a, oadj]])&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         naturals.append([pos, [0, a, oadj]])&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     naturals.sort(key=lambda x: (x[0], -x[1][1], x[1][2]))&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     naturals.sort(key=lambda x: (x[0], -x[1][1], x[1][2]))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Contribution</name></author>
	</entry>
	<entry>
		<id>https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206233&amp;oldid=prev</id>
		<title>Contribution at 10:18, 3 August 2025</title>
		<link rel="alternate" type="text/html" href="https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206233&amp;oldid=prev"/>
		<updated>2025-08-03T10:18:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:18, 3 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l38&quot;&gt;Line 38:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 38:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         elems = new&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         elems = new&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;arrow&lt;/del&gt;(a):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;arrow_str&lt;/ins&gt;(a):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         if a == &amp;quot;neutral&amp;quot;: return &amp;quot;~&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         if a == &amp;quot;neutral&amp;quot;: return &amp;quot;~&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         sym, n = (&amp;quot;v&amp;quot; if a &amp;lt; 0 else &amp;quot;^&amp;quot;), abs(int(a))&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         sym, n = (&amp;quot;v&amp;quot; if a &amp;lt; 0 else &amp;quot;^&amp;quot;), abs(int(a))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return sym * n if n &amp;lt;= 3 else f&amp;quot;{sym}&amp;lt;sup&amp;gt;{n}&amp;lt;/sup&amp;gt;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return sym * n if n &amp;lt;= 3 else f&amp;quot;{sym}&amp;lt;sup&amp;gt;{n}&amp;lt;/sup&amp;gt;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;label&lt;/del&gt;(fi, a):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     def &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;label_str&lt;/ins&gt;(fi, a):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         if a == &amp;quot;neutral&amp;quot;: letter = &amp;quot;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         if a == &amp;quot;neutral&amp;quot;: letter = &amp;quot;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         elif abs(fi) &amp;lt;= 1: letter = &amp;quot;&amp;quot; if a != 0 else &amp;quot;P&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         elif abs(fi) &amp;lt;= 1: letter = &amp;quot;&amp;quot; if a != 0 else &amp;quot;P&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l59&quot;&gt;Line 59:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 59:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return out&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return out&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     return dedupe([&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;arrow&lt;/del&gt;(off) + &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;label&lt;/del&gt;(fi, off) + octave_str(octv) for off, fi, octv in elems])&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     return dedupe([&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;arrow_str&lt;/ins&gt;(off) + &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;label_str&lt;/ins&gt;(fi, off) + octave_str(octv) for off, fi, octv in elems])&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Contribution</name></author>
	</entry>
	<entry>
		<id>https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206232&amp;oldid=prev</id>
		<title>Contribution: Created page with &quot;&lt;syntaxhighlight lang=&quot;python&quot;&gt; def upsdowns(degree: int, steps_per_octave: int, steps_per_fifth: int, steps_per_degree: int = 1):     sharpness = 7 * steps_per_fifth - 4 * steps_per_octave     POS_ALTS, NEG_ALTS = ({(-1) ** (i + 1) * i for i in range(1, 6)}, {(-1) ** i * i for i in range(1, 6)})      naturals = []     for a in range(-5, 6):         pos = (a * steps_per_fifth) % steps_per_octave         oadj = -1 if (pos &lt; steps_per_octave / 2 and a in POS_ALTS) else (1...&quot;</title>
		<link rel="alternate" type="text/html" href="https://en.xen.wiki/index.php?title=User:Contribution/Ups_%26_downs_notation_in_Python&amp;diff=206232&amp;oldid=prev"/>
		<updated>2025-08-03T10:11:28Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt; def upsdowns(degree: int, steps_per_octave: int, steps_per_fifth: int, steps_per_degree: int = 1):     sharpness = 7 * steps_per_fifth - 4 * steps_per_octave     POS_ALTS, NEG_ALTS = ({(-1) ** (i + 1) * i for i in range(1, 6)}, {(-1) ** i * i for i in range(1, 6)})      naturals = []     for a in range(-5, 6):         pos = (a * steps_per_fifth) % steps_per_octave         oadj = -1 if (pos &amp;lt; steps_per_octave / 2 and a in POS_ALTS) else (1...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def upsdowns(degree: int, steps_per_octave: int, steps_per_fifth: int, steps_per_degree: int = 1):&lt;br /&gt;
    sharpness = 7 * steps_per_fifth - 4 * steps_per_octave&lt;br /&gt;
    POS_ALTS, NEG_ALTS = ({(-1) ** (i + 1) * i for i in range(1, 6)}, {(-1) ** i * i for i in range(1, 6)})&lt;br /&gt;
&lt;br /&gt;
    naturals = []&lt;br /&gt;
    for a in range(-5, 6):&lt;br /&gt;
        pos = (a * steps_per_fifth) % steps_per_octave&lt;br /&gt;
        oadj = -1 if (pos &amp;lt; steps_per_octave / 2 and a in POS_ALTS) else (1 if (pos &amp;gt; steps_per_octave / 2 and a in NEG_ALTS) else 0)&lt;br /&gt;
        naturals.append([pos, [0, a, oadj]])&lt;br /&gt;
    naturals.sort(key=lambda x: (x[0], -x[1][1], x[1][2]))&lt;br /&gt;
    first_pos, (zero, a0, o0) = naturals[0][0], naturals[0][1]&lt;br /&gt;
    naturals.append([first_pos + steps_per_octave, [zero, a0, o0 + 1]])&lt;br /&gt;
&lt;br /&gt;
    ups_and_downs = [[i, []] for i in range(steps_per_octave)]&lt;br /&gt;
    for (lpos, ltri), (rpos, rtri) in zip(naturals, naturals[1:]):&lt;br /&gt;
        ups_and_downs[lpos][1].append([ltri[0], ltri[1], ltri[2]])&lt;br /&gt;
        for b in range(lpos + 1, rpos):&lt;br /&gt;
            L, R = b - lpos, rpos - b&lt;br /&gt;
            ups_and_downs[b][1] = [[L, ltri[1], ltri[2]]] if L &amp;lt; R else ([[L, ltri[1], ltri[2]], [-R, rtri[1], rtri[2]]] if L == R else [[-R, rtri[1], rtri[2]]])&lt;br /&gt;
&lt;br /&gt;
    ups_step = degree * steps_per_degree&lt;br /&gt;
    octave_shift, base_step = divmod(ups_step, steps_per_octave)&lt;br /&gt;
    elems = [[e[0], e[1], e[2] + octave_shift] for e in ups_and_downs[base_step][1]]&lt;br /&gt;
    is_half_float = lambda x: isinstance(x, float) and (x % 1 == 0.5)&lt;br /&gt;
&lt;br /&gt;
    if sharpness:&lt;br /&gt;
        sgn = 1 if sharpness &amp;gt; 0 else -1&lt;br /&gt;
        abs_sh, s2, new = abs(sharpness), abs(sharpness) / 2, []&lt;br /&gt;
        for off, fi, octv in elems:&lt;br /&gt;
            while off &amp;gt; s2: off, fi = off - abs_sh, fi + 7 * sgn&lt;br /&gt;
            while off &amp;lt; -s2: off, fi = off + abs_sh, fi - 7 * sgn&lt;br /&gt;
            nt_off, nt_fi = off, fi&lt;br /&gt;
            while nt_off &amp;gt; 0 and abs(nt_off) &amp;gt;= s2: nt_off, nt_fi = nt_off - s2, nt_fi + 3.5 * sgn&lt;br /&gt;
            while nt_off &amp;lt; 0 and abs(nt_off) &amp;gt;= s2: nt_off, nt_fi = nt_off + s2, nt_fi - 3.5 * sgn&lt;br /&gt;
            if nt_off == 0 and is_half_float(nt_fi) and abs(nt_fi) &amp;lt;= 3: off = &amp;quot;neutral&amp;quot;&lt;br /&gt;
            new.append([off, fi, octv])&lt;br /&gt;
        elems = new&lt;br /&gt;
&lt;br /&gt;
    def arrow(a):&lt;br /&gt;
        if a == &amp;quot;neutral&amp;quot;: return &amp;quot;~&amp;quot;&lt;br /&gt;
        sym, n = (&amp;quot;v&amp;quot; if a &amp;lt; 0 else &amp;quot;^&amp;quot;), abs(int(a))&lt;br /&gt;
        return sym * n if n &amp;lt;= 3 else f&amp;quot;{sym}&amp;lt;sup&amp;gt;{n}&amp;lt;/sup&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def label(fi, a):&lt;br /&gt;
        if a == &amp;quot;neutral&amp;quot;: letter = &amp;quot;&amp;quot;&lt;br /&gt;
        elif abs(fi) &amp;lt;= 1: letter = &amp;quot;&amp;quot; if a != 0 else &amp;quot;P&amp;quot;&lt;br /&gt;
        elif abs(fi) &amp;lt;= 5: letter = &amp;quot;m&amp;quot; if fi &amp;lt; 0 else &amp;quot;M&amp;quot;&lt;br /&gt;
        else: letter = (&amp;quot;d&amp;quot; if fi &amp;lt; 0 else &amp;quot;A&amp;quot;) * ((abs(fi) + 1) // 7)&lt;br /&gt;
        return f&amp;quot;{letter}{int((fi * 4) % 7 + 1)}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def octave_str(o: int) -&amp;gt; str:&lt;br /&gt;
        return &amp;quot;&amp;quot; if o == 0 else f&amp;quot; {&amp;#039;+&amp;#039; if o &amp;gt; 0 else &amp;#039;-&amp;#039;}{abs(o)}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    def dedupe(seq):&lt;br /&gt;
        seen, out = set(), []&lt;br /&gt;
        for x in seq:&lt;br /&gt;
            if x not in seen: seen.add(x); out.append(x)&lt;br /&gt;
        return out&lt;br /&gt;
&lt;br /&gt;
    return dedupe([arrow(off) + label(fi, off) + octave_str(octv) for off, fi, octv in elems])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Contribution</name></author>
	</entry>
</feed>