Template:Infobox interval: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
m Moved "Category:Rational intervals" to the top to make sure that it appears in first position in the categories list at the bottom of each page, removed blank line
Plumtree (talk | contribs)
Merging changes from User:Plumtree/Infobox Interval
Line 1: Line 1:
<includeonly>[[Category:Rational intervals]]<div style="
<includeonly>{{#invoke:Infobox Interval|infobox_interval
border: 1px solid #999;
|Ratio={{{1|{{{Ratio|{{PAGENAME}}}}}}}}
margin: 0;
|Ket={{{Ket|{{{Monzo|}}}}}}
margin-left: 1em;
|Cents={{{Cents|}}}
margin-bottom: 0.5em;
|Comma={{{Comma|}}}
padding: 0.25em 0.5em;
|Name={{{Name|}}}
background-color: #fafafa;
|Color name={{{Color name|}}}
min-width: 15em;
|FJS name={{{FJS name|}}}
float: right;
|Sound={{{Sound|}}}
">
|Calc={{{Calc|}}}}}</includeonly><noinclude>
{| width="100%" style="border-collapse: collapse;"
The template '''Infobox Interval''' was built to help presenting basic information about [[interval]]s in a unified form, to make them obvious by glance. Also the formatting of the wiki text itself is easier to read and improve when it is obviously structured by this template.
|+ <u>Interval information</u>
 
{{#if: {{{JI glyph|}}} |
== Usage ==
  {{!}} style="text-align:right; padding-right: 0.25em; vertical-align: top" {{!}} [[JI glyphs|JI glyph]]
There are three different ways to use this template:
  {{!}} style="background-color: white; padding-left: 0.25em" {{!}} {{{JI glyph}}}
* Small ratios: <code><nowiki>{{Infobox Interval}}</nowiki></code> (the ratio is inferred from page name), <code><nowiki>{{Infobox Interval|7/4}}</nowiki></code>, <code><nowiki>{{Infobox Interval|Ratio=7/4}}</nowiki></code>.
}}
** When use this form? In most cases - whenever both numerator and denominator of the ratio are small enough to fit within Lua numbers as integers. You should not encounter any problems when those are <math>\leq 2^{32}</math>, and you might happen to not encounter any problems when those are <math>\leq 2^{53}</math>. With larger numbers, you are almost guaranteed to get inaccurate results.
* Large ratios: <code><nowiki>{{Infobox Interval|Ket=-2 0 0 1}}</nowiki></code>, <code><nowiki>{{Infobox Interval|Monzo=-2 0 0 1}}</nowiki></code>.
** In this form, '''Ratio''' (unless you specify it explicitly, in which case it will be printed as is) and most norms are omitted.
** When use this form? Whenever numerator or denominator are too large.
* Irrational intervals: <code><nowiki>{{Infobox Interval|Ratio=\pi|Cents=1981.795}}</nowiki></code>.
** In this form, '''Factorization''', '''Subgroup''', '''Monzo''' (unless you specify it explicitly), '''FJS name''', norms are omitted.
** When use this form? Whenever the interval is irrational.
 
The template will add the page to the categories when appropriate:
* [[:Category:Rational intervals]] and [[:Category:Irrational intervals]];
* [[:Category:2-limit]], [[:Category:3-limit]], ...;
* [[:Category:Unnoticeable commas]], [[:Category:Small commas]], [[:Category:Medium commas]], [[:Category:Large commas]];
* [[:Category:Superparticular]];
* [[:Category:Harmonics]], [[:Category:Octave-reduced harmonics]], [[:Category:Subharmonics]], [[:Category:Octave-reduced subharmonics]];
* [[:Category:Pages with internal sound examples]];
* [[:Category:Todo:add interval ratio]], [[:Category:Todo:add interval name]], [[:Category:Todo:add color name]], [[:Category:Todo:remove explicit ket notation]], [[:Category:Todo:remove explicit cents]], [[:Category:Todo:initialise Infobox Interval]], [[:Category:Todo:replace sup and sub with LaTeX]], [[:Category:Todo:remove manual line breaks]].
 
The template supports the following parameters:
 
{| class="wikitable"
! Entry
! Parameter
! Meaning, usage notes.
|-
|-
{{#if: {{{Ratio|}}} |
| Ratio
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} Ratio
| 1, Ratio
  {{!}} style="background-color: white; padding-left: 0.25em" {{!}} '''{{{Ratio}}}''' |
| Frequency [[ratio]] of the interval. Specified explicitly, derived from page name or omitted. For irrational intervals, a LaTeX expression describing the interval (without <nowiki><math></nowiki>).
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} Ratio
  {{!}} <span style="color:red"><abbr title="missing value for parameter 'Ratio'">''missing''</abbr></span><sup>[[Template:Infobox Interval| ?&nbsp;]]</sup>[[Category:Todo:add interval ratio]]
}}
|-
|-
{{#if: {{{Monzo|}}} |
| Factorization
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} [[Monzo]]
|
  {{!}} style="background-color: white; padding-left: 0.25em" {{!}} '''{{Monzo|{{{Monzo}}}}}''' |
| Prime factorization of the ratio. Derived either from '''Ratio''' or '''Monzo''' or omitted for irrational intervals.
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} [[Monzo]]
  {{!}} <span style="color:red"><abbr title="missing value for parameter 'Monzo'">''missing''</abbr></span><sup>[[Template:Infobox Interval| ?&nbsp;]]</sup>[[Category:Todo:add interval monzo]]
}}
|-
|-
{{#if: {{{Cents|}}} |
| [[Monzo]]
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} Size in [[cent]]s
| Ket, Monzo
  {{!}} style="background-color: white; padding-left: 0.25em" {{!}} '''{{{Cents}}}''' |
| Coefficients of the [[Monzo]] notation, separated by whitespaces. Derived from '''Ratio''' or specified or omitted for irrational intervals. If you specify one for an irrational interval, [[Template:Monzo]] with the provided argument will be printed.
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} Size in [[cent]]s
  {{!}} <span style="color:red"><abbr title="missing value for parameter 'Cents'">''missing''</abbr></span><sup>[[Template:Infobox Interval| ?&nbsp;]]</sup>[[Category:Todo:add interval cents]]
}}
|-
|-
{{#if: {{{Name|{{{Names|}}}}}} |
| [[Smonzos and svals|Subgroup monzo]]
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} Name(s)
|
  {{!}} style="background-color: white; padding-left: 0.25em" {{!}} '''{{{Name|{{{Names}}}}}}''' |
| Shown instead of '''Factorization''' and '''Monzo''' when there is a sequence of 4+ zeros in ket notation. Derived either from '''Ratio''' or '''Monzo''' or omitted for irrational intervals.
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} Name
  {{!}} <span style="color:red"><abbr title="missing value for parameter 'Name'">''missing''</abbr></span><sup>[[Template:Infobox Interval| ?&nbsp;]]</sup>[[Category:Todo:add interval name]]
}}
|-
|-
{{#if: {{{Color name|{{{Color Name|}}}}}} |
| [[Cent]]s
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} [[Color notation|Color name]]
| Cents
  {{!}} style="background-color: white; padding-left: 0.25em" {{!}} '''{{{Color name|{{{Color Name}}}}}}'''
| Size in [[cent]]s. Either derived from '''Ratio''' or '''Monzo''' or specified for irrational intervals.
}}
|-
|-
{{#if: {{{FJS name|{{{FJS Name|}}}}}} |
| [[Comma|Comma size]]
  {{!}} style="text-align:right; padding-right: 0.25em" {{!}} [[Functional Just System|FJS name]]
| Comma
  {{!}} style="background-color: white; padding-left: 0.25em" {{!}} '''{{{FJS name|{{{FJS Name}}}}}}'''
| Pass a non-empty string (for example, <code>yes</code> or <code>1</code>) to enable this entry. For specific values of '''Cents''', an interval is considered a comma. <math>(0; 3.5] \to</math> unnoticeable, <math>(3.5; 30] \to</math> small, <math>(30; 100] \to</math> medium, <math>(100; +∞) \to</math> large. If the interval is rational and is an integer power of another rational number, the entry is omitted.
}}
|-
|-
{{#if: {{{Sound|}}} |
| [[Square superparticular|S-expression]]s
  {{!}} colspan="2" style="text-align: center;" {{!}} [[File:{{{Sound}}}|270px]]<br/><small>[[:File:{{{Sound}}}|[sound info]]]</small>
|
  [[Category:Pages with internal sound examples]]
| For a rational '''Comma''', a search for S-expressions of specific forms is done.
}}
|-
|-
{{#if: {{{Ratio|}}} |
| Name
  {{!}} colspan="2" style="text-align: center;" {{!}} <small>[https://www.yacavone.net/xen-calc/?q={{#regex: {{{Ratio|}}}|/\s+{{!}}<br>/|}} open this interval in ''xen-calc'']</small>
| Name
}}
| Name(s) of the interval. Pages with missing values go into [[:Category:Todo:add interval name]]. You should not put any <nowiki><br/></nowiki> tags between names here; it will be done automatically.
|}
</div><!-- this section is for changing parameter names to regular form -->{{#if: {{{Names|}}}
| [[Category:Todo:normalize interval parameters]]}}{{#if: {{{Color Name|}}}
| [[Category:Todo:normalize interval parameters]]}}{{#if: {{{FJS Name|}}}
| [[Category:Todo:normalize interval parameters]]}}</includeonly><noinclude>
The template '''Infobox Interval''' was built to help presenting basic information about [[interval]]s in a unified form, to make them obvious by glance. Also the formatting of the wiki text itself is easier to read and improve when it is obviously structured by this template.
 
