abcjs 6.0.0-beta.9 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/.github/workflows/tests.yml +29 -0
  2. package/CODE_OF_CONDUCT.md +76 -0
  3. package/CONTRIBUTING.md +1 -0
  4. package/LICENSE.md +1 -1
  5. package/README.md +88 -7
  6. package/RELEASE.md +961 -1
  7. package/abcjs-audio.css +14 -5
  8. package/dist/.gitignore +1 -2
  9. package/dist/abcjs-basic-min.js +3 -0
  10. package/dist/abcjs-basic-min.js.LICENSE +23 -0
  11. package/dist/abcjs-basic.js +28232 -0
  12. package/dist/abcjs-basic.js.map +1 -0
  13. package/dist/abcjs-plugin-min.js +3 -0
  14. package/dist/abcjs-plugin-min.js.LICENSE +23 -0
  15. package/index.js +27 -2
  16. package/{static-wrappers/license.js → license.js} +1 -1
  17. package/package.json +26 -29
  18. package/{src/plugin/abc_plugin.js → plugin.js} +31 -19
  19. package/src/api/abc_animation.js +1 -17
  20. package/src/api/abc_tablatures.js +144 -0
  21. package/src/api/abc_timing_callbacks.js +216 -117
  22. package/src/api/abc_tunebook.js +18 -67
  23. package/src/api/abc_tunebook_svg.js +40 -48
  24. package/src/data/abc_tune.js +232 -972
  25. package/src/data/deline-tune.js +199 -0
  26. package/src/edit/abc_editarea.js +112 -0
  27. package/src/edit/abc_editor.js +95 -221
  28. package/src/midi/abc_midi_create.js +48 -50
  29. package/src/parse/abc_common.js +0 -14
  30. package/src/parse/abc_parse.js +167 -1321
  31. package/src/parse/abc_parse_book.js +62 -0
  32. package/src/parse/abc_parse_directive.js +164 -41
  33. package/src/parse/abc_parse_header.js +116 -145
  34. package/src/parse/abc_parse_key_voice.js +26 -20
  35. package/src/parse/abc_parse_music.js +1337 -0
  36. package/src/parse/abc_tokenizer.js +21 -15
  37. package/src/parse/abc_transpose.js +3 -15
  38. package/src/parse/tune-builder.js +896 -0
  39. package/src/parse/wrap_lines.js +205 -453
  40. package/src/synth/abc_midi_flattener.js +1292 -0
  41. package/src/{midi → synth}/abc_midi_renderer.js +44 -17
  42. package/src/synth/abc_midi_sequencer.js +648 -0
  43. package/src/synth/active-audio-context.js +3 -14
  44. package/src/synth/cents-to-factor.js +10 -0
  45. package/src/synth/create-note-map.js +21 -32
  46. package/src/synth/create-synth-control.js +20 -103
  47. package/src/synth/create-synth.js +185 -77
  48. package/src/synth/download-buffer.js +7 -21
  49. package/src/synth/get-midi-file.js +13 -20
  50. package/src/synth/images/{loading.svg → loading.svg.js} +4 -0
  51. package/src/synth/images/loop.svg.js +65 -0
  52. package/src/synth/images/pause.svg.js +10 -0
  53. package/src/synth/images/play.svg.js +9 -0
  54. package/src/synth/images/{reset.svg → reset.svg.js} +5 -1
  55. package/src/synth/instrument-index-to-name.js +1 -16
  56. package/src/synth/load-note.js +37 -76
  57. package/src/synth/pitch-to-note-name.js +0 -15
  58. package/src/synth/pitches-to-perc.js +64 -0
  59. package/src/synth/place-note.js +78 -68
  60. package/src/synth/play-event.js +17 -18
  61. package/src/synth/register-audio-context.js +11 -23
  62. package/src/synth/sounds-cache.js +0 -15
  63. package/src/synth/supports-audio.js +9 -23
  64. package/src/synth/synth-controller.js +80 -49
  65. package/src/synth/synth-sequence.js +20 -34
  66. package/src/tablatures/instruments/guitar/guitar-fonts.js +19 -0
  67. package/src/tablatures/instruments/guitar/guitar-patterns.js +23 -0
  68. package/src/tablatures/instruments/guitar/tab-guitar.js +50 -0
  69. package/src/tablatures/instruments/string-patterns.js +277 -0
  70. package/src/tablatures/instruments/string-tablature.js +56 -0
  71. package/src/tablatures/instruments/tab-note.js +282 -0
  72. package/src/tablatures/instruments/tab-notes.js +41 -0
  73. package/src/tablatures/instruments/violin/tab-violin.js +47 -0
  74. package/src/tablatures/instruments/violin/violin-fonts.js +19 -0
  75. package/src/tablatures/instruments/violin/violin-patterns.js +23 -0
  76. package/src/tablatures/tab-absolute-elements.js +310 -0
  77. package/src/tablatures/tab-common.js +29 -0
  78. package/src/tablatures/tab-renderer.js +243 -0
  79. package/src/tablatures/transposer.js +110 -0
  80. package/src/test/abc_midi_lint.js +5 -22
  81. package/src/test/abc_midi_sequencer_lint.js +11 -14
  82. package/src/test/abc_parser_lint.js +136 -32
  83. package/src/test/abc_vertical_lint.js +94 -32
  84. package/src/test/rendering-lint.js +38 -5
  85. package/src/write/abc_absolute_element.js +112 -120
  86. package/src/write/abc_abstract_engraver.js +102 -253
  87. package/src/write/abc_beam_element.js +30 -290
  88. package/src/write/abc_brace_element.js +12 -121
  89. package/src/write/abc_create_clef.js +21 -32
  90. package/src/write/abc_create_key_signature.js +8 -26
  91. package/src/write/abc_create_note_head.js +107 -0
  92. package/src/write/abc_create_time_signature.js +2 -21
  93. package/src/write/abc_crescendo_element.js +3 -50
  94. package/src/write/abc_decoration.js +7 -30
  95. package/src/write/abc_dynamic_decoration.js +3 -37
  96. package/src/write/abc_ending_element.js +1 -57
  97. package/src/write/abc_engraver_controller.js +111 -234
  98. package/src/write/abc_glyphs.js +8 -18
  99. package/src/write/abc_relative_element.js +57 -97
  100. package/src/write/abc_renderer.js +10 -832
  101. package/src/write/abc_spacing.js +0 -15
  102. package/src/write/abc_staff_group_element.js +14 -349
  103. package/src/write/abc_tempo_element.js +9 -117
  104. package/src/write/abc_tie_element.js +5 -68
  105. package/src/write/abc_triplet_element.js +6 -124
  106. package/src/write/abc_voice_element.js +7 -222
  107. package/src/write/add-chord.js +103 -0
  108. package/src/write/add-text-if.js +33 -0
  109. package/src/write/bottom-text.js +79 -0
  110. package/src/write/calcHeight.js +17 -0
  111. package/src/write/classes.js +100 -0
  112. package/src/write/draw/absolute.js +68 -0
  113. package/src/write/draw/beam.js +56 -0
  114. package/src/write/draw/brace.js +106 -0
  115. package/src/write/draw/crescendo.js +38 -0
  116. package/src/write/draw/debug-box.js +8 -0
  117. package/src/write/draw/draw.js +56 -0
  118. package/src/write/draw/dynamics.js +20 -0
  119. package/src/write/draw/ending.js +46 -0
  120. package/src/write/draw/group-elements.js +66 -0
  121. package/src/write/draw/horizontal-line.js +25 -0
  122. package/src/write/draw/non-music.js +50 -0
  123. package/src/write/draw/print-line.js +24 -0
  124. package/src/write/draw/print-path.js +7 -0
  125. package/src/write/draw/print-stem.js +30 -0
  126. package/src/write/draw/print-symbol.js +59 -0
  127. package/src/write/draw/print-vertical-line.js +18 -0
  128. package/src/write/draw/relative.js +77 -0
  129. package/src/write/draw/round-number.js +5 -0
  130. package/src/write/draw/selectables.js +59 -0
  131. package/src/write/draw/separator.js +16 -0
  132. package/src/write/draw/set-paper-size.js +45 -0
  133. package/src/write/{sprintf.js → draw/sprintf.js} +0 -0
  134. package/src/write/draw/staff-group.js +226 -0
  135. package/src/write/draw/staff-line.js +9 -0
  136. package/src/write/draw/staff.js +33 -0
  137. package/src/write/draw/tab-line.js +40 -0
  138. package/src/write/draw/tempo.js +45 -0
  139. package/src/write/draw/text.js +71 -0
  140. package/src/write/draw/tie.js +97 -0
  141. package/src/write/draw/triplet.js +46 -0
  142. package/src/write/draw/voice.js +102 -0
  143. package/src/write/format-jazz-chord.js +15 -0
  144. package/src/write/free-text.js +41 -0
  145. package/src/write/get-font-and-attr.js +37 -0
  146. package/src/write/get-text-size.js +56 -0
  147. package/src/write/highlight.js +11 -0
  148. package/src/write/layout/VoiceElements.js +121 -0
  149. package/src/write/layout/beam.js +213 -0
  150. package/src/write/layout/get-left-edge-of-staff.js +56 -0
  151. package/src/write/layout/getBarYAt.js +6 -0
  152. package/src/write/layout/layout.js +94 -0
  153. package/src/write/layout/setUpperAndLowerElements.js +232 -0
  154. package/src/write/layout/staffGroup.js +146 -0
  155. package/src/write/layout/triplet.js +75 -0
  156. package/src/write/layout/voice.js +137 -0
  157. package/src/write/selection.js +188 -70
  158. package/src/write/separator.js +10 -0
  159. package/src/write/set-class.js +21 -0
  160. package/src/write/subtitle.js +12 -0
  161. package/src/write/svg.js +95 -43
  162. package/src/write/top-text.js +54 -0
  163. package/src/write/unhighlight.js +11 -0
  164. package/test.js +27 -64
  165. package/types/index.d.ts +1095 -0
  166. package/version.js +1 -1
  167. package/.babelrc +0 -5
  168. package/.eslintrc +0 -3
  169. package/.gitmodules +0 -3
  170. package/Dockerfile +0 -8
  171. package/abcjs-midi.css +0 -166
  172. package/build-utils/loadPresets.js +0 -14
  173. package/build-utils/presets/webpack.analyze.js +0 -6
  174. package/build-utils/presets/webpack.optimize.js +0 -30
  175. package/build-utils/webpack.development.js +0 -14
  176. package/build-utils/webpack.production.js +0 -35
  177. package/deploy-docs.sh +0 -25
  178. package/docker-compose.yml +0 -13
  179. package/docs/README.md +0 -33
  180. package/fix-versions.sh +0 -23
  181. package/midi.js +0 -62
  182. package/src/api/abc_tunebook_midi.js +0 -116
  183. package/src/midi/abc_midi_controls.js +0 -701
  184. package/src/midi/abc_midi_flattener.js +0 -1119
  185. package/src/midi/abc_midi_js_preparer.js +0 -243
  186. package/src/midi/abc_midi_sequencer.js +0 -401
  187. package/src/midi/abc_midi_ui_generator.js +0 -86
  188. package/src/plugin/abc_plugin_midi.js +0 -220
  189. package/src/synth/images/loop.svg +0 -61
  190. package/src/synth/images/pause.svg +0 -6
  191. package/src/synth/images/play.svg +0 -5
  192. package/src/transform/abc2abc_write.js +0 -395
  193. package/static-wrappers/basic.js +0 -2
  194. package/static-wrappers/midi.js +0 -2
  195. package/static-wrappers/plugin-midi.js +0 -6
  196. package/static-wrappers/plugin.js +0 -6
  197. package/webpack.config.js +0 -29
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
- var version = '6.0.0-beta.9';
1
+ var version = '6.0.2';
2
2
 
