The small defect in the flutomat code (as of 2010.12.17)
There is a small defect in the code for the online flute hole calculator provided by Pete Kosel.
The defect is minor, and the difference in the results is so small that
no-one would notice. I only noticed because I have been
copying/understanding/refactoring the code (with Pete's kind
permission). I do not wish people to think that this reduces the
usefulness of the flutomat calculator in any way. The difference
is only noticeable as wall thickness or hole diameter, or both are
increased.
I use the correct algorithm in the latest Whistle Calculator, because it is
simpler than making a special case to emulate flutomat, and because I
think it fair to the users.
findLocations2: lines 186-196
// find subsequent finger hole locations
if(holeCount >= 2)
for(holeNum=2;holeNum<=holeCount;holeNum++)
{
L = Vsound * 0.5 / Ff[holeNum];
if (holeNum < holeCount)for(i=holeNum;i<=holeCount;i++) L = L - C_c(i);
a = 2;
b = - Xf[holeNum-1] - 3*L + te(holeNum)*(Bore/Df[holeNum])*(Bore/Df[holeNum]);
c = Xf[holeNum-1]*(L - te(holeNum)*(Bore/Df[holeNum])*(Bore/Df[holeNum])) + (L*L);
Xf[holeNum] = ( -b - Math.sqrt((b*b) - 4*a*c) ) / (2*a);
}
note that the 'for loop' applying the closed hole corrections starts at i=holeNum.
This has the effect of applying the 'closed hole correction' to the
hole being considered, which is sounding because it is open! The defect did not exist in the older function findLocations (lines 137-148) that likely preceeded findLocations2()
for(holeNum=2;holeNum<=holeCount;holeNum++)
{
X = Vsound * 0.5 / Ff[holeNum];
Xf[holeNum] = 0;
do
{
oldX = Xf[holeNum];
Xf[holeNum] = X - C_o(holeNum);
if(holeNum<holeCount)for(i=holeNum+1;i<=holeCount;i++) Xf[holeNum] = Xf[holeNum]-C_c(i);
}
while(!Math.abs(Xf[holeNum]-oldX) < 0.0001)
}
The 'for loop' starts at i=holeNum+1, which means that 'closed hole corrections' start at the hole after the hole being considered.