linked-rolls 0.70.0 → 0.72.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.
Files changed (143) hide show
  1. package/README.md +106 -5
  2. package/lib/analysis/constraints.d.ts +7 -0
  3. package/lib/analysis/constraints.js +1 -0
  4. package/lib/analysis/ownPaper.d.ts +5 -1
  5. package/lib/analysis/ownPaper.js +5 -1
  6. package/lib/analysis/paper.d.ts +22 -4
  7. package/lib/analysis/paper.js +6 -0
  8. package/lib/analysis/reservations.d.ts +24 -1
  9. package/lib/analysis/reservations.js +15 -1
  10. package/lib/analysis/sigla.d.ts +6 -1
  11. package/lib/analysis/sigla.js +5 -1
  12. package/lib/analysis/stemma.d.ts +6 -1
  13. package/lib/analysis/stemma.js +6 -1
  14. package/lib/analysis/text.d.ts +16 -2
  15. package/lib/analysis/text.js +16 -2
  16. package/lib/analysis/witnesses.d.ts +20 -1
  17. package/lib/analysis/witnesses.js +4 -0
  18. package/lib/collation/Collation.d.ts +47 -8
  19. package/lib/collation/Collation.js +29 -5
  20. package/lib/collation/alignment.d.ts +16 -3
  21. package/lib/collation/alignment.js +15 -3
  22. package/lib/collation/scatter.d.ts +50 -9
  23. package/lib/collation/scatter.js +11 -1
  24. package/lib/collation/statistics.d.ts +39 -9
  25. package/lib/collation/statistics.js +27 -6
  26. package/lib/collation/substitution.d.ts +5 -0
  27. package/lib/collation/substitution.js +4 -0
  28. package/lib/emulation/Emulation.d.ts +16 -1
  29. package/lib/emulation/Emulation.js +10 -0
  30. package/lib/emulation/negotiation.d.ts +1 -0
  31. package/lib/emulation/negotiation.js +1 -0
  32. package/lib/filiation/adoption.d.ts +47 -0
  33. package/lib/filiation/adoption.js +190 -0
  34. package/lib/filiation/changes.d.ts +33 -0
  35. package/lib/filiation/changes.js +38 -0
  36. package/lib/filiation/index.d.ts +12 -0
  37. package/lib/filiation/index.js +12 -0
  38. package/lib/filiation/presence.d.ts +50 -0
  39. package/lib/filiation/presence.js +122 -0
  40. package/lib/filiation/proposal.d.ts +132 -0
  41. package/lib/filiation/proposal.js +376 -0
  42. package/lib/filiation/readings.d.ts +108 -0
  43. package/lib/filiation/readings.js +281 -0
  44. package/lib/filiation/search.d.ts +113 -0
  45. package/lib/filiation/search.js +268 -0
  46. package/lib/filiation/systems.d.ts +21 -0
  47. package/lib/filiation/systems.js +39 -0
  48. package/lib/filiation/trees.d.ts +20 -0
  49. package/lib/filiation/trees.js +69 -0
  50. package/lib/index.d.ts +34 -2
  51. package/lib/index.js +3 -1
  52. package/lib/io/asJsonLd.d.ts +10 -0
  53. package/lib/io/asJsonLd.js +10 -0
  54. package/lib/io/context.d.ts +16 -2
  55. package/lib/io/context.js +16 -2
  56. package/lib/io/importJsonLd.d.ts +1 -0
  57. package/lib/io/importJsonLd.js +1 -0
  58. package/lib/io/migrate.d.ts +8 -0
  59. package/lib/io/migrate.js +8 -0
  60. package/lib/lookup/lookup.d.ts +29 -5
  61. package/lib/lookup/lookup.js +29 -5
  62. package/lib/lookup/paths.d.ts +23 -3
  63. package/lib/lookup/paths.js +17 -3
  64. package/lib/model/Agent.d.ts +28 -2
  65. package/lib/model/Agent.js +15 -1
  66. package/lib/model/Assumption.d.ts +96 -7
  67. package/lib/model/Assumption.js +65 -7
  68. package/lib/model/ConditionState.d.ts +1 -0
  69. package/lib/model/Edit.d.ts +10 -0
  70. package/lib/model/Edit.js +8 -0
  71. package/lib/model/Edition.d.ts +11 -0
  72. package/lib/model/Edition.js +1 -0
  73. package/lib/model/Feature.d.ts +74 -7
  74. package/lib/model/Feature.js +41 -3
  75. package/lib/model/FeatureSource.d.ts +14 -1
  76. package/lib/model/FeatureSource.js +7 -1
  77. package/lib/model/Perforator.d.ts +10 -0
  78. package/lib/model/Perforator.js +1 -0
  79. package/lib/model/Quantity.d.ts +160 -13
  80. package/lib/model/Quantity.js +110 -6
  81. package/lib/model/RollCopy.d.ts +74 -12
  82. package/lib/model/RollCopy.js +53 -10
  83. package/lib/model/Symbol.d.ts +38 -1
  84. package/lib/model/Symbol.js +16 -0
  85. package/lib/model/TrackCalibration.d.ts +10 -2
  86. package/lib/model/TrackCalibration.js +9 -2
  87. package/lib/model/Version.d.ts +24 -4
  88. package/lib/model/Version.js +19 -4
  89. package/lib/model/notes.d.ts +15 -2
  90. package/lib/model/notes.js +9 -2
  91. package/lib/model/procedures.d.ts +5 -1
  92. package/lib/model/procedures.js +5 -1
  93. package/lib/model/vocabulary.d.ts +6 -1
  94. package/lib/model/vocabulary.js +6 -1
  95. package/lib/ops/beliefs.d.ts +23 -1
  96. package/lib/ops/beliefs.js +23 -1
  97. package/lib/ops/collation.d.ts +3 -0
  98. package/lib/ops/collation.js +3 -0
  99. package/lib/ops/commands.d.ts +17 -2
  100. package/lib/ops/commands.js +17 -2
  101. package/lib/ops/copies.d.ts +37 -6
  102. package/lib/ops/copies.js +37 -6
  103. package/lib/ops/draft.d.ts +2 -0
  104. package/lib/ops/draft.js +1 -0
  105. package/lib/ops/edits.d.ts +5 -1
  106. package/lib/ops/edits.js +5 -1
  107. package/lib/ops/features.d.ts +12 -1
  108. package/lib/ops/features.js +7 -0
  109. package/lib/ops/versions.d.ts +15 -3
  110. package/lib/ops/versions.js +15 -3
  111. package/lib/readers/phillipsEroll.d.ts +12 -1
  112. package/lib/readers/phillipsEroll.js +6 -1
  113. package/lib/readers/spencerBar.d.ts +12 -1
  114. package/lib/readers/spencerBar.js +7 -1
  115. package/lib/readers/stanfordAton.d.ts +15 -0
  116. package/lib/readers/stanfordAton.js +9 -0
  117. package/lib/schema.json +10 -0
  118. package/lib/shared/utils.d.ts +12 -0
  119. package/lib/spec/context.json +4 -0
  120. package/lib/systems/ReproducingSystem.d.ts +46 -3
  121. package/lib/systems/TrackerBar.d.ts +45 -4
  122. package/lib/systems/TrackerBar.js +20 -3
  123. package/lib/systems/index.d.ts +9 -2
  124. package/lib/systems/index.js +9 -2
  125. package/lib/systems/velocity.d.ts +1 -0
  126. package/lib/systems/velocity.js +1 -0
  127. package/lib/systems/welte.d.ts +18 -3
  128. package/lib/systems/welte.js +9 -2
  129. package/lib/systems/welteLicensee/bar.d.ts +1 -0
  130. package/lib/systems/welteLicensee/bar.js +1 -0
  131. package/lib/systems/welteLicensee/system.d.ts +18 -0
  132. package/lib/systems/welteLicensee/system.js +17 -0
  133. package/lib/systems/welteT100/bar.d.ts +8 -0
  134. package/lib/systems/welteT100/bar.js +4 -0
  135. package/lib/systems/welteT100/system.d.ts +46 -5
  136. package/lib/systems/welteT100/system.js +29 -3
  137. package/lib/systems/welteT98/bar.d.ts +6 -0
  138. package/lib/systems/welteT98/bar.js +2 -0
  139. package/lib/systems/welteT98/system.d.ts +58 -5
  140. package/lib/systems/welteT98/system.js +42 -3
  141. package/lib/validate.d.ts +16 -0
  142. package/lib/validate.js +15 -0
  143. package/package.json +2 -1
