JS脚本:原琴·五线谱版【更新】 (#500)
* 添加了制谱器 * 修正两个误改点位 * 更新版号 * 添加制谱器【跟新描述】 * 添加制谱器 * Delete repo/js/AutoYuanQin/assets/1.小星星.json * Delete repo/js/AutoYuanQin/assets/2.小星星变奏曲.json * Delete repo/js/AutoYuanQin/assets/3.Unknown Mother Goose [アンノウン・マザーグース].json * Delete repo/js/AutoYuanQin/assets/4.铃芽之旅[Suzume].json * Delete repo/js/AutoYuanQin/assets/5.Flower Dance.json * Delete repo/js/AutoYuanQin/assets/example.json * 更新制谱器 * 完善制谱器 完善了制谱器,修复了制谱器的遗留问题 * 删除重复文件 * 更新制谱器版号
This commit is contained in:
1 parent
a80c6028dc
commit
8c4eeadfd8
3 files changed
+38
-52
No files matched your search
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "千本櫻",
|
||||
"author": "提瓦特钓鱼玳师",
|
||||
"description": "五线谱网址:https://musescore.com/erics_piano_sheet/scores/5359278",
|
||||
"bpm": "152",
|
||||
"time_signature": "4/4",
|
||||
"composer": "黒うさP[黑兔P]",
|
||||
"arranger": "Eric Chen",
|
||||
"notes": "N[8-#]A[8-#](VS)[1]|\n(NF)[2-*](AG)[4]|\n(SH)[2-*](SH)[8](AG)[8]|\n(FW)[4](VF)[4](BG)[4](NH)[4]|\n\nB[8]N[8]X[16]Z[16]X[16]Z[16]B[8]N[8]X[16]Z[16]X[16]Z[16]|\nB[8]N[8]X[16]Z[16]X[16]Z[16]V[8]C[8]X[8]Z[8]|\nB[8]N[8]X[16]Z[16]X[16]Z[16]B[8]N[8]X[16]Z[16]X[16]Z[16]|\nB[8]N[8]A[8]F[8]D[16]F[16]D[16]S[16]A[8]N[8]|\n\nB[8]N[8]X[16]Z[16]X[16]Z[16]B[8]N[8]X[16]Z[16]X[16]Z[16]|\nB[8]N[8]X[16]Z[16]X[16]Z[16]V[8]C[8]X[8]Z[8]|\nX[8]Z[16]X[16]V[8]X[16]V[16]N[8]B[16]N[16]A[16]F[16]N[16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](MG)[4](NF)[4]|\n(MG)[8](MF)[8](AH)[8](DQ)[8](FW)[4]@[4]|\n\nQ[8-#]W[8]W[8]W[8]W[8]W[8]W[8]W[16]Q[16]H[8]|\nF[8-#]G[8]G[8]G[8]G[8]G[8]G[8]G[16]F[16]S[8]|\nA[8-#]S[8]S[8]S[8]S[8]S[8]S[8]S[16]A[16]N[8]|\n\nB[8]N[16]B[16]N[16]M[16]A[16]S[16]D[4-16.3]G[4-16.3]H[4-16.3]W[4-16.3]R[4-16.$]E[8]W[16]E[16]|\nH[16]F[16]S[16]H[8]H[16]F[16]S[16]H[16]F[16]S[16]H[8]H[16]F[16]S[16]|\nJ[16]G[16]D[16]J[8]J[16]G[16]D[16]J[16]G[16]D[16]J[8]J[16]G[16]D[16]|\n\nJ[16]F[16]S[16]J[8]J[16]F[16]S[16]J[16]F[16]S[16]J[8]J[16]F[16]S[16]|\nG[16]D[16]A[16]G[8]G[16]D[16]A[16]H[16]D[16]A[16]H[8]H[16]D[16]A[16]|\n\nH[16]F[16]S[16]H[16]W[16]H[16]F[16]S[16]H[16]F[16]S[16]H[16]R[32]E[32]W[16]H[16]F[16]|\nJ[16]G[16]D[16]J[16]W[16]E[16]J[16]G[16]D[16]J[16]G[16]D[16]J[16]T[32]R[32]E[16]J[16]G[16]|\n\nS[16]M[16]V[16]M[16]D[32]F[32]M[16]S[16]F[16]J[16]F[16]S[16]M[16]M[16]B[16]V[16]X[16]|\nN[16]A[16]D[16]G[16]A[16]S[16]D[16]G[16]H[8]@[8]N[16]A[16]D[16]G[16]|\n\nH[16]G[16]H[16]F[16]G[16]F[16]D[16]D[16]G[16]F[16]G[16]D[16]S[16]A[16]M[16]M[16]|\nN[16]B[16]N[16]V[16]B[16]V[16]B[16]V[16]X[4]@[4]|\nZ[8](XV)[8]Z[8](XV)[8]Z[8](CB)[8]V[16]C[16]X[16]V[16]|\n\nN[4]A[8]B[8-#]N[8]N[2]|\nZ[8](XV)[8]Z[8](XV)[8]X[16]X[16]Z[16]Z[16]V[16Line truncated
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="version" content="1.0.0">
|
||||
<meta name="version" content="1.1">
|
||||
<title>BGI原琴制谱器</title>
|
||||
<style>
|
||||
body {
|
||||
@@ -221,16 +221,16 @@
|
||||
<area shape="rect" coords="794,827,849,877" onclick="add_key('B')">
|
||||
<area shape="rect" coords="794,877,849,927" onclick="add_key('C')">
|
||||
<area shape="rect" coords="794,927,849,977" onclick="add_key('Z')">
|
||||
<area shape="rect" coords="854,477,909,527" onclick="add_key('Y')">
|
||||
<area shape="rect" coords="854,527,909,577" onclick="add_key('R')">
|
||||
<area shape="rect" coords="854,577,909,627" onclick="add_key('W')">
|
||||
<area shape="rect" coords="854,627,909,677" onclick="add_key('J')">
|
||||
<area shape="rect" coords="854,677,909,727" onclick="add_key('G')">
|
||||
<area shape="rect" coords="854,727,909,777" onclick="add_key('D')">
|
||||
<area shape="rect" coords="854,777,909,827" onclick="add_key('A')">
|
||||
<area shape="rect" coords="854,827,909,877" onclick="add_key('N')">
|
||||
<area shape="rect" coords="854,877,909,927" onclick="add_key('V')">
|
||||
<area shape="rect" coords="854,927,909,977" onclick="add_key('X')">
|
||||
<area shape="rect" coords="849,453,904,503" onclick="add_key('Y')">
|
||||
<area shape="rect" coords="849,503,904,553" onclick="add_key('R')">
|
||||
<area shape="rect" coords="849,553,904,603" onclick="add_key('W')">
|
||||
<area shape="rect" coords="849,603,904,653" onclick="add_key('J')">
|
||||
<area shape="rect" coords="849,653,904,703" onclick="add_key('G')">
|
||||
<area shape="rect" coords="849,703,904,753" onclick="add_key('D')">
|
||||
<area shape="rect" coords="849,753,904,803" onclick="add_key('A')">
|
||||
<area shape="rect" coords="849,803,904,853" onclick="add_key('N')">
|
||||
<area shape="rect" coords="849,853,904,903" onclick="add_key('V')">
|
||||
<area shape="rect" coords="849,903,904,953" onclick="add_key('X')">
|
||||
</map>
|
||||
</div>
|
||||
<div id="code-wrapper">
|
||||
@@ -277,7 +277,7 @@
|
||||
<option value="none">普通</option>
|
||||
<option value="*">附点音符</option>
|
||||
<option value=".">连音</option>
|
||||
<option value="&">连音(末尾)</option>
|
||||
<option value="$">连音(末尾)</option>
|
||||
<option value="#">装饰音·倚音</option>
|
||||
</select>
|
||||
<label for="dropdown_all" class="textarea" style="display: none;" id="dropdown_all_text">连音总时值: </label>
|
||||
@@ -332,6 +332,13 @@
|
||||
|
||||
const fileInput = document.getElementById('file_input');
|
||||
const readButton = document.getElementById('read_button');
|
||||
const textArea = document.getElementById("code-area");
|
||||
|
||||
// 代码文本框自动滚动到底部
|
||||
textArea.addEventListener("input", () => {
|
||||
textArea.scrollTop = textArea.scrollHeight;
|
||||
});
|
||||
|
||||
|
||||
/*设置连音时值下拉菜单的可见性和音符时值文本*/
|
||||
dropdownType.addEventListener('change', function() {
|
||||
@@ -371,62 +378,45 @@
|
||||
function add_key(key) {
|
||||
const regex_note = /(^|(?<=\])|(?<=\n))[^][^\n]*(?=\[\])/g; // 匹配空音符A[]或(AD)[]
|
||||
const codeArea = document.getElementById('code-area');
|
||||
const textArea = document.getElementById('code-area'); // 用于滚动
|
||||
let content = codeArea.value;
|
||||
let matches = content.match(regex_note);
|
||||
if (matches !== null && matches.length > 1) { // 异常操作检测
|
||||
alert(`存在的未完成的音符大于一个,无法添加新的音符(目前存在的所有未完成音符数: ${matches.length})`);
|
||||
if (matches !== null && matches.length > 1) { // 异常操作检测(可能用不到)
|
||||
alert(`存在的未完成的音符数大于一个,无法添加新的音符(目前存在的所有未完成音符数: ${matches.length})`);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (content.endsWith("[]")) { // 添加为和弦
|
||||
if (content[content.length - 3] === ")") {
|
||||
if (content[content.length - 3] === ")") { // 已是和弦
|
||||
const left_index = content.lastIndexOf("(");
|
||||
const right_index = content.lastIndexOf(")");
|
||||
|
||||
const string_mid = content.substring(left_index, right_index);
|
||||
if (string_mid.includes(key)) {
|
||||
if (string_mid.includes(key)) { // 重复音不添加
|
||||
return null;
|
||||
}
|
||||
content = `${content.substring(0, left_index)}${string_mid}${key}${content.substring(right_index)}`;
|
||||
} else {
|
||||
} else { // 仍为单音
|
||||
const ori_key_index = content.lastIndexOf("[") - 1;
|
||||
if (content[ori_key_index] === key) {
|
||||
if (content[ori_key_index] === key) { // 重复音不添加
|
||||
return null;
|
||||
}
|
||||
content = `${content.substring(0, ori_key_index)}(${content[ori_key_index]}${key})[]`;
|
||||
}
|
||||
// // 取正则匹配的最后一个
|
||||
// matches = matches[matches.length - 1];
|
||||
// if (!matches.includes(key)) { // 和弦不能有重复的音符
|
||||
// if (matches.endsWith(")")) {
|
||||
// matches = `${matches.slice(0, -1)}${key})`;
|
||||
// } else {
|
||||
// if (matches.startsWith("\n\n")) {
|
||||
// matches = `\n(${matches.replace(/\n/g, "")}${key})`;
|
||||
// } else if (matches.startsWith("\n")) {
|
||||
// matches = `\n(${matches.replace(/\n/g, "")}${key})`;
|
||||
// } else if (content.length === 3){
|
||||
// matches = `(${matches}${key})`;
|
||||
// } else {
|
||||
// `${matches.slice(0, -3)}(${matches[-1]}${key})[]`;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// content = content.replace(regex_note, matches);
|
||||
codeArea.value = content;
|
||||
} else { // 添加新的音
|
||||
content += key + "[]";
|
||||
codeArea.value = content;
|
||||
}
|
||||
// 滚动到底部
|
||||
textArea.scrollTop = textArea.scrollHeight;
|
||||
}
|
||||
|
||||
/*点击按钮添加分节标志*/
|
||||
function new_bar() {
|
||||
const regex_note = /(^|(?<=\])|(?<=\n))[^][^\n]*(?=\[\])/g; // 匹配空音符A[]或(AD)[]
|
||||
const codeArea = document.getElementById('code-area');
|
||||
const textArea = document.getElementById('code-area'); // 用于滚动
|
||||
let content = codeArea.value;
|
||||
if (regex_note.test(content)) {
|
||||
alert(`存在未完成的音符!`);
|
||||
@@ -437,6 +427,8 @@
|
||||
}
|
||||
content += "|\n";
|
||||
codeArea.value = content;
|
||||
// 滚动到底部
|
||||
textArea.scrollTop = textArea.scrollHeight;
|
||||
|
||||
}
|
||||
|
||||
@@ -444,6 +436,7 @@
|
||||
function new_line() {
|
||||
const regex_note = /(^|(?<=\])|(?<=\n))[^][^\n]*(?=\[\])/g; // 匹配空音符A[]或(AD)[]
|
||||
const codeArea = document.getElementById('code-area');
|
||||
const textArea = document.getElementById('code-area'); // 用于滚动
|
||||
let content = codeArea.value;
|
||||
if (regex_note.test(content)) {
|
||||
alert(`存在未完成的音符!`);
|
||||
@@ -454,6 +447,8 @@
|
||||
}
|
||||
content += "|\n\n";
|
||||
codeArea.value = content;
|
||||
// 滚动到底部
|
||||
codeArea.scrollTop = textArea.scrollHeight;
|
||||
}
|
||||
|
||||
/*根据所选完善音符*/
|
||||
@@ -556,7 +551,7 @@
|
||||
reader.onload = function(event) {
|
||||
const content = event.target.result; // 文件内容
|
||||
const content_msg = get_music_msg(content); // 解析后的文件内容
|
||||
|
||||
// 将本地乐谱文件载入HTML
|
||||
scoreName.value = content_msg["name"];
|
||||
scoreAuthor.value = content_msg["author"];
|
||||
scoreBpm.value = content_msg["bpm"];
|
||||
@@ -592,7 +587,8 @@
|
||||
let regex_arranger = /(?<="arranger": ")[\s\S]*?(?=")/
|
||||
let regex_notes = /(?<="notes": ")[\s\S]*?(?=")/
|
||||
|
||||
let regex_blank = /[\\\\n]{2}/g
|
||||
let regex_blank_1 = /[\\\\n]{1}/g
|
||||
let regex_blank_2 = /[\\\\n]{2}/g
|
||||
try {
|
||||
// 歌曲名
|
||||
music_msg_dic["name"] = file_text.match(regex_name)[0];
|
||||
@@ -609,7 +605,7 @@
|
||||
// 谱师
|
||||
music_msg_dic["arranger"] = file_text.match(regex_arranger)[0];
|
||||
// 曲谱内容(删除换行符)
|
||||
music_msg_dic["notes"] = file_text.match(regex_notes)[0].replace(/[\\\\n]{3}/g, "\n").replace(/[\\\\n]{2}/g, "\n\n");
|
||||
music_msg_dic["notes"] = file_text.match(regex_notes)[0].replace(regex_blank_2, "\n").replace(regex_blank_1, "");
|
||||
|
||||
} catch(error) {
|
||||
alert(`曲谱解析错误:${error}\n请检查曲谱文件格式是否正确`);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Reference in new issue
Block a user