abcfajs 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,128 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Samyar Modaber
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ -------------------------------------------------------------------------------
24
+ Third-party notices
25
+ -------------------------------------------------------------------------------
26
+
27
+ abcjs (bundled in dist/abcfajs.min.js)
28
+ Copyright (c) 2009-2026 Paul Rosen and Gregory Dyke. MIT License.
29
+ https://github.com/paulrosen/abcjs
30
+
31
+ Koron and sori glyph outlines (src/glyphs.ts) are derived from the Bravura font
32
+ by Steinberg Media Technologies GmbH, licensed under the SIL Open Font License,
33
+ Version 1.1, reproduced below.
34
+ https://github.com/steinbergmedia/bravura
35
+
36
+ Copyright © 2019, Steinberg Media Technologies GmbH (http://www.steinberg.net/),
37
+ with Reserved Font Name "Bravura".
38
+
39
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
40
+ This license is copied below, and is also available with a FAQ at:
41
+ http://scripts.sil.org/OFL
42
+
43
+ -----------------------------------------------------------
44
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
45
+ -----------------------------------------------------------
46
+
47
+ PREAMBLE
48
+ The goals of the Open Font License (OFL) are to stimulate worldwide
49
+ development of collaborative font projects, to support the font creation
50
+ efforts of academic and linguistic communities, and to provide a free and
51
+ open framework in which fonts may be shared and improved in partnership
52
+ with others.
53
+
54
+ The OFL allows the licensed fonts to be used, studied, modified and
55
+ redistributed freely as long as they are not sold by themselves. The
56
+ fonts, including any derivative works, can be bundled, embedded,
57
+ redistributed and/or sold with any software provided that any reserved
58
+ names are not used by derivative works. The fonts and derivatives,
59
+ however, cannot be released under any other type of license. The
60
+ requirement for fonts to remain under this license does not apply
61
+ to any document created using the fonts or their derivatives.
62
+
63
+ DEFINITIONS
64
+ "Font Software" refers to the set of files released by the Copyright
65
+ Holder(s) under this license and clearly marked as such. This may
66
+ include source files, build scripts and documentation.
67
+
68
+ "Reserved Font Name" refers to any names specified as such after the
69
+ copyright statement(s).
70
+
71
+ "Original Version" refers to the collection of Font Software components as
72
+ distributed by the Copyright Holder(s).
73
+
74
+ "Modified Version" refers to any derivative made by adding to, deleting,
75
+ or substituting -- in part or in whole -- any of the components of the
76
+ Original Version, by changing formats or by porting the Font Software to a
77
+ new environment.
78
+
79
+ "Author" refers to any designer, engineer, programmer, technical
80
+ writer or other person who contributed to the Font Software.
81
+
82
+ PERMISSION AND CONDITIONS
83
+ Permission is hereby granted, free of charge, to any person obtaining
84
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
85
+ redistribute, and sell modified and unmodified copies of the Font
86
+ Software, subject to the following conditions:
87
+
88
+ 1) Neither the Font Software nor any of its individual components,
89
+ in Original or Modified Versions, may be sold by itself.
90
+
91
+ 2) Original or Modified Versions of the Font Software may be bundled,
92
+ redistributed and/or sold with any software, provided that each copy
93
+ contains the above copyright notice and this license. These can be
94
+ included either as stand-alone text files, human-readable headers or
95
+ in the appropriate machine-readable metadata fields within text or
96
+ binary files as long as those fields can be easily viewed by the user.
97
+
98
+ 3) No Modified Version of the Font Software may use the Reserved Font
99
+ Name(s) unless explicit written permission is granted by the corresponding
100
+ Copyright Holder. This restriction only applies to the primary font name as
101
+ presented to the users.
102
+
103
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
104
+ Software shall not be used to promote, endorse or advertise any
105
+ Modified Version, except to acknowledge the contribution(s) of the
106
+ Copyright Holder(s) and the Author(s) or with their explicit written
107
+ permission.
108
+
109
+ 5) The Font Software, modified or unmodified, in part or in whole,
110
+ must be distributed entirely under this license, and must not be
111
+ distributed under any other license. The requirement for fonts to
112
+ remain under this license does not apply to any document created
113
+ using the Font Software.
114
+
115
+ TERMINATION
116
+ This license becomes null and void if any of the above conditions are
117
+ not met.
118
+
119
+ DISCLAIMER
120
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
121
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
122
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
123
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
124
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
125
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
126
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
127
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
128
+ OTHER DEALINGS IN THE FONT SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # abcfajs
2
+
3
+ [abcjs](https://www.npmjs.com/package/abcjs) with the Persian microtonal accidentals **koron** (کرن) and **sori** (سری).
4
+
5
+ abcfajs is abcjs with one change: quarter-tone accidentals are drawn with the koron and sori signs used in Persian music notation. Everything else works the same as in abcjs, including rendering, playback, MIDI and the editor. Koron and sori notes play at their microtonal pitch.
6
+
7
+ | ABC | Sign | Name | Pitch |
8
+ | ----- | ----- | ------------- | -------------- |
9
+ | `_/B` | koron | کرن | −50 cents |
10
+ | `^/F` | sori | سری | +50 cents |
11
+
12
+ `_/` and `^/` are the standard ABC 2.1 quarter-tone accidentals. ABC tunes you already have that use them work without changes.
13
+
14
+ ## Install
15
+
16
+ ```sh
17
+ npm install abcfajs
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ `abcfajs` has the same API as `abcjs`. To switch, change the import:
23
+
24
+ ```js
25
+ import abcjs from 'abcfajs'; // instead of: import abcjs from 'abcjs'
26
+
27
+ abcjs.renderAbc('paper', `X:1
28
+ T:Koron & Sori
29
+ M:4/4
30
+ L:1/4
31
+ K:C _/A _B
32
+ G _/A B c | d _/e ^/f g |]`);
33
+ ```
34
+
35
+ Named exports and CommonJS work too:
36
+
37
+ ```js
38
+ import { renderAbc, synth, KORON, SORI } from 'abcfajs';
39
+ const abcjs = require('abcfajs');
40
+ ```
41
+
42
+ ### In the browser with a `<script>` tag
43
+
44
+ `abcfajs.min.js` has abcjs built in and defines the same `ABCJS` global as `abcjs-basic-min.js`, so you can swap one file for the other:
45
+
46
+ ```html
47
+ <script src="https://cdn.jsdelivr.net/npm/abcfajs/dist/abcfajs.min.js"></script>
48
+ <script>
49
+ ABCJS.renderAbc('paper', 'X:1\nK:C\n_/B ^/c d2|]');
50
+ </script>
51
+ ```
52
+
53
+ ## Writing koron and sori
54
+
55
+ - **On a note:** put `_/` (koron) or `^/` (sori) in front of it, the same way you would write `_` or `^`.
56
+ - **In the key signature:** list the accidentals after the key, for example `K:C _/A _B` for A-koron and B-flat. Starting from `C` means no other sharps or flats are added.
57
+ - **Within a bar:** a koron or sori lasts until the next bar line, like any other accidental. Write `=` to cancel it.
58
+
59
+ ```abc
60
+ X:1
61
+ T:Chahargah (C)
62
+ L:1/8
63
+ K:C _/D _/A
64
+ C D E F G A B c |]
65
+ ```
66
+
67
+ ## API
68
+
69
+ On top of the full abcjs API, abcfajs exports:
70
+
71
+ | Export | Description |
72
+ | ----------------------------- | ------------------------------------------------------------------- |
73
+ | `KORON` | `'_/'` |
74
+ | `SORI` | `'^/'` |
75
+ | `koron(note)` | `koron('B')` → `'_/B'` |
76
+ | `sori(note)` | `sori('f')` → `'^/f'` |
77
+ | `KORON_GLYPH`, `SORI_GLYPH` | The glyph outlines, in abcjs `setGlyph` format |
78
+ | `installPersianAccidentals()` | Installs the glyphs again. This runs automatically on import. |
79
+
80
+ To use your own drawings of the signs, call `setGlyph('accidentals.halfflat', glyph)` (koron) or `setGlyph('accidentals.halfsharp', glyph)` (sori).
81
+
82
+ TypeScript types come with the package. All abcjs types are re-exported, for example `import type { TuneObject } from 'abcfajs'`.
83
+
84
+ ## Limitations
85
+
86
+ - Koron and sori always play exactly a quarter tone (50 cents) away from the natural note. In real performance the interval varies by dastgah and by player. abcjs only supports ±50 cents.
87
+ - Importing abcfajs changes the quarter-tone glyphs everywhere abcjs is used in your app, because abcjs stores glyphs globally.
88
+
89
+ ## Development
90
+
91
+ ```sh
92
+ npm install
93
+ npm test # builds, then runs the tests
94
+ open example/index.html
95
+ ```
96
+
97
+ ## Credits
98
+
99
+ - [abcjs](https://github.com/paulrosen/abcjs) by Paul Rosen and Gregory Dyke (MIT)
100
+ - The koron and sori outlines come from the [Bravura](https://github.com/steinbergmedia/bravura) SMuFL font by Steinberg (SIL OFL 1.1)
101
+
102
+ ## License
103
+
104
+ MIT. See [LICENSE](LICENSE) for the third-party notices.