@@ -30,6 +30,7 @@ const dropDerivations = (version, matches) => {
30
30
  * Makes the version stand on its own: what it inherited becomes its
31
31
  * own insertions, and its derivations go, the hypotheses among them,
32
32
  * with the motivations that belonged to them.
33
+ * @category Operations
33
34
  */
34
35
  export const detachVersion = (versionId) => reading(edition => {
35
36
  const edits = snapshotOf(edition, versionId).map(insertion);
@@ -43,6 +44,7 @@ export const detachVersion = (versionId) => reading(edition => {
43
44
  * Takes the version out. Whatever read its text against it comes to
44
45
  * stand on its own, a hypothesis that something derives from it goes,
45
46
  * and so does a copy's statement that it carries the version.
47
+ * @category Operations
46
48
  */
47
49
  export const removeVersion = (versionId) => reading(edition => {
48
50
  const detachments = edition.versions
@@ -56,9 +58,15 @@ export const removeVersion = (versionId) => reading(edition => {
56
58
  draft.versions = without(draft.versions, version => version.id === versionId);
57
59
  };
58
60
  });
59
- /** Takes the symbols out of the version's own insertions, and the edits that had nothing else. */
61
+ /**
62
+ * Takes the symbols out of the version's own insertions, and the edits that had nothing else.
63
+ * @category Operations
64
+ */
60
65
  export const removeSymbols = (versionId, symbolIds) => onVersion(versionId, version => dropInsertions(version, new Set(symbolIds)));
61
- /** Moves the edits into a new version based on this one. */
66
+ /**
67
+ * Moves the edits into a new version based on this one.
68
+ * @category Operations
69
+ */
62
70
  export const deriveVersion = (versionId, editIds) => onVersion(versionId, (version, draft) => {
63
71
  const chosen = new Set(editIds);
64
72
  const moved = editsOf(version).filter(edit => chosen.has(edit.id));
@@ -79,6 +87,7 @@ export const deriveVersion = (versionId, editIds) => onVersion(versionId, (versi
79
87
  * unless the belief holds this one more certain. A version derives from
80
88
  * itself, twice from one parent, or from one of its own descendants in
81
89
  * no statement.
90
+ * @category Operations
82
91
  */
83
92
  export const stateDerivation = (versionId, parentId, belief) => onVersion(versionId, (version, draft) => {
84
93
  const derivations = stateOf(version).basedOn ?? [];
@@ -88,7 +97,10 @@ export const stateDerivation = (versionId, parentId, belief) => onVersion(versio
88
97
  return;
89
98
  version.basedOn = [...derivations, referenceHeld(parentId, belief)];
90
99
  });
91
- /** Takes back the hypothesis that the version derives from the parent; the principal derivation goes with `detachVersion`. */
100
+ /**
101
+ * Takes back the hypothesis that the version derives from the parent; the principal derivation goes with `detachVersion`.
102
+ * @category Operations
103
+ */
92
104
  export const clearDerivation = (versionId, parentId) => onVersion(versionId, version => {
93
105
  if (readsAgainst(stateOf(version), parentId))
94
106
  return;
@@ -49,8 +49,15 @@ import { Millimeters, Seconds } from "../model/Quantity.js";
49
49
  * The two rules collide on one number, the lowest note of the T-100
50
50
  * sharing 24 with the tenth position. Notes win there, the note block
51
51
  * being the larger claim; none of his samples uses the number at all.
52
+ * @category Sources
52
53
  */
53
54
  export declare const CONTROL_OFFSET: Readonly<Record<string, number>>;
55
+ /**
56
+ * How `readFromPhillipsEroll` reads a file: the bar it numbers its
57
+ * positions by, where its expression numbers sit, how time is put back
58
+ * onto the paper, and what the reader added to the chains.
59
+ * @category Sources
60
+ */
54
61
  export interface PhillipsErollOptions {
55
62
  /**
56
63
  * The bar the file numbers its positions by, which is the bar of
@@ -87,7 +94,11 @@ export interface PhillipsErollOptions {
87
94
  * Reads one of his e-roll files as a copy of the roll, in millimetres
88
95
  * of paper, on the bar it was cut for and in that bar's numbering. A
89
96
  * position the bar does not read is left out, as the bar would leave it.
97
+ * @category Sources
90
98
  */
91
99
  export declare function readFromPhillipsEroll(buffer: ArrayBuffer, { system, controlOffset, placeAt, extension }?: PhillipsErollOptions): RollCopy;
92
- /** The bars his files are known to be numbered by. */
100
+ /**
101
+ * The bars his files are known to be numbered by.
102
+ * @category Sources
103
+ */
93
104
  export declare const phillipsSystems: readonly TrackerBar[];
@@ -54,6 +54,7 @@ import { inMetersPerMinute, mm, seconds, track } from "../model/Quantity.js";
54
54
  * The two rules collide on one number, the lowest note of the T-100
55
55
  * sharing 24 with the tenth position. Notes win there, the note block
56
56
  * being the larger claim; none of his samples uses the number at all.
57
+ * @category Sources
57
58
  */
58
59
  export const CONTROL_OFFSET = {
59
60
  'welte-t100': 14,
@@ -133,6 +134,7 @@ const controlOffsetOf = (system, given) => {
133
134
  * Reads one of his e-roll files as a copy of the roll, in millimetres
134
135
  * of paper, on the bar it was cut for and in that bar's numbering. A
135
136
  * position the bar does not read is left out, as the bar would leave it.
137
+ * @category Sources
136
138
  */
137
139
  export function readFromPhillipsEroll(buffer, { system = welteT100, controlOffset, placeAt, extension } = {}) {
138
140
  const file = read(new Uint8Array(buffer));
@@ -173,5 +175,8 @@ export function readFromPhillipsEroll(buffer, { system = welteT100, controlOffse
173
175
  shortenChains(extension, copy);
174
176
  return copy;
175
177
  }
176
- /** The bars his files are known to be numbered by. */
178
+ /**
179
+ * The bars his files are known to be numbered by.
180
+ * @category Sources
181
+ */
177
182
  export const phillipsSystems = [welteT100, welteLicensee];
@@ -6,8 +6,14 @@ import { TrackerBar } from "../systems/TrackerBar.js";
6
6
  * 640 Hz), and the tempo counts tenths of a foot per minute, which puts
7
7
  * 400 rows on an inch. This is the file's own calibration; whether the
8
8
  * scanner kept it is for an alignment with other copies to tell.
9
+ * @category Sources
9
10
  */
10
11
  export declare const SPENCER_ROWS_PER_INCH = 400;
12
+ /**
13
+ * How `readFromSpencerBar` reads a file: the rows of its image on an
14
+ * inch of paper, and the bar it numbers its positions by.
15
+ * @category Sources
16
+ */
11
17
  export interface SpencerBarOptions {
12
18
  /** Rows of the image on an inch of paper. */
13
19
  rowsPerInch?: number;
@@ -21,13 +27,18 @@ export interface SpencerBarOptions {
21
27
  * Reads the copy on the bar it was cut for, whose numbering it keeps.
22
28
  * A chain on a position that bar does not read is left out, as the bar
23
29
  * would leave it.
30
+ * @category Sources
24
31
  */
25
32
  export declare function readFromSpencerBar(buffer: ArrayBuffer, { rowsPerInch, system }?: SpencerBarOptions): RollCopy;
26
33
  /**
27
34
  * The `.ann` file beside a `.bar` holds the player's settings for the
28
35
  * roll as lines of "/key: value": title, composer, pianist, roll
29
36
  * number and class, and the tempo the roll is played at.
37
+ * @category Sources
30
38
  */
31
39
  export declare const readSpencerAnn: (text: string) => ReadonlyMap<string, string>;
32
- /** The paper speed a `.ann` states through its roll tempo, where it states one. */
40
+ /**
41
+ * The paper speed a `.ann` states through its roll tempo, where it states one.
42
+ * @category Sources
43
+ */
33
44
  export declare const paperSpeedOfSpencerAnn: (ann: ReadonlyMap<string, string>) => PaperSpeed | undefined;
@@ -22,6 +22,7 @@ const END_OF_EVENTS = 0xFF;
22
22
  * 640 Hz), and the tempo counts tenths of a foot per minute, which puts
23
23
  * 400 rows on an inch. This is the file's own calibration; whether the
24
24
  * scanner kept it is for an alignment with other copies to tell.
25
+ * @category Sources
25
26
  */
26
27
  export const SPENCER_ROWS_PER_INCH = 400;
27
28
  const byteAt = (bytes, at) => {
@@ -82,6 +83,7 @@ const holesOf = (events) => {
82
83
  * Reads the copy on the bar it was cut for, whose numbering it keeps.
83
84
  * A chain on a position that bar does not read is left out, as the bar
84
85
  * would leave it.
86
+ * @category Sources
85
87
  */
86
88
  export function readFromSpencerBar(buffer, { rowsPerInch = SPENCER_ROWS_PER_INCH, system = welteLicensee } = {}) {
87
89
  const bytes = new Uint8Array(buffer);
@@ -121,6 +123,7 @@ export function readFromSpencerBar(buffer, { rowsPerInch = SPENCER_ROWS_PER_INCH
121
123
  * The `.ann` file beside a `.bar` holds the player's settings for the
122
124
  * roll as lines of "/key: value": title, composer, pianist, roll
123
125
  * number and class, and the tempo the roll is played at.
126
+ * @category Sources
124
127
  */
125
128
  export const readSpencerAnn = (text) => new Map(text.split(/\r?\n/)
126
129
  .map(line => line.match(/^\/(\w+):\s*(.*?)\s*$/))
@@ -128,7 +131,10 @@ export const readSpencerAnn = (text) => new Map(text.split(/\r?\n/)
128
131
  .map(([, key, value]) => [key, value]));
129
132
  /** A roll tempo counts tenths of a foot per minute: tempo 83 runs the roll at 8.3 feet a minute. */
130
133
  const TEMPO_PER_FOOT_PER_MINUTE = 10;
131
- /** The paper speed a `.ann` states through its roll tempo, where it states one. */
134
+ /**
135
+ * The paper speed a `.ann` states through its roll tempo, where it states one.
136
+ * @category Sources
137
+ */
132
138
  export const paperSpeedOfSpencerAnn = (ann) => {
133
139
  const tempo = parseFloat(ann.get('roll_tempo') ?? '');
134
140
  if (isNaN(tempo) || tempo <= 0)
@@ -1,6 +1,12 @@
1
1
  import { RollCopy } from "../model/RollCopy.js";
2
2
  import { TrackerBar } from "../systems/TrackerBar.js";
3
3
  import { Track } from "../model/Quantity.js";
4
+ /**
5
+ * How `readFromStanfordAton` reads an analysis file: how its hole
6
+ * numbering is shifted onto the tracker bar, which bar the roll was cut
7
+ * for, and where its scan can be seen.
8
+ * @category Sources
9
+ */
4
10
  export interface StanfordAtonOptions {
5
11
  /**
6
12
  * Added to the scanning software's hole numbering to reach the
@@ -21,4 +27,13 @@ export interface StanfordAtonOptions {
21
27
  */
22
28
  scan?: string;
23
29
  }
30
+ /**
31
+ * Reads a hole analysis of a scan, in the ATON format of Stanford's
32
+ * SUPRA collection, as a copy of the roll: its chains of holes in
33
+ * millimetres of paper on the bar it was cut for, its edge tears, its
34
+ * dimensions and hole separation as the analysis measured them, and how
35
+ * the scan relates to the bar. A position the bar does not read is left
36
+ * out, as the bar would leave it.
37
+ * @category Sources
38
+ */
24
39
  export declare function readFromStanfordAton(atonString: string, { trackShift, system, scan }?: StanfordAtonOptions): RollCopy;
@@ -139,6 +139,15 @@ const measurementOf = (rollinfo) => {
139
139
  const takenBy = (measurement) => (value) => measurement
140
140
  ? { ...value, '@annotation': { id: v4(), belief: { type: 'belief', id: v4(), certainty: 'true', reasons: [measurement] } } }
141
141
  : value;
142
+ /**
143
+ * Reads a hole analysis of a scan, in the ATON format of Stanford's
144
+ * SUPRA collection, as a copy of the roll: its chains of holes in
145
+ * millimetres of paper on the bar it was cut for, its edge tears, its
146
+ * dimensions and hole separation as the analysis measured them, and how
147
+ * the scan relates to the bar. A position the bar does not read is left
148
+ * out, as the bar would leave it.
149
+ * @category Sources
150
+ */
142
151
  export function readFromStanfordAton(atonString, { trackShift, system = welteT100, scan } = {}) {
143
152
  const parser = new AtonParser();
144
153
  const json = parser.parse(atonString);
package/lib/schema.json CHANGED
@@ -490,6 +490,7 @@
490
490
  "ontology": "lrmoo:R76 is derivative of"
491
491
  },
492
492
  "DriveId": {
493
+ "description": "The IRI of a drive the type vocabulary declares.",
493
494
  "enum": [
494
495
  "https://w3id.org/reo/type/drive/ram-head",
495
496
  "https://w3id.org/reo/type/drive/asynchronous"
@@ -927,6 +928,14 @@
927
928
  "description": "The person who carried out this activity.",
928
929
  "ontology": "crm:P14 carried out by"
929
930
  },
931
+ "applies": {
932
+ "description": "The rules the inference draws its conclusion by, by IRI: a regularity of how the rolls were edited, such as that the same addition at the same place is not made twice independently, a default, such as that copies were not made from two exemplars, or a method, such as how the tolerance of a collation is found. The rules are stated once where they are published, and each inference names those it follows, so that a reader can see what a conclusion rests on besides its premises, and which conclusions rest on a rule.",
933
+ "items": {
934
+ "type": "string"
935
+ },
936
+ "type": "array",
937
+ "ontology": "crminf:J3 applied"
938
+ },
930
939
  "note": {
931
940
  "description": "A free-text note providing additional context.",
932
941
  "type": "string",
@@ -3396,6 +3405,7 @@
3396
3405
  "ontology": "crmdig:D14 Software"
3397
3406
  },
3398
3407
  "SourceKind": {
3408
+ "description": "A kind of source a copy's features can be read from, from the paper itself to a sound recording of the copy being played.",
3399
3409
  "enum": [
3400
3410
  "roll",
3401
3411
  "scan",
@@ -1,4 +1,8 @@
1
1
  export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
2
+ /**
3
+ * An object that says by its type which kind of entity it is.
4
+ * @category Format types
5
+ */
2
6
  export type WithType<T extends string> = {
3
7
  /**
4
8
  * The type discriminator for this object.
@@ -6,6 +10,10 @@ export type WithType<T extends string> = {
6
10
  */
7
11
  readonly type: T;
8
12
  };
13
+ /**
14
+ * An object the edition identifies, so that others can refer to it.
15
+ * @category Format types
16
+ */
9
17
  export type WithId = {
10
18
  /**
11
19
  * A unique identifier for this object.
@@ -16,6 +24,10 @@ export type WithId = {
16
24
  export declare const isDateString: (value: unknown) => value is string;
17
25
  /** The items by the key each of them gives, every group in the order its first item came in. */
18
26
  export declare const groupBy: <T>(items: readonly T[], keyOf: (item: T) => string) => Map<string, T[]>;
27
+ /**
28
+ * An object that may carry a note in free text.
29
+ * @category Format types
30
+ */
19
31
  export type WithNote = {
20
32
  /**
21
33
  * A free-text note providing additional context.
@@ -65,6 +65,10 @@
65
65
  "used": {
66
66
  "@id": "crm:P16_used_specific_object",
67
67
  "@type": "@id"
68
+ },
69
+ "applies": {
70
+ "@id": "crminf:J3_applied",
71
+ "@type": "@id"
68
72
  }
69
73
  }
70
74
  },
@@ -6,6 +6,7 @@ import { MetersPerMinute, Millimeters, Seconds } from "../model/Quantity.js";
6
6
  * A note or expression of a version with the dimensions of its carriers
7
7
  * averaged in and the editorial assumptions applied, which is all a
8
8
  * performance needs to know of a symbol.
9
+ * @category Systems and emulation
9
10
  */
10
11
  export type NegotiatedEvent = Omit<Note | Expression, 'carriers'> & Pick<HoleChain, 'horizontal' | 'vertical'>;
11
12
  interface PerformedRollFeature<T> {
@@ -18,21 +19,41 @@ interface PerformedNoteEvent<T> extends PerformedRollFeature<T> {
18
19
  pitch: number;
19
20
  velocity: number;
20
21
  }
22
+ /**
23
+ * A note struck, at the velocity the performance gives it.
24
+ * @category Systems and emulation
25
+ */
21
26
  export interface PerformedNoteOnEvent extends PerformedNoteEvent<'noteOn'> {
22
27
  }
28
+ /**
29
+ * A note released.
30
+ * @category Systems and emulation
31
+ */
23
32
  export interface PerformedNoteOffEvent extends PerformedNoteEvent<'noteOff'> {
24
33
  }
25
34
  /**
26
35
  * One step of a pedal. A pedal driven by a bellows takes time to travel,
27
36
  * so a single command results in a run of these; `performs` is the
28
37
  * command whose reading the step follows from.
38
+ * @category Systems and emulation
29
39
  */
30
40
  export interface PerformedPedalEvent extends PerformedRollFeature<'damper' | 'hammerRail'> {
31
41
  /** 0 with the pedal up and 127 with it fully down. */
32
42
  value: number;
33
43
  }
44
+ /**
45
+ * What a performance does at a moment: a note struck or released, or a
46
+ * step of a pedal.
47
+ * @category Systems and emulation
48
+ */
34
49
  export type AnyPerformedRollFeature = PerformedNoteOnEvent | PerformedNoteOffEvent | PerformedPedalEvent;
35
- interface CurveSamples {
50
+ /**
51
+ * A curve sampled along the roll: where each sample lies on the paper,
52
+ * when it passes the tracker bar, and how far the bellows or the pedal
53
+ * has travelled there.
54
+ * @category Systems and emulation
55
+ */
56
+ export interface CurveSamples {
36
57
  readonly name: string;
37
58
  /** Paper position of each sample, in mm from the beginning of the roll. */
38
59
  readonly place: Float64Array;
@@ -53,7 +74,10 @@ interface CurveSamples {
53
74
  */
54
75
  readonly travel: Float64Array;
55
76
  }
56
- /** The dynamics of one part of the keyboard, with the velocity the travel maps onto. */
77
+ /**
78
+ * The dynamics of one part of the keyboard, with the velocity the travel maps onto.
79
+ * @category Systems and emulation
80
+ */
57
81
  export type DynamicsCurve = CurveSamples & {
58
82
  readonly kind: 'dynamics';
59
83
  readonly velocity: Float64Array;
@@ -66,11 +90,24 @@ export type DynamicsCurve = CurveSamples & {
66
90
  */
67
91
  readonly instrument: string;
68
92
  };
93
+ /**
94
+ * How far one pedal has travelled along the roll, 0 with it up and 1
95
+ * with it down.
96
+ * @category Systems and emulation
97
+ */
69
98
  export type PedalCurve = CurveSamples & {
70
99
  readonly kind: 'pedal';
71
100
  };
101
+ /**
102
+ * A curve a performance yields: the dynamics of one half of the
103
+ * keyboard, or the travel of a pedal.
104
+ * @category Systems and emulation
105
+ */
72
106
  export type EmulatedCurve = DynamicsCurve | PedalCurve;
73
- /** What the edition records about the roll that a mechanism may want to know. */
107
+ /**
108
+ * What the edition records about the roll that a mechanism may want to know.
109
+ * @category Systems and emulation
110
+ */
74
111
  export type RollProperties = {
75
112
  /** Diameter of the punches, where the copies record it. */
76
113
  punchDiameter?: Millimeters;
@@ -114,6 +151,11 @@ export type RollProperties = {
114
151
  */
115
152
  toOwnPaper?: number;
116
153
  };
154
+ /**
155
+ * What a reproducing system made of the events of a version: the events
156
+ * it performed, and the curves of its dynamics and pedals.
157
+ * @category Systems and emulation
158
+ */
117
159
  export type Performance = {
118
160
  readonly events: readonly AnyPerformedRollFeature[];
119
161
  readonly curves: readonly EmulatedCurve[];
@@ -124,6 +166,7 @@ export type Performance = {
124
166
  * Implementations live outside the core of this library, so that it does
125
167
  * not depend on any one instrument's model; `linked-rolls/welte-t100` is
126
168
  * the first.
169
+ * @category Systems and emulation
127
170
  */
128
171
  export interface ReproducingSystem<Options extends object> {
129
172
  readonly name: string;
@@ -4,11 +4,13 @@ import { Millimeters, SpeedMeasure, Track } from "../model/Quantity.js";
4
4
  /**
5
5
  * What a tracker bar position does: sound a note, or operate one of
6
6
  * the expression valves on the bass or the treble side.
7
+ * @category Systems and emulation
7
8
  */
8
9
  export type TrackRole = 'bass-expression' | 'note' | 'treble-expression';
9
10
  /**
10
11
  * A contiguous block of tracker bar positions serving one role.
11
12
  * Both bounds are inclusive.
13
+ * @category Systems and emulation
12
14
  */
13
15
  export interface TrackArea {
14
16
  readonly role: TrackRole;
@@ -18,11 +20,13 @@ export interface TrackArea {
18
20
  /**
19
21
  * How a scale words a function: as a command that turns it on, one that
20
22
  * cancels it, or one that holds it for as long as it lasts.
23
+ * @category Systems and emulation
21
24
  */
22
25
  export type Spelling = 'on' | 'off' | 'held';
23
26
  /**
24
27
  * What a word of a scale operates, rather than the word itself, so that
25
28
  * two scales can be compared at all.
29
+ * @category Systems and emulation
26
30
  */
27
31
  export interface Operation {
28
32
  /** The function operated, named the same wherever a scale has it. */
@@ -36,8 +40,21 @@ export interface Operation {
36
40
  */
37
41
  sided: boolean;
38
42
  }
43
+ /**
44
+ * What a position in the note block reads: a note of one pitch.
45
+ * @category Systems and emulation
46
+ */
39
47
  export type NoteMeaning = Pick<Note, 'type' | 'pitch'>;
48
+ /**
49
+ * What an expression position reads: an expression type, on the side of
50
+ * the keyboard the position serves.
51
+ * @category Systems and emulation
52
+ */
40
53
  export type ExpressionMeaning = Pick<Expression, 'type' | 'expressionType' | 'scope'>;
54
+ /**
55
+ * What a position of the bar reads: a note or an expression.
56
+ * @category Systems and emulation
57
+ */
41
58
  export type TrackMeaning = NoteMeaning | ExpressionMeaning;
42
59
  /**
43
60
  * Describes a tracker bar. Track numbers are 1-based and count from
@@ -48,6 +65,7 @@ export type TrackMeaning = NoteMeaning | ExpressionMeaning;
48
65
  * Anything that needs to know where the note block ends, which side
49
66
  * an expression belongs to, or how a track maps to a pitch, should
50
67
  * ask the tracker bar rather than repeat the boundaries.
68
+ * @category Systems and emulation
51
69
  */
52
70
  export interface TrackerBar {
53
71
  /**
@@ -129,13 +147,23 @@ export interface TrackerBar {
129
147
  * What a position says, as a key. Two bars read the same thing exactly
130
148
  * where their keys agree, which is what lets a symbol cross from one
131
149
  * system to another and what decides whether two symbols collate.
150
+ * @category Systems and emulation
132
151
  */
133
152
  export declare const keyOf: (meaning: TrackMeaning) => string;
134
- /** The roll system a tracker bar belongs to, as the roll metadata states it. */
153
+ /**
154
+ * The roll system a tracker bar belongs to, as the roll metadata states it.
155
+ * @category Vocabulary
156
+ */
135
157
  export declare const systemOf: (bar: TrackerBar) => Concept;
136
- /** The identifier of a system the type vocabulary knows, from the IRI naming it. */
158
+ /**
159
+ * The identifier of a system the type vocabulary knows, from the IRI naming it.
160
+ * @category Vocabulary
161
+ */
137
162
  export declare const systemIdIn: (id: string | undefined) => string | undefined;
138
- /** The identifier of a system the type vocabulary knows, from its concept. */
163
+ /**
164
+ * The identifier of a system the type vocabulary knows, from its concept.
165
+ * @category Vocabulary
166
+ */
139
167
  export declare const systemIdOf: (system: Concept | undefined) => string | undefined;
140
168
  /**
141
169
  * Where a roll's own content ends, as far as its perforations say.
@@ -144,12 +172,16 @@ export declare const systemIdOf: (system: Concept | undefined) => string | undef
144
172
  * the rewind is *punched*, not when the rewind pneumatic takes hold. The second
145
173
  * is a matter of valve lift and belongs to whatever performs the roll. Keeping
146
174
  * them apart is what lets collation and counting ask this without an emulator.
175
+ * @category Systems and emulation
147
176
  */
148
177
  export type RollEnd = {
149
178
  readonly at: Millimeters;
150
179
  readonly because: 'rewind';
151
180
  };
152
- /** Anything carrying a place on the roll and a position on the bar. */
181
+ /**
182
+ * Anything carrying a place on the roll and a position on the bar.
183
+ * @category Systems and emulation
184
+ */
153
185
  export type PlacedOnBar = {
154
186
  readonly horizontal: {
155
187
  readonly from: Millimeters;
@@ -163,6 +195,7 @@ export type PlacedOnBar = {
163
195
  * Where a feature lies across the bar: one place, or a run of them where
164
196
  * `to` is given. Structural, so a feature's `vertical` passes as it is and
165
197
  * this module need know nothing about features.
198
+ * @category Systems and emulation
166
199
  */
167
200
  export type OnBar = {
168
201
  readonly from: Track;
@@ -172,6 +205,7 @@ export type OnBar = {
172
205
  * A tracker bar as written down, with its positions as plain numbers
173
206
  * in the bar's own 1-based numbering; `describeTrackerBar` gives them
174
207
  * their type.
208
+ * @category Systems and emulation
175
209
  */
176
210
  export interface TrackerBarSpec {
177
211
  id: string;
@@ -211,11 +245,18 @@ export interface TrackerBarSpec {
211
245
  /** How the system spells a single added accent; see `TrackerBar.accents`. */
212
246
  accents?: readonly (readonly string[])[];
213
247
  }
248
+ /**
249
+ * The tracker bar a description gives, its positions typed and its
250
+ * readings worked out. Throws where the description names no rewind
251
+ * position, or names expression types its bar does not read.
252
+ * @category Systems and emulation
253
+ */
214
254
  export declare const describeTrackerBar: (spec: TrackerBarSpec) => TrackerBar;
215
255
  /**
216
256
  * Puts a position of one bar onto the position of another that reads
217
257
  * the same thing, or nowhere when the other bar does not read it. This
218
258
  * is how a copy read in one system's numbering is put into another's,
219
259
  * as the migration does for a Licensee copy stored on T-100 tracks.
260
+ * @category Systems and emulation
220
261
  */
221
262
  export declare const translationBetween: (from: TrackerBar, to: TrackerBar) => (position: Track) => Track | undefined;
@@ -3,16 +3,26 @@ import { mm, track } from "../model/Quantity.js";
3
3
  * What a position says, as a key. Two bars read the same thing exactly
4
4
  * where their keys agree, which is what lets a symbol cross from one
5
5
  * system to another and what decides whether two symbols collate.
6
+ * @category Systems and emulation
6
7
  */
7
8
  export const keyOf = (meaning) => meaning.type === 'note'
8
9
  ? `note ${meaning.pitch}`
9
10
  : `expression ${meaning.scope} ${meaning.expressionType}`;
10
11
  const SYSTEM_IRI = 'https://w3id.org/reo/type/system/';
11
- /** The roll system a tracker bar belongs to, as the roll metadata states it. */
12
+ /**
13
+ * The roll system a tracker bar belongs to, as the roll metadata states it.
14
+ * @category Vocabulary
15
+ */
12
16
  export const systemOf = (bar) => ({ id: SYSTEM_IRI + bar.id, name: bar.name, sameAs: [] });
13
- /** The identifier of a system the type vocabulary knows, from the IRI naming it. */
17
+ /**
18
+ * The identifier of a system the type vocabulary knows, from the IRI naming it.
19
+ * @category Vocabulary
20
+ */
14
21
  export const systemIdIn = (id) => id?.startsWith(SYSTEM_IRI) ? id.slice(SYSTEM_IRI.length) : undefined;
15
- /** The identifier of a system the type vocabulary knows, from its concept. */
22
+ /**
23
+ * The identifier of a system the type vocabulary knows, from its concept.
24
+ * @category Vocabulary
25
+ */
16
26
  export const systemIdOf = (system) => systemIdIn(system?.id);
17
27
  const areasOf = ({ notes, trackCount }) => [
18
28
  { role: 'bass-expression', from: track(1), to: track(notes.from - 1) },
@@ -32,6 +42,12 @@ const positionsBetween = (span) => {
32
42
  const [first, last] = [Math.min(...ends), Math.max(...ends)];
33
43
  return Array.from({ length: last - first + 1 }, (_, step) => track(first + step));
34
44
  };
45
+ /**
46
+ * The tracker bar a description gives, its positions typed and its
47
+ * readings worked out. Throws where the description names no rewind
48
+ * position, or names expression types its bar does not read.
49
+ * @category Systems and emulation
50
+ */
35
51
  export const describeTrackerBar = (spec) => {
36
52
  const areas = areasOf(spec);
37
53
  const areaAt = (position) => areas.find(area => position >= area.from && position <= area.to)?.role;
@@ -108,6 +124,7 @@ export const describeTrackerBar = (spec) => {
108
124
  * the same thing, or nowhere when the other bar does not read it. This
109
125
  * is how a copy read in one system's numbering is put into another's,
110
126
  * as the migration does for a Licensee copy stored on T-100 tracks.
127
+ * @category Systems and emulation
111
128
  */
112
129
  export const translationBetween = (from, to) => (position) => {
113
130
  const meaning = from.meaningOf(position);
@@ -1,12 +1,19 @@
1
1
  import { Concept } from "../model/Agent.js";
2
2
  import { TrackerBar } from "./TrackerBar.js";
3
- /** The tracker bars the library knows, the T-100 first as the usual one. */
3
+ /**
4
+ * The tracker bars the library knows, the T-100 first as the usual one.
5
+ * @category Systems and emulation
6
+ */
4
7
  export declare const trackerBars: readonly TrackerBar[];
5
- /** The bar of a system the type vocabulary knows, from its concept. */
8
+ /**
9
+ * The bar of a system the type vocabulary knows, from its concept.
10
+ * @category Systems and emulation
11
+ */
6
12
  export declare const trackerBarOf: (system: Concept | undefined) => TrackerBar | undefined;
7
13
  /**
8
14
  * The bar a copy is read by where it names no system of its own: every
9
15
  * copy was read by the T-100's before the systems were told apart, and
10
16
  * `reservationsAbout` reports a copy that still relies on this.
17
+ * @category Systems and emulation
11
18
  */
12
19
  export declare const defaultTrackerBar: TrackerBar;
@@ -2,9 +2,15 @@ import { systemIdOf } from "./TrackerBar.js";
2
2
  import { welteT100 } from "./welteT100/bar.js";
3
3
  import { welteLicensee } from "./welteLicensee/bar.js";
4
4
  import { welteT98 } from "./welteT98/bar.js";
5
- /** The tracker bars the library knows, the T-100 first as the usual one. */
5
+ /**
6
+ * The tracker bars the library knows, the T-100 first as the usual one.
7
+ * @category Systems and emulation
8
+ */
6
9
  export const trackerBars = [welteT100, welteLicensee, welteT98];
7
- /** The bar of a system the type vocabulary knows, from its concept. */
10
+ /**
11
+ * The bar of a system the type vocabulary knows, from its concept.
12
+ * @category Systems and emulation
13
+ */
8
14
  export const trackerBarOf = (system) => {
9
15
  const id = systemIdOf(system);
10
16
  return trackerBars.find(bar => bar.id === id);
@@ -13,5 +19,6 @@ export const trackerBarOf = (system) => {
13
19
  * The bar a copy is read by where it names no system of its own: every
14
20
  * copy was read by the T-100's before the systems were told apart, and
15
21
  * `reservationsAbout` reports a copy that still relies on this.
22
+ * @category Systems and emulation
16
23
  */
17
24
  export const defaultTrackerBar = welteT100;
@@ -19,6 +19,7 @@
19
19
  * suction-to-velocity relation "essentially logarithmic" (pp. 215 f.). The
20
20
  * default should change only once a red/green comparison has been run both ways
21
21
  * and the difference measured, and then for both systems at once.
22
+ * @category Systems and emulation
22
23
  */
23
24
  export type VelocityMap = {
24
25
  piano: number;
@@ -19,6 +19,7 @@
19
19
  * suction-to-velocity relation "essentially logarithmic" (pp. 215 f.). The
20
20
  * default should change only once a red/green comparison has been run both ways
21
21
  * and the difference measured, and then for both systems at once.
22
+ * @category Systems and emulation
22
23
  */
23
24
  /** midi2exp's three velocities, which is what the T-100's published results used. */
24
25
  export const defaultVelocityMap = { piano: 35, mezzoforte: 60, forte: 90 };