3
3
  module.exports = version;
package/.babelrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "presets": [
3
- "@babel/preset-env"
4
- ]
5
- }
package/.eslintrc DELETED
@@ -1,3 +0,0 @@
1
- "parserOptions": {
2
- "ecmaVersion": 5
3
- }
package/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "docs/.vuepress/dist"]
2
- path = docs/.vuepress/dist
3
- url = git@github.com:paulrosen/abcjs.git
package/Dockerfile DELETED
@@ -1,8 +0,0 @@
1
- FROM node
2
-
3
- RUN mkdir /srv/app && chown node:node /srv/app
4
-
5
- USER node
6
-
7
- WORKDIR /srv/app
8
-
package/abcjs-midi.css DELETED
@@ -1,166 +0,0 @@
1
- /* Some basic CSS to make the MIDI controls in abcjs presentable. */
2
-
3
- .abcjs-inline-midi {
4
- height: 26px;
5
- padding: 0 5px;
6
- border-radius: 3px;
7
- color: #f4f4f4;
8
- background-color: #424242;
9
- display: flex;
10
- align-items: center;
11
- box-sizing: border-box;
12
- }
13
-
14
- .abcjs-inline-midi .abcjs-btn {
15
- width: 28px;
16
- height: 26px;
17
- display: inline-block;
18
- margin-right: 2px;
19
- float: left;
20
- padding: 0;
21
-
22
- background: none;
23
- font: normal normal normal 14px/1 FontAwesome;
24
- font-size: 14px;
25
- text-rendering: auto;
26
- -webkit-font-smoothing: antialiased;
27
- -moz-osx-font-smoothing: grayscale;
28
- color: #f4f4f4;
29
- border: 1px solid transparent;
30
- box-sizing: border-box;
31
- }
32
-
33
- .fa5 .abcjs-inline-midi .abcjs-btn {
34
- font-family: "Font Awesome 5 Free";
35
- font-weight: 900;
36
- }
37
- .abcjs-inline-midi .abcjs-btn:hover {
38
- color: #cccccc;
39
- }
40
-
41
- .abcjs-inline-midi .abcjs-midi-selection:before {
42
- content: "\f07e"; /* fa-arrows-h [] */
43
- }
44
-
45
- .abcjs-inline-midi .abcjs-midi-selection.abcjs-pushed {
46
- border: 1px solid #cccccc;
47
- background-color: #666666;
48
- box-sizing: border-box;
49
- }
50
-
51
- .abcjs-inline-midi .abcjs-midi-loop:before {
52
- content: "\f021"; /* fa-refresh [] */
53
- }
54
-
55
- .abcjs-inline-midi .abcjs-midi-loop.abcjs-pushed {
56
- border: 1px solid #cccccc;
57
- background-color: #666666;
58
- box-sizing: border-box;
59
- }
60
-
61
- .abcjs-inline-midi .abcjs-midi-reset:before {
62
- content: "\f048"; /* fa-step-backward [] */
63
- }
64
-
65
- .abcjs-inline-midi .abcjs-midi-reset.abcjs-pushed {
66
- border: 1px solid #cccccc;
67
- background-color: #666666;
68
- box-sizing: border-box;
69
- }
70
-
71
- .abcjs-inline-midi .abcjs-midi-start:before {
72
- content: "\f04b"; /* fa-play [] fa-pause [] */
73
- }
74
-
75
- .abcjs-inline-midi .abcjs-midi-start.abcjs-pushed:before {
76
- content: "\f04c"; /* fa-play [] fa-pause [] */
77
- }
78
-
79
- .abcjs-inline-midi .abcjs-midi-start.abcjs-loading {
80
- outline: none;
81
- animation: a 1s infinite steps(8);
82
- }
83
-
84
- .abcjs-inline-midi .abcjs-midi-start.abcjs-loading:before {
85
- content: "\f110"; /* fa-loading */
86
- }
87
-
88
- .abcjs-inline-midi .abcjs-midi-progress-background {
89
- background-color: #424242;
90
- height: 10px;
91
- border-radius: 5px;
92
- border: 2px solid #cccccc;
93
- margin: 0 8px 0 15px;
94
- position: relative;
95
- flex: 1;
96
- padding: 0;
97
- box-sizing: border-box;
98
- }
99
-
100
- .abcjs-inline-midi .abcjs-midi-progress-indicator {
101
- width: 20px;
102
- margin-left: -10px; /* half of the width */
103
- height: 14px;
104
- background-color: #f4f4f4;
105
- position: absolute;
106
- display: inline-block;
107
- border-radius: 6px;
108
- top: -4px;
109
- left: 0;
110
- box-sizing: border-box;
111
- }
112
-
113
- .abcjs-inline-midi .abcjs-midi-clock, .abcjs-inline-midi .abcjs-midi-post {
114
- margin-left: 4px;
115
- margin-top: 0;
116
- display: inline-block;
117
- font-family: sans-serif;
118
- font-size: 16px;
119
- box-sizing: border-box;
120
- }
121
-
122
- .abcjs-inline-midi .abcjs-midi-pre {
123
- display: inline-block;
124
- box-sizing: border-box;
125
- }
126
-
127
- .abcjs-inline-midi .abcjs-tempo-wrapper {
128
- float: right;
129
- font-size: 10px;
130
- display: inline-block;
131
- color: #f4f4f4;
132
- box-sizing: border-box;
133
- }
134
-
135
- .abcjs-inline-midi .abcjs-midi-tempo {
136
- border-radius: 2px;
137
- border: none;
138
- margin: 1px 2px 0 4px;
139
- width: 32px;
140
- padding-left: 2px;
141
- box-sizing: border-box;
142
- }
143
-
144
- /* Adding the class "abcjs-large" will make the control easier on a touch device. */
145
- .abcjs-large .abcjs-inline-midi {
146
- height: 52px;
147
- }
148
- .abcjs-large .abcjs-btn {
149
- width: 56px;
150
- height: 52px;
151
- font-size: 28px;
152
- }
153
- .abcjs-large .abcjs-midi-progress-background {
154
- height: 20px;
155
- border: 4px solid #cccccc;
156
- }
157
- .abcjs-large .abcjs-midi-progress-indicator {
158
- height: 28px;
159
- top: -8px;
160
- width: 40px;
161
- }
162
- .abcjs-large .abcjs-midi-clock {
163
- font-size: 32px;
164
- margin-right: 10px;
165
- margin-left: 10px;
166
- }
@@ -1,14 +0,0 @@
1
- const webpackMerge = require("webpack-merge");
2
-
3
- const applyPresets = (env = {presets: []}) => {
4
- const presets = env.presets || [];
5
- /** @type {string[]} */
6
- const mergedPresets = [].concat(...[presets]);
7
- const mergedConfigs = mergedPresets.map(presetName =>
8
- require(`./presets/webpack.${presetName}`)(env)
9
- );
10
-
11
- return webpackMerge({}, ...mergedConfigs);
12
- };
13
-
14
- module.exports = applyPresets;
@@ -1,6 +0,0 @@
1
- const WebpackBundleAnalyzer = require("webpack-bundle-analyzer")
2
- .BundleAnalyzerPlugin;
3
-
4
- module.exports = () => ({
5
- plugins: [new WebpackBundleAnalyzer()]
6
- });
@@ -1,30 +0,0 @@
1
- const TerserPlugin = require('terser-webpack-plugin');
2
-
3
- module.exports = ({type} = {}) => ({
4
- optimization: {
5
- minimize: true,
6
- minimizer: [
7
- new TerserPlugin({
8
- extractComments: {
9
- condition: /^\**!/,
10
- banner: makeBanner(type),
11
- },
12
- }),
13
- ],
14
- },
15
- });
16
-
17
- function getVersion() {
18
- const pJson = require('../../package.json');
19
- return pJson.version;
20
- }
21
-
22
- function makeBanner(type) {
23
- const outputFilename = `abcjs_${type}_${getVersion()}-min.js`;
24
- const banner1 = `abcjs_${type} v${getVersion()} Copyright © 2009-2020 Paul Rosen and Gregory Dyke (https://abcjs.net) */`;
25
- const banner2 = `/*! midi.js Copyright © Michael Deal (http://mudcu.be) */`;
26
- const banner3 = `/*! For license information please see ${outputFilename}.LICENSE`;
27
- const hasMidi = type === 'midi';
28
- return hasMidi ? `${banner1}\n${banner2}\n${banner3}` : `${banner1}\n${banner3}`;
29
-
30
- }
@@ -1,14 +0,0 @@
1
- const path = require("path");
2
-
3
- module.exports = ({type}) => ({
4
- devtool: "source-map",
5
- output: {
6
- filename: `abcjs_${type}_${getVersion()}.js`,
7
- path: path.join(__dirname, "../bin")
8
- },
9
- });
10
-
11
- function getVersion() {
12
- const pJson = require('../package.json');
13
- return pJson.version;
14
- }
@@ -1,35 +0,0 @@
1
- const TerserPlugin = require('terser-webpack-plugin');
2
- const path = require("path");
3
-
4
- module.exports = ({type}) => ({
5
- output: {
6
- filename: `abcjs_${type}_${getVersion()}-min.js`,
7
- path: path.join(__dirname, "../bin")
8
- },
9
- optimization: {
10
- minimize: true,
11
- minimizer: [
12
- new TerserPlugin({
13
- extractComments: {
14
- condition: /^\**!/,
15
- banner: makeBanner(type),
16
- },
17
- }),
18
- ],
19
- },
20
- });
21
-
22
- function getVersion() {
23
- const pJson = require('../package.json');
24
- return pJson.version;
25
- }
26
-
27
- function makeBanner(type) {
28
- const outputFilename = `abcjs_${type}_${getVersion()}-min.js`;
29
- const banner1 = `abcjs_${type} v${getVersion()} Copyright © 2009-2020 Paul Rosen and Gregory Dyke (https://abcjs.net) */`;
30
- const banner2 = `/*! midi.js Copyright © Michael Deal (http://mudcu.be) */`;
31
- const banner3 = `/*! For license information please see ${outputFilename}.LICENSE`;
32
- const hasMidi = type === 'midi';
33
- return hasMidi ? `${banner1}\n${banner2}\n${banner3}` : `${banner1}\n${banner3}`;
34
-
35
- }
package/deploy-docs.sh DELETED
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env sh
2
-
3
- # abort on errors
4
- set -e
5
-
6
- # build
7
- npm run docs:build
8
-
9
- # navigate into the build output directory
10
- cd docs/.vuepress/dist
11
-
12
- # if you are deploying to a custom domain
13
- # echo 'www.example.com' > CNAME
14
-
15
- git init
16
- git add -A
17
- git commit -m 'deploy'
18
-
19
- # if you are deploying to https://<USERNAME>.github.io
20
- # git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
21
-
22
- # if you are deploying to https://<USERNAME>.github.io/<REPO>
23
- git push -f git@github.com:paulrosen/abcjs.git master:gh-pages
24
-
25
- cd -
@@ -1,13 +0,0 @@
1
- version: '3.7'
2
-
3
- services:
4
- app:
5
- image: abcjs
6
- build: .
7
- environment:
8
- - "CMD=${CMD}"
9
- container_name: abcjs
10
- command: npm ${CMD}
11
- volumes:
12
- - .:/srv/app
13
- - ./node_modules:/srv/app/node_modules
package/docs/README.md DELETED
@@ -1,33 +0,0 @@
1
- # Javascript library for inserting music in the browser.
2
-
3
- ![abcjs](img/abcjs_comp_extended_08.svg)
4
-
5
- **ABC Music Notation** is a format for specifying sheet music using only a string of characters.
6
- For instance, the following string encodes the music that is shown below it. That music was
7
- drawn by including this library on this webpage.
8
-
9
- ```
10
- X: 1
11
- T: Cooley's
12
- M: 4/4
13
- L: 1/8
14
- K: Emin
15
- |:D2|EB{c}BA B2 EB|~B2 AB dBAG|FDAD BDAD|FDAD dAFD|
16
- EBBA B2 EB|B2 AB defg|afe^c dBAF|DEFD E2:|
17
- |:gf|eB B2 efge|eB B2 gedB|A2 FA DAFA|A2 FA defg|
18
- eB B2 eBgB|eB B2 defg|afe^c dBAF|DEFD E2:|
19
- ```
20
-
21
- <render-abc ref="tune" :abc="`X: 1
22
- T: Cooley's
23
- M: 4/4
24
- L: 1/8
25
- K: Emin
26
- |:D2|EB{c}BA B2 EB|~B2 AB dBAG|FDAD BDAD|FDAD dAFD|
27
- EBBA B2 EB|B2 AB defg|afe^c dBAF|DEFD E2:|
28
- |:gf|eB B2 efge|eB B2 gedB|A2 FA DAFA|A2 FA defg|
29
- eB B2 eBgB|eB B2 defg|afe^c dBAF|DEFD E2:|`" ></render-abc>
30
-
31
- In addition, the music can also be played by a synthesizer:
32
-
33
- <render-audio :obj="$refs"></render-audio>
package/fix-versions.sh DELETED
@@ -1,23 +0,0 @@
1
- #!/bin/sh
2
- die () {
3
- echo >&2 "$@"
4
- exit 1
5
- }
6
-
7
- [ "$#" -eq 1 ] || die "Call with a version number argument in the form x.y.z[-beta.n]"
8
- echo $1 | grep -E -q '^[1-9]+\.[0-9]+\.[0-9]+(-beta.\d)?$' || die "Version number argument required (x.y.z[-beta.n]), $1 provided"
9
-
10
- echo "Fix build files..."
11
- perl -pi -e "s/ v6([^\"]+)/ v$1/" *.js
12
- perl -pi -e "s/\'([^\']+)\'/\'$1\'/" version.js
13
-
14
-
15
- echo "Fix readme..."
16
- perl -pi -e "s/abcjs_(.+)_6([^-]+)-min.js/abcjs_\$1_$1-min.js/" README.md
17
- perl -pi -e "s/abcjs_(.+)_6([^-]+).user.js/abcjs_\$1_$1.user.js/" README.md
18
- perl -pi -e "s/abcjs_(.+)_6([^-]+)-min.js/abcjs_\$1_$1-min.js/" docs/*.md
19
- perl -pi -e "s/abcjs_(.+)_6([^-]+).user.js/abcjs_\$1_$1.user.js/" docs/*.md
20
-
21
- echo "Fix examples..."
22
- perl -pi -e "s/abcjs_(.+)_6([^-]+)-min.js/abcjs_\$1_$1-min.js/" examples/*.html
23
- perl -pi -e "s/abcjs_(.+)_6([^-]+)-min.js/abcjs_\$1_$1-min.js/" examples/plugin/*.html
package/midi.js DELETED
@@ -1,62 +0,0 @@
1
- var version = require('./version');
2
- var animation = require('./src/api/abc_animation');
3
- var tunebook = require('./src/api/abc_tunebook');
4
-
5
- var abcjs = {};
6
-
7
- abcjs.signature = "abcjs-midi v" + version;
8
-
9
- Object.keys(animation).forEach(function (key) {
10
- abcjs[key] = animation[key];
11
- });
12
-
13
- Object.keys(tunebook).forEach(function (key) {
14
- abcjs[key] = tunebook[key];
15
- });
16
-
17
- abcjs.renderAbc = require('./src/api/abc_tunebook_svg');
18
- abcjs.renderMidi = require('./src/api/abc_tunebook_midi');
19
- abcjs.TimingCallbacks = require('./src/api/abc_timing_callbacks');
20
-
21
- var glyphs = require('./src/write/abc_glyphs');
22
- abcjs.setGlyph = glyphs.setSymbol;
23
-
24
- var CreateSynth = require('./src/synth/create-synth');
25
- var instrumentIndexToName = require('./src/synth/instrument-index-to-name');
26
- var pitchToNoteName = require('./src/synth/pitch-to-note-name');
27
- var SynthSequence = require('./src/synth/synth-sequence');
28
- var CreateSynthControl = require('./src/synth/create-synth-control');
29
- var registerAudioContext = require('./src/synth/register-audio-context');
30
- var activeAudioContext = require('./src/synth/active-audio-context');
31
- var playEvent = require('./src/synth/play-event');
32
- var SynthController = require('./src/synth/synth-controller');
33
-
34
- abcjs.synth = {
35
- CreateSynth: CreateSynth,
36
- instrumentIndexToName: instrumentIndexToName,
37
- pitchToNoteName: pitchToNoteName,
38
- SynthController: SynthController,
39
- SynthSequence: SynthSequence,
40
- CreateSynthControl: CreateSynthControl,
41
- registerAudioContext: registerAudioContext,
42
- activeAudioContext: activeAudioContext,
43
- playEvent: playEvent
44
- };
45
-
46
- var editor = require('./src/edit/abc_editor');
47
- abcjs['Editor'] = editor;
48
- require("./src/midi/abc_midi_ui_generator");
49
-
50
- var midi = require('./src/midi/abc_midi_controls');
51
- abcjs.midi = {
52
- setSoundFont: midi.setSoundFont,
53
- startPlaying: midi.startPlaying,
54
- restartPlaying: midi.restartPlaying,
55
- stopPlaying: midi.stopPlaying,
56
- setLoop: midi.setLoop,
57
- deviceSupportsMidi: midi.deviceSupportsMidi,
58
- setRandomProgress: midi.setRandomProgress,
59
- setInteractiveProgressBar: midi.setInteractiveProgressBar
60
- };
61
-
62
- module.exports = abcjs;
@@ -1,116 +0,0 @@
1
- // Copyright (C) 2015-2020 Paul Rosen (paul at paulrosen dot net)
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4
- // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
5
- // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
6
- // to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
- //
8
- // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
- //
10
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
11
- // BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
12
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
13
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
-
16
- var tunebook = require('./abc_tunebook');
17
-
18
- var midi = require('../midi/abc_midi_controls');
19
- var midiCreate = require('../midi/abc_midi_create');
20
-
21
- // A quick way to render a tune from javascript when interactivity is not required.
22
- // This is used when a javascript routine has some abc text that it wants to render
23
- // in a div or collection of divs. One tune or many can be rendered.
24
- //
25
- // parameters:
26
- // output: an array of divs that the individual tunes are rendered to.
27
- // If the number of tunes exceeds the number of divs in the array, then
28
- // only the first tunes are rendered. If the number of divs exceeds the number
29
- // of tunes, then the unused divs are cleared. The divs can be passed as either
30
- // elements or strings of ids. If ids are passed, then the div MUST exist already.
31
- // (if a single element is passed, then it is an implied array of length one.)
32
- // (if a null is passed for an element, or the element doesn't exist, then that tune is skipped.)
33
- // abc: text representing a tune or an entire tune book in ABC notation.
34
- // renderParams: hash of:
35
- // startingTune: an index, starting at zero, representing which tune to start rendering at.
36
- // (If this element is not present, then rendering starts at zero.)
37
- var renderMidi = function(output, abc, parserParams, midiParams, renderParams) {
38
- var params = {};
39
- var key;
40
- if (parserParams) {
41
- for (key in parserParams) {
42
- if (parserParams.hasOwnProperty(key)) {
43
- params[key] = parserParams[key];
44
- }
45
- }
46
- }
47
- if (midiParams) {
48
- for (key in midiParams) {
49
- if (midiParams.hasOwnProperty(key)) {
50
- // There is a conflict with the name of the parameters "listener" and "transpose". If it comes in the second parameter, then it is for midi.
51
- if (key === "listener")
52
- params.midiListener = midiParams[key];
53
- else if (key === 'transpose')
54
- params.midiTranspose = midiParams[key];
55
- else
56
- params[key] = midiParams[key];
57
- }
58
- }
59
- }
60
- if (renderParams) {
61
- for (key in renderParams) {
62
- if (renderParams.hasOwnProperty(key)) {
63
- params[key] = renderParams[key];
64
- }
65
- }
66
- }
67
- if (params.generateInline === undefined) // default is to generate inline controls.
68
- params.generateInline = true;
69
- if (params.inlineControls)
70
- params.inlineControls.selectionToggle = false; // Override the selection option because there is no selection in the Basic call.
71
-
72
- function callback(div, tune, index, abcString) {
73
- var html = "";
74
- var midiInst = midiCreate(tune, params);
75
- if (params.generateInline) {
76
- var inlineMidi = midiInst.inline ? midiInst.inline : midiInst;
77
- var stopOld = div.innerHTML.indexOf("abcjs-midi-current") >= 0;
78
- html += midi.generateMidiControls(tune, params, inlineMidi, index, stopOld);
79
- }
80
- if (params.generateDownload) {
81
- var downloadMidi = midiInst.download ? midiInst.download : midiInst;
82
- html += midi.generateMidiDownloadLink(tune, params, downloadMidi, index);
83
- }
84
- div.innerHTML = html;
85
- if (params.generateInline)
86
- midi.attachListeners(div);
87
- var find = function(element, cls) {
88
- var els = element.getElementsByClassName(cls);
89
- if (els.length === 0)
90
- return null;
91
- return els[0];
92
- };
93
- if (params.generateInline && (params.animate || params.midiListener)) {
94
- var parent = find(div, "abcjs-inline-midi");
95
- parent.abcjsTune = tune;
96
- parent.abcjsListener = params.midiListener;
97
- parent.abcjsQpm = params.qpm;
98
- parent.abcjsContext = params.context;
99
- if (params.animate) {
100
- var drumIntro = params.drumIntro ? params.drumIntro : 0;
101
- parent.abcjsAnimate = params.animate.listener;
102
- parent.abcjsTune = params.animate.target; // We need the version of the tune that was drawn: extra info is added during the drawing process.
103
- parent.abcjsTune.setTiming(params.qpm, drumIntro);
104
- }
105
- }
106
- if (params.generateInline && params.inlineControls && params.inlineControls.startPlaying) {
107
- var startButton = find(div, "abcjs-midi-start");
108
- midi.startPlaying(startButton);
109
- }
110
-
111
- }
112
-
113
- return tunebook.renderEngine(callback, output, abc, params);
114
- };
115
-
116
- module.exports = renderMidi;