linked-rolls 0.54.0 → 0.56.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/README.md +13 -12
- package/lib/Emulation.js +1 -1
- package/lib/Feature.d.ts +31 -30
- package/lib/Feature.js +5 -5
- package/lib/FeatureSource.d.ts +1 -1
- package/lib/FeatureSource.js +1 -1
- package/lib/ReproducingSystem.d.ts +2 -2
- package/lib/RollCopy.d.ts +18 -18
- package/lib/RollCopy.js +7 -7
- package/lib/Symbol.d.ts +6 -6
- package/lib/alignment.d.ts +14 -14
- package/lib/alignment.js +26 -26
- package/lib/asJsonLd.js +2 -2
- package/lib/editionOps.d.ts +3 -3
- package/lib/editionOps.js +9 -9
- package/lib/migrate.js +19 -8
- package/lib/readers/phillipsEroll.d.ts +6 -6
- package/lib/readers/phillipsEroll.js +8 -8
- package/lib/readers/spencerBar.d.ts +1 -1
- package/lib/readers/spencerBar.js +2 -2
- package/lib/readers/stanfordAton.js +1 -1
- package/lib/schema.json +109 -109
- package/lib/spec/context.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -153,19 +153,20 @@ and the onset alone 39, so neither test is idle, but a difference at the
|
|
|
153
153
|
end is as often a punch measured badly as a punch genuinely prolonged,
|
|
154
154
|
and the two are not worth confusing.
|
|
155
155
|
|
|
156
|
-
## What a reader adds to a
|
|
156
|
+
## What a reader adds to a chain of holes
|
|
157
157
|
|
|
158
158
|
A copy read pneumatically rather than scanned reports how long a valve
|
|
159
159
|
stayed open, and a valve is held on past the perforation that opened it,
|
|
160
|
-
so
|
|
161
|
-
Left in, that is not a difference between copies: a
|
|
162
|
-
such a copy's
|
|
163
|
-
with a slot, and reads the one as a lengthening of
|
|
160
|
+
so the chains it reports run longer than the punched ones while their
|
|
161
|
+
onsets agree. Left in, that is not a difference between copies: a
|
|
162
|
+
collation comparing such a copy's chain ends against a scanned copy's
|
|
163
|
+
compares an on-time with a slot, and reads the one as a lengthening of
|
|
164
|
+
the other.
|
|
164
165
|
|
|
165
|
-
`
|
|
166
|
+
`shortenChains` takes the extension off and records it on the copy,
|
|
166
167
|
`revertShortening` puts it back, and `readFromPhillipsEroll` will take
|
|
167
|
-
it off at import. Only holes are touched, what a writing spans
|
|
168
|
-
valve. The figure is measured against the other copies rather than
|
|
168
|
+
it off at import. Only chains of holes are touched, what a writing spans
|
|
169
|
+
being no valve. The figure is measured against the other copies rather than
|
|
169
170
|
derived from the bar, since Phillips gives only the difference between
|
|
170
171
|
two bars and not the absolute.
|
|
171
172
|
|
|
@@ -223,7 +224,7 @@ hand, and says nothing about what kind of feature it is. A hole may be
|
|
|
223
224
|
punched by hand long after the roll was cut, and a mark may come from
|
|
224
225
|
the factory, rarely though that happens. A feature no later act is
|
|
225
226
|
known to have made belongs to the punching, which is where a reading of
|
|
226
|
-
a scan puts every
|
|
227
|
+
a scan puts every chain of holes it finds.
|
|
227
228
|
|
|
228
229
|
Three kinds of act rather than two, because the CRM tells them apart.
|
|
229
230
|
E79 Part Addition asks that what is added be "a separate identifiable
|
|
@@ -358,9 +359,9 @@ repository.
|
|
|
358
359
|
|
|
359
360
|
### Alignment, order and pairing
|
|
360
361
|
|
|
361
|
-
A command takes its place from the holes that carry it. Four
|
|
362
|
-
on a command let an editor state where the measurement should
|
|
363
|
-
way. `alignedWith` names another command whose onset this one takes
|
|
362
|
+
A command takes its place from the chains of holes that carry it. Four
|
|
363
|
+
fields on a command let an editor state where the measurement should
|
|
364
|
+
give way. `alignedWith` names another command whose onset this one takes
|
|
364
365
|
in the performance, as a "crescendo off" is meant to fall on the note
|
|
365
366
|
it belongs to. `before` and `after` name a command whose onset this
|
|
366
367
|
one precedes or follows, without saying by how much: where the copies
|
package/lib/Emulation.js
CHANGED
|
@@ -15,7 +15,7 @@ const propertiesOf = (view, version) => ({
|
|
|
15
15
|
tempo: view.edition.tempoAdjustment,
|
|
16
16
|
toOwnPaper: view.toOwnPaperOf(version)
|
|
17
17
|
});
|
|
18
|
-
/** The onset a symbol has on each copy carrying it, by the copy's index, as the mean of its
|
|
18
|
+
/** The onset a symbol has on each copy carrying it, by the copy's index, as the mean of its chains there. */
|
|
19
19
|
const onsetsByCopy = (view, symbolId) => {
|
|
20
20
|
const symbol = view.get(symbolId);
|
|
21
21
|
if (!symbol)
|
package/lib/Feature.d.ts
CHANGED
|
@@ -53,12 +53,12 @@ export interface VerticalSpan {
|
|
|
53
53
|
*/
|
|
54
54
|
to?: Track;
|
|
55
55
|
}
|
|
56
|
-
export declare const featureTypes: readonly ['
|
|
56
|
+
export declare const featureTypes: readonly ['HoleChain', 'Writing', 'Mark', 'Patch'];
|
|
57
57
|
export type FeatureType = typeof featureTypes[number];
|
|
58
58
|
export declare const isFeatureType: (value: unknown) => value is FeatureType;
|
|
59
59
|
/**
|
|
60
60
|
* A feature on the roll, e.g. a perforation, a writing, a mark or a
|
|
61
|
-
*
|
|
61
|
+
* patch, defined by its horizontal and vertical position and
|
|
62
62
|
* extent. Each kind of feature is a class of its own, which its type
|
|
63
63
|
* names.
|
|
64
64
|
*/
|
|
@@ -86,10 +86,10 @@ export interface RollFeature<T extends FeatureType, DamageT extends string> exte
|
|
|
86
86
|
condition?: ObjectAssumption<ConditionState<DamageT>>;
|
|
87
87
|
}
|
|
88
88
|
export declare const conditions: {
|
|
89
|
-
readonly
|
|
89
|
+
readonly HoleChain: readonly ["partially-torn", "missing-perforation"];
|
|
90
90
|
readonly Writing: readonly ["illegible"];
|
|
91
91
|
readonly Mark: readonly ["faded"];
|
|
92
|
-
readonly
|
|
92
|
+
readonly Patch: readonly ["detaching", "ripped"];
|
|
93
93
|
};
|
|
94
94
|
/** The kinds of condition a feature may be in, whichever kind of feature it is. */
|
|
95
95
|
export type FeatureConditionType = typeof conditions[FeatureType][number];
|
|
@@ -100,19 +100,21 @@ export type FeatureConditionType = typeof conditions[FeatureType][number];
|
|
|
100
100
|
*/
|
|
101
101
|
export type FeatureConditionAssignment = ObjectAssumption<ConditionState<FeatureConditionType>>;
|
|
102
102
|
/**
|
|
103
|
-
* A
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
103
|
+
* A chain of holes punched along the roll, which the tracker bar reads
|
|
104
|
+
* as it passes. The perforator cuts a held note or function as a row of
|
|
105
|
+
* punches with bridges of paper left between them, so most perforations
|
|
106
|
+
* are chains; one without a bridge is a chain of a single hole. The
|
|
107
|
+
* holes are the chain's parts and are not stated one by one. A punched
|
|
108
|
+
* chain is a human-made feature: CRM counts "the information encoding
|
|
109
|
+
* features on mechanical or digital carriers" among the features
|
|
110
|
+
* purposely created by human activity.
|
|
111
|
+
* @see reo:HoleChain
|
|
110
112
|
*/
|
|
111
|
-
export interface
|
|
113
|
+
export interface HoleChain extends RollFeature<'HoleChain', typeof conditions.HoleChain[number]> {
|
|
112
114
|
}
|
|
113
115
|
/**
|
|
114
116
|
* Something that lies on a face of the paper rather than through it. A
|
|
115
|
-
*
|
|
117
|
+
* chain of holes is not one: it goes through, and is on both faces at once.
|
|
116
118
|
*/
|
|
117
119
|
export interface OnAFace {
|
|
118
120
|
/**
|
|
@@ -189,15 +191,14 @@ export interface Writing extends Trace<'Writing'> {
|
|
|
189
191
|
export interface Mark extends Trace<'Mark'> {
|
|
190
192
|
}
|
|
191
193
|
/**
|
|
192
|
-
* A piece of
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* @see reo:GluedOn
|
|
194
|
+
* A piece of paper or tape glued onto the roll: a label naming it, a
|
|
195
|
+
* strip covering perforations, or a patch reinforcing a tear. A patch
|
|
196
|
+
* may itself carry other features, such as writings or holes.
|
|
197
|
+
* @see reo:Patch
|
|
197
198
|
*/
|
|
198
|
-
export interface
|
|
199
|
+
export interface Patch extends RollFeature<'Patch', typeof conditions.Patch[number]>, OnAFace {
|
|
199
200
|
/**
|
|
200
|
-
*
|
|
201
|
+
* What the patch is made of.
|
|
201
202
|
* @see crm:P45 consists of
|
|
202
203
|
*/
|
|
203
204
|
material: 'paper' | 'tape';
|
|
@@ -209,24 +210,24 @@ export interface GluedOn extends RollFeature<'GluedOn', typeof conditions.GluedO
|
|
|
209
210
|
*/
|
|
210
211
|
rotation?: Measure<'deg'>;
|
|
211
212
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
213
|
+
* The features the patch itself carries. They need not be
|
|
214
|
+
* positioned explicitly.
|
|
214
215
|
* @see crm:P46 is composed of
|
|
215
216
|
*/
|
|
216
217
|
features?: NestedFeature[];
|
|
217
218
|
}
|
|
218
219
|
/**
|
|
219
|
-
* The features proper: a
|
|
220
|
-
* features, and each of them is borne by whatever it sits on.
|
|
221
|
-
* is an object glued onto the paper and stands apart from them.
|
|
220
|
+
* The features proper: a chain of holes, a writing and a mark are all
|
|
221
|
+
* human-made features, and each of them is borne by whatever it sits on.
|
|
222
|
+
* A patch is an object glued onto the paper and stands apart from them.
|
|
222
223
|
*/
|
|
223
|
-
export type AnyFeature =
|
|
224
|
+
export type AnyFeature = HoleChain | Writing | Mark;
|
|
224
225
|
/**
|
|
225
226
|
* Anything found at a place of its own on the roll: a feature or a
|
|
226
|
-
*
|
|
227
|
-
*
|
|
227
|
+
* patch. E24 Physical Human-Made Thing is the class both fall under,
|
|
228
|
+
* E22 and E25 being its subclasses.
|
|
228
229
|
*/
|
|
229
|
-
export type FeatureOrPatch = AnyFeature |
|
|
230
|
+
export type FeatureOrPatch = AnyFeature | Patch;
|
|
230
231
|
/**
|
|
231
232
|
* A feature without the place it would state of its own. The union is
|
|
232
233
|
* distributed over, so that each kind of feature keeps its own keys.
|
|
@@ -238,7 +239,7 @@ type Unplaced<T> = T extends FeatureOrPatch ? PartialBy<T, 'horizontal' | 'verti
|
|
|
238
239
|
*/
|
|
239
240
|
export type NestedFeature = Unplaced<FeatureOrPatch>;
|
|
240
241
|
export declare const isRollFeature: (obj: object) => obj is FeatureOrPatch;
|
|
241
|
-
export declare const
|
|
242
|
+
export declare const isPatch: <T extends NestedFeature>(feature: T) => feature is T & Patch;
|
|
242
243
|
/** The features a feature bears: a patch those stated as parts of it, any other feature none. */
|
|
243
244
|
export declare const featuresBorneBy: (feature: NestedFeature) => NestedFeature[];
|
|
244
245
|
/** The feature together with everything it bears, as deep as a patch on a patch goes. */
|
package/lib/Feature.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export const featureTypes = ['
|
|
1
|
+
export const featureTypes = ['HoleChain', 'Writing', 'Mark', 'Patch'];
|
|
2
2
|
export const isFeatureType = (value) => featureTypes.includes(value);
|
|
3
3
|
export const conditions = {
|
|
4
|
-
|
|
4
|
+
HoleChain: ['partially-torn', 'missing-perforation'],
|
|
5
5
|
Writing: ['illegible'],
|
|
6
6
|
Mark: ['faded'],
|
|
7
|
-
|
|
7
|
+
Patch: ['detaching', 'ripped']
|
|
8
8
|
};
|
|
9
9
|
export const techniques = ['print', 'handwriting', 'stamp'];
|
|
10
10
|
export const media = ['ink', 'pencil', 'crayon'];
|
|
11
11
|
export const isRollFeature = (obj) => {
|
|
12
12
|
return 'type' in obj && isFeatureType(obj.type);
|
|
13
13
|
};
|
|
14
|
-
export const
|
|
14
|
+
export const isPatch = (feature) => feature.type === 'Patch';
|
|
15
15
|
/** The features a feature bears: a patch those stated as parts of it, any other feature none. */
|
|
16
|
-
export const featuresBorneBy = (feature) =>
|
|
16
|
+
export const featuresBorneBy = (feature) => isPatch(feature) ? feature.features ?? [] : [];
|
|
17
17
|
/** The feature together with everything it bears, as deep as a patch on a patch goes. */
|
|
18
18
|
export const withBorneFeatures = (feature) => [feature, ...featuresBorneBy(feature).flatMap(withBorneFeatures)];
|
package/lib/FeatureSource.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const sourceLabels: Record<SourceKind, string>;
|
|
|
16
16
|
* roll reader measures when each perforation passes its bar. An
|
|
17
17
|
* emulation and a recording give the reading somebody else made: the
|
|
18
18
|
* roll has been turned into notes and commands already, and turning
|
|
19
|
-
* those back into holes reconstructs them.
|
|
19
|
+
* those back into chains of holes reconstructs them.
|
|
20
20
|
*/
|
|
21
21
|
export declare const isMeasured: (kind: SourceKind) => boolean;
|
|
22
22
|
/**
|
package/lib/FeatureSource.js
CHANGED
|
@@ -27,7 +27,7 @@ const physical = ['roll', 'scan'];
|
|
|
27
27
|
* roll reader measures when each perforation passes its bar. An
|
|
28
28
|
* emulation and a recording give the reading somebody else made: the
|
|
29
29
|
* roll has been turned into notes and commands already, and turning
|
|
30
|
-
* those back into holes reconstructs them.
|
|
30
|
+
* those back into chains of holes reconstructs them.
|
|
31
31
|
*/
|
|
32
32
|
export const isMeasured = (kind) => measured.includes(kind);
|
|
33
33
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HoleChain } from "./Feature.js";
|
|
2
2
|
import { Expression, Note } from "./Symbol.js";
|
|
3
3
|
import { TrackerBar } from "./TrackerBar.js";
|
|
4
4
|
import { Millimeters, Quantity, Seconds } from "./Quantity.js";
|
|
@@ -32,7 +32,7 @@ export type RollTempo = RollTempoIn<'ft/min'> | RollTempoIn<'m/min'>;
|
|
|
32
32
|
* averaged in and the editorial assumptions applied, which is all a
|
|
33
33
|
* performance needs to know of a symbol.
|
|
34
34
|
*/
|
|
35
|
-
export type NegotiatedEvent = Omit<Note | Expression, 'carriers'> & Pick<
|
|
35
|
+
export type NegotiatedEvent = Omit<Note | Expression, 'carriers'> & Pick<HoleChain, 'horizontal' | 'vertical'>;
|
|
36
36
|
interface PerformedRollFeature<T> {
|
|
37
37
|
type: T;
|
|
38
38
|
performs: NegotiatedEvent;
|
package/lib/RollCopy.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ConditionState } from "./ConditionState.js";
|
|
|
2
2
|
import { AnySymbol } from "./Symbol.js";
|
|
3
3
|
import { TrackerBar } from "./TrackerBar.js";
|
|
4
4
|
import { TrackCalibration } from "./TrackCalibration.js";
|
|
5
|
-
import { AnyFeature, FeatureOrPatch,
|
|
5
|
+
import { AnyFeature, FeatureOrPatch, Patch } from "./Feature.js";
|
|
6
6
|
import { ActorAssignment, DateAssignment, ObjectAssumption, ReferenceAssumption } from "./Assumption.js";
|
|
7
7
|
import { WithId, WithType } from "./utils.js";
|
|
8
8
|
import { Agent, Concept } from "./Agent.js";
|
|
@@ -124,10 +124,10 @@ export interface ProductionEvent {
|
|
|
124
124
|
/**
|
|
125
125
|
* The features the copy came from its punching with: the note and
|
|
126
126
|
* expression perforations, and now and then a mark the perforator
|
|
127
|
-
* left. A reading of a scan finds every
|
|
128
|
-
* and states it here, and a feature an editor reads as the
|
|
129
|
-
* a later hand belongs in the act that made it, whichever
|
|
130
|
-
* feature it is.
|
|
127
|
+
* left. A reading of a scan finds every chain of holes on the paper
|
|
128
|
+
* at once and states it here, and a feature an editor reads as the
|
|
129
|
+
* work of a later hand belongs in the act that made it, whichever
|
|
130
|
+
* kind of feature it is.
|
|
131
131
|
* @see crm:P108 has produced
|
|
132
132
|
*/
|
|
133
133
|
produced?: AnyFeature[];
|
|
@@ -161,7 +161,7 @@ export type Modification = Partial<{
|
|
|
161
161
|
* The patches glued onto the copy, each with whatever it bears.
|
|
162
162
|
* @see crm:P111 added
|
|
163
163
|
*/
|
|
164
|
-
added:
|
|
164
|
+
added: Patch[];
|
|
165
165
|
/**
|
|
166
166
|
* @see crm:P21 had general purpose
|
|
167
167
|
*/
|
|
@@ -266,24 +266,24 @@ export interface RollCopy extends WithType<'RollCopy'>, WithId {
|
|
|
266
266
|
*/
|
|
267
267
|
scale: number;
|
|
268
268
|
/**
|
|
269
|
-
* What a pneumatic reader added to this copy's holes,
|
|
270
|
-
* was taken off again. Such a reader reports how long a
|
|
271
|
-
* stayed open, which exceeds the perforation that opened it,
|
|
272
|
-
* its
|
|
273
|
-
* Nothing for a copy read by other means, whose
|
|
274
|
-
* punched
|
|
269
|
+
* What a pneumatic reader added to this copy's chains of holes,
|
|
270
|
+
* where it was taken off again. Such a reader reports how long a
|
|
271
|
+
* valve stayed open, which exceeds the perforation that opened it,
|
|
272
|
+
* so its chains are overlong by a constant while its onsets agree.
|
|
273
|
+
* Nothing for a copy read by other means, whose chains are the
|
|
274
|
+
* punched ones themselves.
|
|
275
275
|
* Not exported to RDF.
|
|
276
276
|
*/
|
|
277
277
|
readerExtension: {
|
|
278
|
-
/** How much longer the reading of a
|
|
278
|
+
/** How much longer the reading of a chain ran than the perforation that caused it. */
|
|
279
279
|
length: Millimeters;
|
|
280
280
|
/**
|
|
281
|
-
* The
|
|
281
|
+
* The chains it was not taken off, by `@id`, being no longer
|
|
282
282
|
* than it is. The constant reaches its limit there rather
|
|
283
283
|
* than the copy being wrong, and why they were left is for
|
|
284
284
|
* the edition to state about the features themselves; this
|
|
285
285
|
* only records that they stand as the reader gave them, so
|
|
286
|
-
* that putting the extension back does not lengthen a
|
|
286
|
+
* that putting the extension back does not lengthen a chain
|
|
287
287
|
* nothing was taken from.
|
|
288
288
|
*/
|
|
289
289
|
leaving?: string[];
|
|
@@ -411,8 +411,8 @@ export declare const barOf: (copy: Pick<RollCopy, 'production'>) => TrackerBar;
|
|
|
411
411
|
export declare const punchDiameterOf: (copy: Pick<RollCopy, 'production'>) => Millimeters | undefined;
|
|
412
412
|
/**
|
|
413
413
|
* Reads the features of a copy as the tracker bar would read them.
|
|
414
|
-
*
|
|
415
|
-
* dropped, which is what happens physically as well.
|
|
414
|
+
* Chains of holes on a position the bar does not read carry no symbol
|
|
415
|
+
* and are dropped, which is what happens physically as well.
|
|
416
416
|
*
|
|
417
417
|
* The bar is named rather than defaulted: a copy is read by its own
|
|
418
418
|
* bar, and reading a green copy with the red one is a silent semitone.
|
|
@@ -428,7 +428,7 @@ export declare const punchDiameterOf: (copy: Pick<RollCopy, 'production'>) => Mi
|
|
|
428
428
|
export declare function asSymbols(features: readonly FeatureOrPatch[], bar: TrackerBar): AnySymbol[];
|
|
429
429
|
/**
|
|
430
430
|
* The tracks a copy carries holes on that the tracker bar does not read.
|
|
431
|
-
* A non-empty result usually means the scan is calibrated wrongly. A
|
|
431
|
+
* A non-empty result usually means the scan is calibrated wrongly. A chain
|
|
432
432
|
* lying across several positions is counted against each one the bar
|
|
433
433
|
* cannot read, and not at all where it reads them all.
|
|
434
434
|
*/
|
package/lib/RollCopy.js
CHANGED
|
@@ -54,8 +54,8 @@ export const punchDiameterOf = (copy) => {
|
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
56
|
* Reads the features of a copy as the tracker bar would read them.
|
|
57
|
-
*
|
|
58
|
-
* dropped, which is what happens physically as well.
|
|
57
|
+
* Chains of holes on a position the bar does not read carry no symbol
|
|
58
|
+
* and are dropped, which is what happens physically as well.
|
|
59
59
|
*
|
|
60
60
|
* The bar is named rather than defaulted: a copy is read by its own
|
|
61
61
|
* bar, and reading a green copy with the red one is a silent semitone.
|
|
@@ -69,9 +69,9 @@ export const punchDiameterOf = (copy) => {
|
|
|
69
69
|
* scan; it is the reading that stops.
|
|
70
70
|
*/
|
|
71
71
|
export function asSymbols(features, bar) {
|
|
72
|
-
const
|
|
73
|
-
const end = bar.endsAt(
|
|
74
|
-
return
|
|
72
|
+
const chains = features.filter(feature => feature.type === 'HoleChain');
|
|
73
|
+
const end = bar.endsAt(chains);
|
|
74
|
+
return chains
|
|
75
75
|
.filter(feature => end === undefined || feature.horizontal.from <= end.at)
|
|
76
76
|
// An opening across two positions uncovers both bar holes and so
|
|
77
77
|
// reads as both commands; one on a single position gives the one.
|
|
@@ -83,14 +83,14 @@ export function asSymbols(features, bar) {
|
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* The tracks a copy carries holes on that the tracker bar does not read.
|
|
86
|
-
* A non-empty result usually means the scan is calibrated wrongly. A
|
|
86
|
+
* A non-empty result usually means the scan is calibrated wrongly. A chain
|
|
87
87
|
* lying across several positions is counted against each one the bar
|
|
88
88
|
* cannot read, and not at all where it reads them all.
|
|
89
89
|
*/
|
|
90
90
|
export function unreadTracks(features, bar) {
|
|
91
91
|
const counts = new Map();
|
|
92
92
|
features
|
|
93
|
-
.filter(feature => feature.type === '
|
|
93
|
+
.filter(feature => feature.type === 'HoleChain')
|
|
94
94
|
.flatMap(feature => bar.positionsIn(feature.vertical))
|
|
95
95
|
.filter(position => !bar.meaningOf(position))
|
|
96
96
|
.forEach(position => counts.set(position, (counts.get(position) || 0) + 1));
|
package/lib/Symbol.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { WithId } from "./utils.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* A symbol is an abstract musical or textual entity carried by one or more
|
|
5
5
|
* physical features on the roll. Symbols are the result of interpreting
|
|
6
|
-
* the physical features (holes, writings, etc.) on the roll copies.
|
|
6
|
+
* the physical features (chains of holes, writings, etc.) on the roll copies.
|
|
7
7
|
* @see crm:E90 Symbolic Object
|
|
8
8
|
*/
|
|
9
9
|
export interface Symbol<T extends string> extends WithId {
|
|
10
10
|
type: T;
|
|
11
11
|
/**
|
|
12
|
-
* References to the physical features (e.g. holes) on the roll copies
|
|
12
|
+
* References to the physical features (e.g. chains of holes) on the roll copies
|
|
13
13
|
* that carry this symbol. Since the association might be debatable,
|
|
14
14
|
* it can be annotated. There might be e.g. doubts about the meaning
|
|
15
15
|
* and correct transcription of a feature on a physical roll.
|
|
@@ -21,10 +21,10 @@ export interface Symbol<T extends string> extends WithId {
|
|
|
21
21
|
export declare const isSymbol: (object: any) => object is AnySymbol;
|
|
22
22
|
export declare const isCommand: (symbol: object | undefined) => symbol is AnyCommand;
|
|
23
23
|
/**
|
|
24
|
-
* A command is what the tracker bar reads from a
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* A command is what the tracker bar reads from a chain of holes: the
|
|
25
|
+
* note it sounds, or the function it operates. It is typically carried
|
|
26
|
+
* by such a chain, but it might also have different physical
|
|
27
|
+
* appearances.
|
|
28
28
|
* @see reo:Command
|
|
29
29
|
*/
|
|
30
30
|
export interface Command<T extends string> extends Symbol<T> {
|
package/lib/alignment.d.ts
CHANGED
|
@@ -11,13 +11,13 @@ export declare const revertShift: (copy: RollCopy) => void;
|
|
|
11
11
|
export declare const revertScale: (copy: RollCopy) => void;
|
|
12
12
|
/**
|
|
13
13
|
* Takes the extension a pneumatic reader adds off the ends of the
|
|
14
|
-
* copy's holes, and records how much was taken.
|
|
14
|
+
* copy's chains of holes, and records how much was taken.
|
|
15
15
|
*
|
|
16
16
|
* Such a reader reports how long a valve stayed open, and a valve is
|
|
17
|
-
* held on past the perforation that opened it, so its
|
|
18
|
-
* than the punched
|
|
17
|
+
* held on past the perforation that opened it, so its chains run longer
|
|
18
|
+
* than the punched ones while their onsets agree. Left in, the
|
|
19
19
|
* difference is not a difference between copies at all: a collation
|
|
20
|
-
* comparing this copy's
|
|
20
|
+
* comparing this copy's chain ends against a scanned copy's compares a
|
|
21
21
|
* pneumatic on-time with a punched slot, and reads the one as a
|
|
22
22
|
* lengthening of the other.
|
|
23
23
|
*
|
|
@@ -30,10 +30,10 @@ export declare const revertScale: (copy: RollCopy) => void;
|
|
|
30
30
|
* way and without any gradient across the bar, which is measured but
|
|
31
31
|
* too coarse to model from one roll.
|
|
32
32
|
*
|
|
33
|
-
* Only holes are touched. What a writing or a mark spans is no valve.
|
|
33
|
+
* Only chains of holes are touched. What a writing or a mark spans is no valve.
|
|
34
34
|
*/
|
|
35
35
|
/**
|
|
36
|
-
* The
|
|
36
|
+
* The chains the extension cannot be taken off, being no longer than it
|
|
37
37
|
* is: the reader reported them open for less time than it holds a valve
|
|
38
38
|
* on beyond the perforation, so the constant over-corrects them and
|
|
39
39
|
* would leave them ending before they begin.
|
|
@@ -41,23 +41,23 @@ export declare const revertScale: (copy: RollCopy) => void;
|
|
|
41
41
|
* They are where the constant shows its limit rather than where the
|
|
42
42
|
* copy is wrong, the extension varying by about half a millimetre with
|
|
43
43
|
* the port. What to do with them is an editorial question — a condition
|
|
44
|
-
* on the feature, a reading of the
|
|
45
|
-
* `
|
|
44
|
+
* on the feature, a reading of the chain, a smaller extension — and
|
|
45
|
+
* `shortenChains` throws rather than answer it.
|
|
46
46
|
*/
|
|
47
47
|
export declare const tooShortToShorten: (extension: Millimeters, copy: RollCopy, leaving?: ReadonlySet<string>) => Readonly<FeatureOrPatch>[];
|
|
48
48
|
/**
|
|
49
|
-
* Takes the extension off, leaving the named
|
|
50
|
-
* them. Naming a
|
|
49
|
+
* Takes the extension off, leaving the named chains as the reader gave
|
|
50
|
+
* them. Naming a chain is an editorial act and not a repair: it says
|
|
51
51
|
* this one is where the constant stops applying, and the edition is
|
|
52
52
|
* what has to say why. The copy records which were left, so that
|
|
53
|
-
* putting the extension back does not lengthen a
|
|
53
|
+
* putting the extension back does not lengthen a chain nothing was
|
|
54
54
|
* taken from.
|
|
55
55
|
*
|
|
56
|
-
* Throws where a
|
|
56
|
+
* Throws where a chain that was not named is no longer than the
|
|
57
57
|
* extension, `tooShortToShorten` saying beforehand which those are.
|
|
58
58
|
*/
|
|
59
|
-
export declare const
|
|
60
|
-
/** Puts the reader's extension back on the
|
|
59
|
+
export declare const shortenChains: (extension: Millimeters, copy: RollCopy, leaving?: ReadonlySet<string>) => void;
|
|
60
|
+
/** Puts the reader's extension back on the chains it was taken off, as far as one was taken off. */
|
|
61
61
|
export declare const revertShortening: (copy: RollCopy) => void;
|
|
62
62
|
/**
|
|
63
63
|
* How a copy's places are carried onto another copy's:
|
package/lib/alignment.js
CHANGED
|
@@ -54,16 +54,16 @@ export const revertScale = (copy) => {
|
|
|
54
54
|
copy.ops = copy.ops.filter(op => op !== 'stretched');
|
|
55
55
|
delete copy.measurements.scale;
|
|
56
56
|
};
|
|
57
|
-
const
|
|
57
|
+
const chainsOf = (copy) => featuresOf(copy).filter(feature => feature.type === 'HoleChain');
|
|
58
58
|
/**
|
|
59
59
|
* Takes the extension a pneumatic reader adds off the ends of the
|
|
60
|
-
* copy's holes, and records how much was taken.
|
|
60
|
+
* copy's chains of holes, and records how much was taken.
|
|
61
61
|
*
|
|
62
62
|
* Such a reader reports how long a valve stayed open, and a valve is
|
|
63
|
-
* held on past the perforation that opened it, so its
|
|
64
|
-
* than the punched
|
|
63
|
+
* held on past the perforation that opened it, so its chains run longer
|
|
64
|
+
* than the punched ones while their onsets agree. Left in, the
|
|
65
65
|
* difference is not a difference between copies at all: a collation
|
|
66
|
-
* comparing this copy's
|
|
66
|
+
* comparing this copy's chain ends against a scanned copy's compares a
|
|
67
67
|
* pneumatic on-time with a punched slot, and reads the one as a
|
|
68
68
|
* lengthening of the other.
|
|
69
69
|
*
|
|
@@ -76,10 +76,10 @@ const holesOf = (copy) => featuresOf(copy).filter(feature => feature.type === 'H
|
|
|
76
76
|
* way and without any gradient across the bar, which is measured but
|
|
77
77
|
* too coarse to model from one roll.
|
|
78
78
|
*
|
|
79
|
-
* Only holes are touched. What a writing or a mark spans is no valve.
|
|
79
|
+
* Only chains of holes are touched. What a writing or a mark spans is no valve.
|
|
80
80
|
*/
|
|
81
81
|
/**
|
|
82
|
-
* The
|
|
82
|
+
* The chains the extension cannot be taken off, being no longer than it
|
|
83
83
|
* is: the reader reported them open for less time than it holds a valve
|
|
84
84
|
* on beyond the perforation, so the constant over-corrects them and
|
|
85
85
|
* would leave them ending before they begin.
|
|
@@ -87,46 +87,46 @@ const holesOf = (copy) => featuresOf(copy).filter(feature => feature.type === 'H
|
|
|
87
87
|
* They are where the constant shows its limit rather than where the
|
|
88
88
|
* copy is wrong, the extension varying by about half a millimetre with
|
|
89
89
|
* the port. What to do with them is an editorial question — a condition
|
|
90
|
-
* on the feature, a reading of the
|
|
91
|
-
* `
|
|
90
|
+
* on the feature, a reading of the chain, a smaller extension — and
|
|
91
|
+
* `shortenChains` throws rather than answer it.
|
|
92
92
|
*/
|
|
93
|
-
export const tooShortToShorten = (extension, copy, leaving = new Set()) =>
|
|
93
|
+
export const tooShortToShorten = (extension, copy, leaving = new Set()) => chainsOf(copy).filter(chain => !leaving.has(chain.id) && chain.horizontal.to - chain.horizontal.from <= extension);
|
|
94
94
|
/**
|
|
95
|
-
* Takes the extension off, leaving the named
|
|
96
|
-
* them. Naming a
|
|
95
|
+
* Takes the extension off, leaving the named chains as the reader gave
|
|
96
|
+
* them. Naming a chain is an editorial act and not a repair: it says
|
|
97
97
|
* this one is where the constant stops applying, and the edition is
|
|
98
98
|
* what has to say why. The copy records which were left, so that
|
|
99
|
-
* putting the extension back does not lengthen a
|
|
99
|
+
* putting the extension back does not lengthen a chain nothing was
|
|
100
100
|
* taken from.
|
|
101
101
|
*
|
|
102
|
-
* Throws where a
|
|
102
|
+
* Throws where a chain that was not named is no longer than the
|
|
103
103
|
* extension, `tooShortToShorten` saying beforehand which those are.
|
|
104
104
|
*/
|
|
105
|
-
export const
|
|
105
|
+
export const shortenChains = (extension, copy, leaving = new Set()) => {
|
|
106
106
|
if (copy.ops.includes('shortened'))
|
|
107
107
|
return;
|
|
108
108
|
const tooShort = tooShortToShorten(extension, copy, leaving);
|
|
109
109
|
if (tooShort.length > 0) {
|
|
110
110
|
throw new Error(`The extension of ${extension} mm cannot be taken off ${tooShort.length} `
|
|
111
|
-
+ `
|
|
112
|
-
+ `${tooShort.map(
|
|
111
|
+
+ `chain(s) of holes of copy ${copy.id}, which are no longer than it: `
|
|
112
|
+
+ `${tooShort.map(chain => chain.id).join(', ')}`);
|
|
113
113
|
}
|
|
114
|
-
const left =
|
|
115
|
-
|
|
116
|
-
.filter(
|
|
117
|
-
.forEach(
|
|
114
|
+
const left = chainsOf(copy).filter(chain => leaving.has(chain.id)).map(chain => chain.id);
|
|
115
|
+
chainsOf(copy)
|
|
116
|
+
.filter(chain => !leaving.has(chain.id))
|
|
117
|
+
.forEach(chain => { chain.horizontal.to = subtract(chain.horizontal.to, extension); });
|
|
118
118
|
copy.ops = [...copy.ops, 'shortened'];
|
|
119
119
|
copy.measurements.readerExtension = { length: extension, ...(left.length > 0 && { leaving: left }) };
|
|
120
120
|
};
|
|
121
|
-
/** Puts the reader's extension back on the
|
|
121
|
+
/** Puts the reader's extension back on the chains it was taken off, as far as one was taken off. */
|
|
122
122
|
export const revertShortening = (copy) => {
|
|
123
123
|
const taken = copy.measurements.readerExtension;
|
|
124
124
|
if (!copy.ops.includes('shortened') || taken === undefined)
|
|
125
125
|
return;
|
|
126
126
|
const left = new Set(taken.leaving ?? []);
|
|
127
|
-
|
|
128
|
-
.filter(
|
|
129
|
-
.forEach(
|
|
127
|
+
chainsOf(copy)
|
|
128
|
+
.filter(chain => !left.has(chain.id))
|
|
129
|
+
.forEach(chain => { chain.horizontal.to = add(chain.horizontal.to, taken.length); });
|
|
130
130
|
copy.ops = copy.ops.filter(op => op !== 'shortened');
|
|
131
131
|
delete copy.measurements.readerExtension;
|
|
132
132
|
};
|
|
@@ -134,7 +134,7 @@ const byPlace = (x, y) => x.at - y.at || x.pitch - y.pitch;
|
|
|
134
134
|
/** The notes the bar reads off the features, in the order they pass it. */
|
|
135
135
|
const noteOnsets = (features, bar) => features
|
|
136
136
|
.flatMap((feature) => {
|
|
137
|
-
if (feature.type !== '
|
|
137
|
+
if (feature.type !== 'HoleChain')
|
|
138
138
|
return [];
|
|
139
139
|
return bar.meaningsOf(feature.vertical)
|
|
140
140
|
.filter(meaning => meaning.type === 'note')
|
package/lib/asJsonLd.js
CHANGED
|
@@ -73,7 +73,7 @@ const madeOn = (copy) => [
|
|
|
73
73
|
...nodesIn(copy.production?.produced),
|
|
74
74
|
...nodesIn(copy.modifications).flatMap(act => [...nodesIn(act.produced), ...nodesIn(act.added)])
|
|
75
75
|
];
|
|
76
|
-
const referencing = (nodes, patches) => nodes.filter(node => (node['@type'] === '
|
|
76
|
+
const referencing = (nodes, patches) => nodes.filter(node => (node['@type'] === 'Patch') === patches && typeof node['@id'] === 'string')
|
|
77
77
|
.map(node => ({ '@id': node['@id'] }));
|
|
78
78
|
const featuresAmong = (nodes) => referencing(nodes, false);
|
|
79
79
|
const patchesAmong = (nodes) => referencing(nodes, true);
|
|
@@ -112,7 +112,7 @@ const withBearings = (value) => {
|
|
|
112
112
|
...stating('composedOf', patchesAmong(made))
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
if (node['@type'] === '
|
|
115
|
+
if (node['@type'] === 'Patch')
|
|
116
116
|
return { ...node, ...stating('bears', featuresAmong(nodesIn(node.features))) };
|
|
117
117
|
return node;
|
|
118
118
|
};
|
package/lib/editionOps.d.ts
CHANGED
|
@@ -43,11 +43,11 @@ export declare const alignCopy: (copyId: string, shift: Shift, scale: number, re
|
|
|
43
43
|
export declare const unalignCopy: (copyId: string) => EditionOp;
|
|
44
44
|
/**
|
|
45
45
|
* Takes the extension a pneumatic reader adds off the ends of the
|
|
46
|
-
* copy's holes, and records how much was taken, so that
|
|
46
|
+
* copy's chains of holes, and records how much was taken, so that their lengths
|
|
47
47
|
* can be compared with a scanned copy's at all.
|
|
48
48
|
*/
|
|
49
49
|
export declare const shortenCopy: (copyId: string, extension: Millimeters, leaving?: ReadonlySet<string>) => EditionOp;
|
|
50
|
-
/** Puts the reader's extension back on the copy's holes. */
|
|
50
|
+
/** Puts the reader's extension back on the copy's chains of holes. */
|
|
51
51
|
export declare const unshortenCopy: (copyId: string) => EditionOp;
|
|
52
52
|
/** States what the copy's features were read from, in place of any earlier statement. */
|
|
53
53
|
export declare const stateSource: (copyId: string, source: FeatureSource) => EditionOp;
|
|
@@ -86,7 +86,7 @@ export declare const symbolsCarriedOnlyBy: (edition: Edition, copyId: string) =>
|
|
|
86
86
|
* punched, being glued on, so `punched` says nothing of one.
|
|
87
87
|
*/
|
|
88
88
|
export interface FeatureAct {
|
|
89
|
-
/** The copy came from its punching with it, which is where a reading of a scan puts every
|
|
89
|
+
/** The copy came from its punching with it, which is where a reading of a scan puts every chain of holes. */
|
|
90
90
|
punched?: boolean;
|
|
91
91
|
/** The act that brought this feature about brought the new one about as well. */
|
|
92
92
|
beside?: string;
|