== Usage ==
The templates supports the following parameters (highly requested parameters in '''bold'''):
 
{| class="wikitable"
! Parameter
! Meaning
! Usage notes, Remarks
|-
|-
| <s>JI glyph</s>
| [[Kite's color notation|Color name]]
| <s>Just intonation glyph, if one exists</s>
| Color name
| <s>complete with prefix "File:" and brackets</s>
| Color name after [[Kite's color notation]] in the form: <code>written form, spoken form</code>. For color names see also [[Gallery of just intervals]]. Pages with missing values go into [[:Category:Todo:add color name]]. Default: omitted.
|-
|-
| '''Ratio'''
| [[Functional Just System|FJS name]]
| Frequency [[ratio]] of the interval
| FJS name
| pages with missing values go into [[:Category:Todo:add interval ratio]]
| [[Functional Just System]] name. Provided, derived from '''Ratio''' or '''Monzo''' or omitted for irrational intervals. Use LaTeX syntax to provide custom names: <code>P5^{11}_{5}</code>.
|-
|-
| '''Monzo'''
| Special properties
| Parameters of the [[Monzo]] notation
|
| pages with missing values go into [[:Category:Todo:add interval monzo]]
| Currently implemented: [[Superparticular interval|superparticular]] and [[square superparticular]] for small ratios, [[harmonic]]s and [[subharmonic]]s, including reduced ones, whether a ratio is [[octave reduction|reduced]].
|-
|-
| '''Cents'''
| [[Tenney height]]
| Size in [[cent]]s
|
| pages with missing values go into [[:Category:Todo:add interval cents]]
| Derived from '''Ratio''' or '''Monzo''' or omitted.
|-
|-
| '''Name'''
| [[Weil height]]
| Name(s) of the interval
|
| pages with missing values go into [[:Category:Todo:add interval name]]
| Derived from '''Ratio''' or omitted.
|-
|-
| Color name
| [[Benedetti height]]
| Color name after [[Kite's color notation]]  
|
| in the form: <code>written form, spoken form</code>, for color names see also [[Gallery of just intervals]]
| Derived from '''Ratio''', if the result is small, or omitted.
|-
|-
| FJS name
| [[Harmonic entropy]]
| [[Functional Just System]] name
|
|  
| Harmonic entropy approximation (Shannon, <math>\sqrt{n\cdot d}</math> weights, <math>200\text{-integer limit}\cap\{x\mid\left|\left|x\right|\right|\leq 100\}</math>). Derived from '''Ratio''', '''Monzo''' or '''Cents'''.
|-
|-
| Sound
| Sound
| Soundfile, if one exists
| Sound
| only name of the file (no prefix "File:" and of course without brackets)
| Soundfile, if one exists. Only name of the file is required (no prefix "File:" and of course without brackets). Default: omitted.
|-
| [[Xen-calc]]
| Calc
| A link to xen-calc. Provided or derived from '''Ratio''' or '''Monzo''' or omitted. When provided (you should do that only for irrational intervals recognised by xen-calc, such as <code>sqrt(25/24)</code>), '''Calc''' is interpreted as the query, not the full link. It is urlencoded automatically.
|}
|}


== Example ==
== Examples ==
Usage example for the harmonic seventh ([[7/4]]):
{{#invoke:Infobox Interval|infobox_interval|Ratio=7/4|Name=harmonic seventh|Color name=z7, zo 7th|Sound=jid_7_4_pluck_adu_dr220.mp3|debug=hide}}
Usage example for a small ratio ([[7/4]]):
<pre>
<pre>
{{Infobox Interval
{{Infobox Interval
| Ratio = 7/4
| Name = harmonic seventh
| Monzo = -2 0 0 1
| Cents = 968.82591
| Name = Harmonic seventh
| Color name = z7, zo 7th
| Color name = z7, zo 7th
| FJS name = m7<sup>7</sup>
| Sound = jid_7_4_pluck_adu_dr220.mp3
| Sound = jid_7_4_pluck_adu_dr220.mp3
}}
}}
</pre>
</pre>


== Boilerplates ==
Usage example for a large ratio ([[septimal ruthenia]]), which is also considered to be a comma:
'''Empty template''' for copy &amp; paste (to avoid copying wrong values from interval pages):
<pre>
{{Infobox Interval
| Monzo = -263 88 0 44
| Name = septimal ruthenia, septiruthenia
| Comma = yes
}}
</pre>
 
Usage example for an irrational interval ([[sqrt(25/24)]]):
<pre>
<pre>
{{Infobox Interval
{{Infobox Interval
| Ratio =  
| Ratio = \sqrt{25/24}
| Monzo =  
| Monzo = -3/2 -1/2 1
| Cents =  
| Cents = 35.336213
| Name =  
| Name = square root of 25/24
| Color name =
| Calc = sqrt(25/24)
| FJS name =
| Sound =  
}}
}}
</pre>
</pre>


'''Partlially self-filling''' version for copy &amp; paste (to avoid copying wrong values from interval pages):
== Boilerplate ==
'''Empty template''' for copy &amp; paste (to avoid copying wrong values from interval pages):
<pre>
<pre>
{{Infobox Interval
{{Infobox Interval
| Ratio = {{subst:PAGENAME}}
| Monzo =
| Cents = {{subst:cents|{{subst:PAGENAME}}|5}}
| Name =  
| Name =  
| Color name =  
| Color name =  
| FJS name =
| Sound =  
| Sound =  
}}
}}
Line 153: Line 150:
== See also ==
== See also ==
* [[Template:Infobox ET]]
* [[Template:Infobox ET]]
* [[xen-calc]] – the according page of that tool gets linked automatically if the <code>Ratio</code> parameter is filled in
* [[xen-calc]] – the according page of that tool gets linked automatically for rational intervals


[[Category:Templates]]
[[Category:Templates]]

Revision as of 11:20, 25 October 2022

The template Infobox Interval was built to help presenting basic information about intervals in a unified form, to make them obvious by glance. Also the formatting of the wiki text itself is easier to read and improve when it is obviously structured by this template.

Usage

There are three different ways to use this template:

  • Small ratios: {{Infobox Interval}} (the ratio is inferred from page name), {{Infobox Interval|7/4}}, {{Infobox Interval|Ratio=7/4}}.
    • When use this form? In most cases - whenever both numerator and denominator of the ratio are small enough to fit within Lua numbers as integers. You should not encounter any problems when those are [math]\displaystyle{ \leq 2^{32} }[/math], and you might happen to not encounter any problems when those are [math]\displaystyle{ \leq 2^{53} }[/math]. With larger numbers, you are almost guaranteed to get inaccurate results.
  • Large ratios: {{Infobox Interval|Ket=-2 0 0 1}}, {{Infobox Interval|Monzo=-2 0 0 1}}.
    • In this form, Ratio (unless you specify it explicitly, in which case it will be printed as is) and most norms are omitted.
    • When use this form? Whenever numerator or denominator are too large.
  • Irrational intervals: {{Infobox Interval|Ratio=\pi|Cents=1981.795}}.
    • In this form, Factorization, Subgroup, Monzo (unless you specify it explicitly), FJS name, norms are omitted.
    • When use this form? Whenever the interval is irrational.

The template will add the page to the categories when appropriate:

The template supports the following parameters:

Entry Parameter Meaning, usage notes.
Ratio 1, Ratio Frequency ratio of the interval. Specified explicitly, derived from page name or omitted. For irrational intervals, a LaTeX expression describing the interval (without <math>).
Factorization Prime factorization of the ratio. Derived either from Ratio or Monzo or omitted for irrational intervals.
Monzo Ket, Monzo Coefficients of the Monzo notation, separated by whitespaces. Derived from Ratio or specified or omitted for irrational intervals. If you specify one for an irrational interval, Template:Monzo with the provided argument will be printed.
Subgroup monzo Shown instead of Factorization and Monzo when there is a sequence of 4+ zeros in ket notation. Derived either from Ratio or Monzo or omitted for irrational intervals.
Cents Cents Size in cents. Either derived from Ratio or Monzo or specified for irrational intervals.
Comma size Comma Pass a non-empty string (for example, yes or 1) to enable this entry. For specific values of Cents, an interval is considered a comma. [math]\displaystyle{ (0; 3.5] \to }[/math] unnoticeable, [math]\displaystyle{ (3.5; 30] \to }[/math] small, [math]\displaystyle{ (30; 100] \to }[/math] medium, [math]\displaystyle{ (100; +∞) \to }[/math] large. If the interval is rational and is an integer power of another rational number, the entry is omitted.
S-expressions For a rational Comma, a search for S-expressions of specific forms is done.
Name Name Name(s) of the interval. Pages with missing values go into Category:Todo:add interval name. You should not put any <br/> tags between names here; it will be done automatically.
Color name Color name Color name after Kite's color notation in the form: written form, spoken form. For color names see also Gallery of just intervals. Pages with missing values go into Category:Todo:add color name. Default: omitted.
FJS name FJS name Functional Just System name. Provided, derived from Ratio or Monzo or omitted for irrational intervals. Use LaTeX syntax to provide custom names: P5^{11}_{5}.
Special properties Currently implemented: superparticular and square superparticular for small ratios, harmonics and subharmonics, including reduced ones, whether a ratio is reduced.
Tenney height Derived from Ratio or Monzo or omitted.
Weil height Derived from Ratio or omitted.
Benedetti height Derived from Ratio, if the result is small, or omitted.
Harmonic entropy Harmonic entropy approximation (Shannon, [math]\displaystyle{ \sqrt{n\cdot d} }[/math] weights, [math]\displaystyle{ 200\text{-integer limit}\cap\{x\mid\left|\left|x\right|\right|\leq 100\} }[/math]). Derived from Ratio, Monzo or Cents.
Sound Sound Soundfile, if one exists. Only name of the file is required (no prefix "File:" and of course without brackets). Default: omitted.
Xen-calc Calc A link to xen-calc. Provided or derived from Ratio or Monzo or omitted. When provided (you should do that only for irrational intervals recognised by xen-calc, such as sqrt(25/24)), Calc is interpreted as the query, not the full link. It is urlencoded automatically.

Examples

Script error: No such module "Infobox Interval". Usage example for a small ratio (7/4):

{{Infobox Interval
| Name = harmonic seventh
| Color name = z7, zo 7th
| Sound = jid_7_4_pluck_adu_dr220.mp3
}}

Usage example for a large ratio (septimal ruthenia), which is also considered to be a comma:

{{Infobox Interval
| Monzo = -263 88 0 44
| Name = septimal ruthenia, septiruthenia
| Comma = yes
}}

Usage example for an irrational interval (sqrt(25/24)):

{{Infobox Interval
| Ratio = \sqrt{25/24}
| Monzo = -3/2 -1/2 1
| Cents = 35.336213
| Name = square root of 25/24
| Calc = sqrt(25/24)
}}

Boilerplate

Empty template for copy & paste (to avoid copying wrong values from interval pages):

{{Infobox Interval
| Name = 
| Color name = 
| Sound = 
}}

See also