-
Notifications
You must be signed in to change notification settings - Fork 3
/
flute-new.html
196 lines (182 loc) · 7.18 KB
/
flute-new.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html>
<head>
<title>小乙制箫</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1>小乙制箫</h1>
<p>所有开孔位置都是吹口上沿到音孔上沿的位置</p>
</div>
<div class="row">
<div class="col-sm-4">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
环境温度:
</button>
</span>
<input id="temperature" type="text" class="form-control">
</div>
</div>
<div class="col-sm-4">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
管子频率(<250):
</button>
</span>
<input id="basefreq" type="text" class="form-control">
</div>
</div>
<div class="col-sm-4">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
实际管长(毫米):
</button>
</span>
<input id="reallong" type="text" class="form-control">
</div>
</div>
<div class="col-sm-4">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
开孔半径(毫米):
</button>
</span>
<input id="radius" type="text" class="form-control">
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="btn-group btn-group-justified">
<a id="cancel" href="#" class="btn btn-primary">取消</a>
<a id="sure" href="#" class="btn btn-success">确定</a>
</div>
</div>
<p></p>
<div class="row" >
<div class="col-sm-12" id="label1">
</div>
</div>
<div class="row">
<div class="col-sm-4">
<h4>每高10音分,矫正值减少2mm,反之亦然。 </h4>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="finaldelta">
</div>
<div class="col-sm-4">
<a href="#" class="btn btn-success btn-group-justified" id="final">确定</a>
</div>
</div>
<div class="row" >
<div class="col-sm-12" id="label2">
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#cancel").click(function(){
$("#temperature").val("");
$("#basefreq").val("");
$("#reallong").val("");
$("#radius").val("");
});
$("#sure").click(function(){
var hzF = 246.94;
var hzG = 277.2;
var t = $("#temperature").val();
var f = $("#basefreq").val();
var l = $("#reallong").val();
var r = $("#radius").val();
r = parseFloat(r)
var idealLong = (331000 + 610 * t) / (2 * f);
idealLong=idealLong.toFixed(1);
var delta = idealLong - l;
delta = delta.toFixed(1);
var posF = (331000 + 610 * t) / (2 * hzF) - delta + r;
posF = posF.toFixed(1);
var posG = (331000 + 610 * t) / (2 * hzG) - delta + r;
posG = posG.toFixed(1);
var temp = "<h4>校正前Δ: ";
temp += delta
temp += "mm F助音空: " + posF + "mm B3"
temp += " G助音空: " + posG + "mm C4#</h4>"
$("#label1").html(temp);
});
$("#final").click(function(){
var finalD = $("#finaldelta").val();
var t = $("#temperature").val();
var r = $("#radius").val();
r = parseFloat(r)
var hzF = [261.6, 293.7, 311.13, 329.6, 349.2, 392, 415.3, 440, 493.9];
var hzG = [293.7, 329.6, 349.2, 370, 392, 440, 466.2, 493.9, 554.4];
var rationA = [1, 0.858, 0.799, 0.75, 0.71, 0.623, 0.5652, 0.5325, 0.479];
var rationB = [1, 0.846, 0.795, 0.75, 0.70, 0.6, 0.565, 0.525, 0.455];
var toneF = ['C4:',' D4:', ' D4#:',' E4:', ' F4:', ' G4:', ' G4#:', ' A4:', ' B4:'];
var toneG = [' D4:',' E4:', ' F4:', ' F4#:', ' G4:', ' A4:', ' A4#:', ' B4:', ' C5#:'];
var out = "<h4>F调: 基音孔,第一空,第二空,第三孔,第四孔,第五孔,第六空,第七空,第八孔</h4><h4>";
// for (let i = 0, len = toneF.length; i < len; i++) {
// out += " "+toneF[i];
// }
out += "</h4><h4>理论位置:";
for (let i = 0, len = hzF.length; i < len; i++) {
holePos = (331000 + 610 * t) / (2 * hzF[i]) - finalD + r;
holePos = holePos.toFixed(1);
out += toneF[i] + holePos ;
}
out += "</h4><h4>陈正生:";
var holePosBaseF = (331000 + 610 * t) / (2 * hzF[0]) - finalD;
for (let i = 0, len = rationA.length; i < len; i++) {
holePos = holePosBaseF* rationA[i] + r;
holePos = holePos.toFixed(1);
out += toneF[i] + holePos ;
}
out += "</h4><h4>推荐:";
for (let i = 0, len = rationB.length; i < len; i++) {
holePos = holePosBaseF* rationB[i] + r;
holePos = holePos.toFixed(1);
out += toneF[i] + holePos ;
}
out += "</h4>";
out += "<h4>G调: 基音孔,第一空,第二空,第三孔,第四孔,第五孔,第六空,第七空,第八孔</h4><h4>";
// for (let i = 0, len = toneG.length; i < len; i++) {
// out += " "+ toneG[i];
// }
out += "</h4><h4>理论位置:";
for (let i = 0, len = hzG.length; i < len; i++) {
holePos = (331000 + 610 * t) / (2 * hzG[i]) - finalD + r;
holePos = holePos.toFixed(1);
out += toneG[i] + holePos ;
}
out += "</h4><h4>陈正生:";
var holePosBaseG = (331000 + 610 * t) / (2 * hzG[0]) - finalD;
for (let i = 0, len = rationA.length; i < len; i++) {
holePos = holePosBaseG* rationA[i] + r;
holePos = holePos.toFixed(1);
out += toneG[i]+ holePos ;
}
out += "</h4><h4>推荐:";
for (let i = 0, len = rationB.length; i < len; i++) {
holePos = holePosBaseG* rationB[i] + r;
holePos = holePos.toFixed(1);
out += toneG[i]+ holePos ;
}
out += "</h4><h4>";
$("#label2").html(out);
});
});
</script>
</head>
</body>
</html>