classfiyNames.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. const names = `- (23) 打击乐
  2. - 112 Tinkle Bell 叮当铃
  3. - 113 Agogo 阿哥哥铃
  4. - 114 Steel Drums 钢鼓
  5. - 115 Woodblock木鱼
  6. - 116 Taiko Drum 太鼓
  7. - 117 Melodic Tom 通通鼓
  8. - 118 Synth Drum 合成鼓
  9. - 119 Reverse Cymbal 铜钹
  10. - 35 Acoustic Bass Drum 大鼓 2
  11. - 36 Bass Drum 1 大鼓 1
  12. - 37 Side Stick 小鼓鼓边
  13. - 38 Acoustic Snare 小鼓 1
  14. - 39 Hand Clap 拍手
  15. - 40 Electric Snare 小鼓 2
  16. - 41 Low Floor Tom 低音鼓 2
  17. - 42 Closed Hi-Hat 闭合钹
  18. - 43 High Floor Tom 低音鼓 1
  19. - 44 Pedal Hi-Hat 脚踏钹
  20. - 45 Low Tom 中音鼓 2
  21. - 46 Open Hi-Hat 强音钹
  22. - 47 Low-Mid Tom 中音鼓 1
  23. - 48 Hi Mid Tom 2 高音鼓 2
  24. - 49 Crash Cymbal 1 强音钹 1
  25. - 50 High Tom 高音鼓 1
  26. - 51 Ride Cymbal 1 打点钹 1
  27. - 52 Chinese Cymbal 钹
  28. - 53 Ride Bell 圆铃
  29. - 54 Tambourine 铃鼓
  30. - 55 Splash Cymbal 小钹铜钹
  31. - 56 Cowbell 牛铃
  32. - 57 Crash Cymbal 2 强音钹 2
  33. - 58 Vibra-Slap 颤音器
  34. - 59 Ride Cymbal 2 打点钹 2
  35. - 60 Hi Bongo 高音邦加鼓
  36. - 61 Low Bongo 低音邦加鼓
  37. - 62 Mute Hi Conga 弱音高音康加鼓
  38. - 63 Open Hi Conga 强音高音康加鼓
  39. - 64 Low Conga 低音康加鼓
  40. - 65 High Timbale 高音天巴鼓
  41. - 66 Low Timbale 低音天巴鼓
  42. - 67 High Agogo 高音阿哥哥
  43. - 68 Low Agogo 低音阿哥哥
  44. - 69 Cabasa 串珠
  45. - 70 Maracas 沙铃
  46. - 71 Short Whistle 短口哨
  47. - 72 Long Whistle 长口哨
  48. - 73 Short Guiro 短刮壶
  49. - 74 Long Guiro 长刮壶
  50. - 75 Claves 梆子
  51. - 76 Hi Wood Block 高音木块
  52. - 77 Low Wood Block 低音木块
  53. - 78 Mute Cuica
  54. - 79 Open Cuica
  55. - 80 Mute Triangle 弱音三角铁
  56. - 81 Open Triangle 强音三角铁
  57. - Snare Drum 小军鼓
  58. - Cymbal 镲
  59. - Cymbals 镲
  60. - Triangle 三角铁
  61. - Vibrato 颤音琴
  62. - Suspend Cymbal 吊镲
  63. - Tom-Toms 嗵嗵鼓
  64. - Bell 铃铛
  65. - Bells 铃铛
  66. - crash cymbals 对镲
  67. - Suspend cymbals 吊镲
  68. - Castanets 响板
  69. - (6) 萨克斯
  70. - 64 Soprano Sax 高音萨克斯风
  71. - 65 Alto Sax 中音萨克斯风
  72. - 66 Tenor Sax 次中音萨克斯风
  73. - 67 Baritone Sax 低音萨克斯风
  74. - Soprano Saxophone 高音萨克斯风
  75. - Alto Saxophone 中音萨克斯风
  76. - Tenor Saxophone 次中音萨克斯风
  77. - Baritone Saxophone 低音萨克斯风
  78. - (4) 单簧管(黑管)
  79. - Clarinet 单簧管(黑管)
  80. - Alto Clarinet 中音单簧管
  81. - (12) 小号
  82. - 56 Trumpet 小号
  83. - 59 Muted Trumpet 加弱音器小号
  84. - (13) 圆号
  85. - Horn in F 圆号
  86. - French Horn 圆号
  87. - (14) Trombone 长号
  88. - (17) Tuba 大号
  89. - (Oboe) Oboe 双簧管
  90. - (English Horn) English Horn 英国管
  91. - (Bassoon) Bassoon 巴松(大管)
  92. - (4) Clarinet 单簧管(黑管)
  93. - (120) Piccolo 短笛
  94. - (2) Flute 长笛
  95. - (Recorder) Recorder 竖笛
  96. - (15) Euphonium 上低音号
  97. - (134) ocarina 陶笛
  98. - (135) Pan Flute 排箫
  99. - (136) Hulusi flute 葫芦丝
  100. - (137) Melodica 口风琴`.trim()
  101. const fs = require('fs')
  102. const path = require('path')
  103. const parseNames = names.split('\n')
  104. const data = {}
  105. let parentIndex = 0
  106. for (let index = 0; index < parseNames.length; index++) {
  107. const parse = parseNames[index];
  108. if (parse) {
  109. const indexOf = parse.indexOf(' ')
  110. if (indexOf === -1) {
  111. data[parse] = []
  112. parentIndex = index
  113. } else if (indexOf === 0) {
  114. data[parseNames[parentIndex]].push(parse)
  115. }
  116. }
  117. }
  118. const formatValue = str => {
  119. const match = str.trim().match(/( [ a-zA-Z-]+ )/ig)
  120. if (!match) return ''
  121. return match.map(item => item.trim()).join(' ').trim()
  122. }
  123. const json = {}
  124. let allvalue = []
  125. for (const key in data) {
  126. if (Object.hasOwnProperty.call(data, key)) {
  127. // const value = data[key]
  128. const name = key.match(/([\w]+\s?[\w]*)/ig)[0]
  129. // console.log(name)
  130. json[name] = []
  131. if (data[key].length) {
  132. for (let index = 0; index < data[key].length; index++) {
  133. const item = data[key][index]
  134. json[name].push(formatValue(item))
  135. }
  136. } else {
  137. // console.log(formatValue(key))
  138. json[name].push(formatValue(key))
  139. allvalue = allvalue.concat(formatValue(key))
  140. }
  141. allvalue = allvalue.concat(json[name])
  142. }
  143. }
  144. // console.log(allvalue)
  145. const filepath = path.resolve(__dirname, '../src/constant/instrumentsClassfiy.ts')
  146. const instruments = JSON.parse(fs.readFileSync(path.resolve(filepath, '../instruments.ts')).toString().replace('export default ', ''))
  147. const other = []
  148. for (const key in instruments) {
  149. if (Object.hasOwnProperty.call(instruments, key)) {
  150. // const value = instruments[key];
  151. // console.log(key, value, allvalue.includes(key))
  152. if (!allvalue.includes(key)) {
  153. // console.log(key, value)
  154. other.push(key)
  155. }
  156. }
  157. }
  158. json['DYOther'] = other
  159. fs.writeFileSync(filepath, `export default ${JSON.stringify(json, null, 2)}`)
  160. // console.log(json)