Module:Infobox AFDO: Difference between revisions
Jump to navigation
Jump to search
CompactStar (talk | contribs) No edit summary |
CompactStar (talk | contribs) No edit summary |
||
| Line 17: | Line 17: | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
'Fifth', | 'Fifth', | ||
fifth .. '/' .. steps .. '(' .. math.floor(math.log(fifth/steps)/math.log(2) * 1200 * 1000)/1000 .. 'c)' | fifth .. '/' .. steps .. ' (' .. math.floor(math.log(fifth/steps)/math.log(2) * 1200 * 1000)/1000 .. 'c)' | ||
}) | }) | ||
if(dualfifth) then | if(dualfifth) then | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
'Dual sharp fifth', | 'Dual sharp fifth', | ||
fifth .. '/' .. steps .. '(' .. math.floor(math.log(fifth)/math.log(2) * 1200 * 1000)/1000 .. 'c)' | fifth .. '/' .. steps .. ' (' .. math.floor(math.log(fifth)/math.log(2) * 1200 * 1000)/1000 .. 'c)' | ||
}) | }) | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
'Dual flat fifth', | 'Dual flat fifth', | ||
(fifth-1) .. '/' .. steps .. '(' .. math.floor(math.log((fifth-1)/steps)/math.log(2) * 1200 * 1000)/1000 .. 'c)' | (fifth-1) .. '/' .. steps .. ' (' .. math.floor(math.log((fifth-1)/steps)/math.log(2) * 1200 * 1000)/1000 .. 'c)' | ||
}) | }) | ||
end | end | ||
Revision as of 23:22, 11 April 2023
- This module should not be invoked directly; use its corresponding template instead: Template:Infobox AFDO.
Generates an infobox providing information about a given arithmetic frequency division of the octave.
| Introspection summary for Module:Infobox AFDO | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||||||||
No function descriptions were provided. The Lua code may have further information.
local p = {}
local u = require('Module:Utils')
local infobox = require('Module:Infobox')
function p.infobox_AFDO(frame)
local steps = frame.args['steps']
local stepnum = tonumber(steps)
local dualfifth = stepnum % 2 == 1
local fifth = steps+math.ceil(steps/2)
local infobox_data = {}
table.insert(infobox_data, {
'Prime factorization',
u._prime_factorization(stepnum)
})
table.insert(infobox_data, {
'Fifth',
fifth .. '/' .. steps .. ' (' .. math.floor(math.log(fifth/steps)/math.log(2) * 1200 * 1000)/1000 .. 'c)'
})
if(dualfifth) then
table.insert(infobox_data, {
'Dual sharp fifth',
fifth .. '/' .. steps .. ' (' .. math.floor(math.log(fifth)/math.log(2) * 1200 * 1000)/1000 .. 'c)'
})
table.insert(infobox_data, {
'Dual flat fifth',
(fifth-1) .. '/' .. steps .. ' (' .. math.floor(math.log((fifth-1)/steps)/math.log(2) * 1200 * 1000)/1000 .. 'c)'
})
end
local result = infobox.build(
'<-<small> [[' .. (steps - 1).. 'afdo]] </small>' .. '[[' .. steps .. 'afdo]]' .. '<small> [[' .. (steps + 1).. 'afdo]] -></small>',
infobox_data
)
return result
end
return p