123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- const names = `- (23) 打击乐
- - 112 Tinkle Bell 叮当铃
- - 113 Agogo 阿哥哥铃
- - 114 Steel Drums 钢鼓
- - 115 Woodblock木鱼
- - 116 Taiko Drum 太鼓
- - 117 Melodic Tom 通通鼓
- - 118 Synth Drum 合成鼓
- - 119 Reverse Cymbal 铜钹
- - 35 Acoustic Bass Drum 大鼓 2
- - 36 Bass Drum 1 大鼓 1
- - 37 Side Stick 小鼓鼓边
- - 38 Acoustic Snare 小鼓 1
- - 39 Hand Clap 拍手
- - 40 Electric Snare 小鼓 2
- - 41 Low Floor Tom 低音鼓 2
- - 42 Closed Hi-Hat 闭合钹
- - 43 High Floor Tom 低音鼓 1
- - 44 Pedal Hi-Hat 脚踏钹
- - 45 Low Tom 中音鼓 2
- - 46 Open Hi-Hat 强音钹
- - 47 Low-Mid Tom 中音鼓 1
- - 48 Hi Mid Tom 2 高音鼓 2
- - 49 Crash Cymbal 1 强音钹 1
- - 50 High Tom 高音鼓 1
- - 51 Ride Cymbal 1 打点钹 1
- - 52 Chinese Cymbal 钹
- - 53 Ride Bell 圆铃
- - 54 Tambourine 铃鼓
- - 55 Splash Cymbal 小钹铜钹
- - 56 Cowbell 牛铃
- - 57 Crash Cymbal 2 强音钹 2
- - 58 Vibra-Slap 颤音器
- - 59 Ride Cymbal 2 打点钹 2
- - 60 Hi Bongo 高音邦加鼓
- - 61 Low Bongo 低音邦加鼓
- - 62 Mute Hi Conga 弱音高音康加鼓
- - 63 Open Hi Conga 强音高音康加鼓
- - 64 Low Conga 低音康加鼓
- - 65 High Timbale 高音天巴鼓
- - 66 Low Timbale 低音天巴鼓
- - 67 High Agogo 高音阿哥哥
- - 68 Low Agogo 低音阿哥哥
- - 69 Cabasa 串珠
- - 70 Maracas 沙铃
- - 71 Short Whistle 短口哨
- - 72 Long Whistle 长口哨
- - 73 Short Guiro 短刮壶
- - 74 Long Guiro 长刮壶
- - 75 Claves 梆子
- - 76 Hi Wood Block 高音木块
- - 77 Low Wood Block 低音木块
- - 78 Mute Cuica
- - 79 Open Cuica
- - 80 Mute Triangle 弱音三角铁
- - 81 Open Triangle 强音三角铁
- - Snare Drum 小军鼓
- - Cymbal 镲
- - Cymbals 镲
- - Triangle 三角铁
- - Vibrato 颤音琴
- - Suspend Cymbal 吊镲
- - Tom-Toms 嗵嗵鼓
- - Bell 铃铛
- - Bells 铃铛
- - crash cymbals 对镲
- - Suspend cymbals 吊镲
- - Castanets 响板
- - (6) 萨克斯
- - 64 Soprano Sax 高音萨克斯风
- - 65 Alto Sax 中音萨克斯风
- - 66 Tenor Sax 次中音萨克斯风
- - 67 Baritone Sax 低音萨克斯风
- - Soprano Saxophone 高音萨克斯风
- - Alto Saxophone 中音萨克斯风
- - Tenor Saxophone 次中音萨克斯风
- - Baritone Saxophone 低音萨克斯风
- - (4) 单簧管(黑管)
- - Clarinet 单簧管(黑管)
- - Alto Clarinet 中音单簧管
- - (12) 小号
- - 56 Trumpet 小号
- - 59 Muted Trumpet 加弱音器小号
- - (13) 圆号
- - Horn in F 圆号
- - French Horn 圆号
- - (14) Trombone 长号
- - (17) Tuba 大号
- - (Oboe) Oboe 双簧管
- - (English Horn) English Horn 英国管
- - (Bassoon) Bassoon 巴松(大管)
- - (4) Clarinet 单簧管(黑管)
- - (120) Piccolo 短笛
- - (2) Flute 长笛
- - (Recorder) Recorder 竖笛
- - (15) Euphonium 上低音号
- - (134) ocarina 陶笛
- - (135) Pan Flute 排箫
- - (136) Hulusi flute 葫芦丝
- - (137) Melodica 口风琴`.trim()
- const fs = require('fs')
- const path = require('path')
- const parseNames = names.split('\n')
- const data = {}
- let parentIndex = 0
- for (let index = 0; index < parseNames.length; index++) {
- const parse = parseNames[index];
- if (parse) {
- const indexOf = parse.indexOf(' ')
- if (indexOf === -1) {
- data[parse] = []
- parentIndex = index
- } else if (indexOf === 0) {
- data[parseNames[parentIndex]].push(parse)
- }
- }
- }
- const formatValue = str => {
- const match = str.trim().match(/( [ a-zA-Z-]+ )/ig)
- if (!match) return ''
- return match.map(item => item.trim()).join(' ').trim()
- }
- const json = {}
- let allvalue = []
- for (const key in data) {
- if (Object.hasOwnProperty.call(data, key)) {
- // const value = data[key]
- const name = key.match(/([\w]+\s?[\w]*)/ig)[0]
- // console.log(name)
- json[name] = []
- if (data[key].length) {
- for (let index = 0; index < data[key].length; index++) {
- const item = data[key][index]
- json[name].push(formatValue(item))
- }
- } else {
- // console.log(formatValue(key))
- json[name].push(formatValue(key))
- allvalue = allvalue.concat(formatValue(key))
- }
- allvalue = allvalue.concat(json[name])
- }
- }
- // console.log(allvalue)
- const filepath = path.resolve(__dirname, '../src/constant/instrumentsClassfiy.ts')
- const instruments = JSON.parse(fs.readFileSync(path.resolve(filepath, '../instruments.ts')).toString().replace('export default ', ''))
- const other = []
- for (const key in instruments) {
- if (Object.hasOwnProperty.call(instruments, key)) {
- // const value = instruments[key];
- // console.log(key, value, allvalue.includes(key))
- if (!allvalue.includes(key)) {
- // console.log(key, value)
- other.push(key)
- }
- }
- }
- json['DYOther'] = other
- fs.writeFileSync(filepath, `export default ${JSON.stringify(json, null, 2)}`)
- // console.log(json)
|