linked-rolls 0.64.0 → 0.66.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.
@@ -1,10 +1,26 @@
1
- import { clamp, geometryInMm, Grid, levelChanges, mezzoforteTravel, paperSeconds, ROWS_PER_MM, travelBetweenRails, } from "welte-mignon-emulator";
1
+ import { clamp, geometryInMm, Grid, levelChanges, mezzoforteTravel, paperSeconds, pedalBrushing, pedalDefaults, ROWS_PER_MM, travelBetweenRails, } from "welte-mignon-emulator";
2
2
  import { inCentimeters, mm, seconds } from "../model/Quantity.js";
3
3
  import { partitionPoint } from "../shared/sorted.js";
4
4
  import { velocityOf } from "./velocity.js";
5
5
  /** Whether two sets of constants are the same, value for value. */
6
6
  export const sameParameters = (a, b) => Object.keys(a).length === Object.keys(b).length
7
7
  && Object.entries(a).every(([name, value]) => b[name] === value);
8
+ /**
9
+ * The two readings of the pedal mechanism the emulator offers, by name,
10
+ * which the systems share: Hagmann has the valves and bellows that carry
11
+ * out the movements "in beiden Systemen dieselbe" (p. 106), and only the
12
+ * Vorpneumatik differs. Under `damping` the dampers reach the strings
13
+ * within the shortest lift the rolls punch, so every lift damps. Under
14
+ * `brushing` their fall is slowed until the quick runs of latch changes
15
+ * in the SUPRA corpus dip without damping, at the price that lifts
16
+ * shorter than about 265 ms brush as well.
17
+ */
18
+ export const pedalPresets = {
19
+ damping: pedalDefaults,
20
+ brushing: pedalBrushing
21
+ };
22
+ /** The preset a set of pedal constants is, if it is one. */
23
+ export const pedalPresetOf = (pedals) => Object.keys(pedalPresets).find(name => sameParameters(pedalPresets[name], pedals));
8
24
  /** Paper the grid runs on past the last hole, so that a final pedal release completes. */
9
25
  const RUN_OUT = mm(100);
10
26
  const isNote = (event) => event.type === 'note';
@@ -12,7 +28,8 @@ const isExpression = (event) => event.type === 'expression';
12
28
  const paperOf = (toOwnPaper) => ({
13
29
  rowOf: place => place * toOwnPaper * ROWS_PER_MM,
14
30
  placeOfRow: row => mm(row / (toOwnPaper * ROWS_PER_MM)),
15
- paperOfRow: row => mm(row / ROWS_PER_MM)
31
+ paperOfRow: row => mm(row / ROWS_PER_MM),
32
+ paperOfPlace: place => mm(place * toOwnPaper)
16
33
  });
17
34
  /** When the spool brings a place on the roll to the tracker bar. */
18
35
  export const secondsAt = (spool, place) => seconds(paperSeconds(spool, inCentimeters(place)));
@@ -51,9 +68,10 @@ const performNotes = (events, grid, nuance, options, paper) => events
51
68
  .flatMap((note) => {
52
69
  const curve = nuance[halfOf(note, options.division)];
53
70
  const velocity = curve.velocity[grid.indexOfRow(paper.rowOf(note.horizontal.from))];
71
+ const at = (place) => secondsAt(options.spool, paper.paperOfPlace(place));
54
72
  return [
55
- { type: 'noteOn', performs: note, pitch: note.pitch, velocity, at: secondsAt(options.spool, note.horizontal.from) },
56
- { type: 'noteOff', performs: note, pitch: note.pitch, velocity: 127, at: secondsAt(options.spool, note.horizontal.to) }
73
+ { type: 'noteOn', performs: note, pitch: note.pitch, velocity, at: at(note.horizontal.from) },
74
+ { type: 'noteOff', performs: note, pitch: note.pitch, velocity: 127, at: at(note.horizontal.to) }
57
75
  ];
58
76
  });
59
77
  /**
@@ -3,7 +3,7 @@ import { Instrument, RollNumber } from "welte-mignon-emulator/t100";
3
3
  import { NegotiatedEvent, Performance, ReproducingSystem, RollProperties } from "../ReproducingSystem.js";
4
4
  import { type WelteOptions } from "../welte.js";
5
5
  export type { VelocityMap } from "../velocity.js";
6
- export { secondsAt } from "../welte.js";
6
+ export { pedalPresetOf, pedalPresets, secondsAt, type PedalPreset } from "../welte.js";
7
7
  export type { Instrument } from "welte-mignon-emulator/t100";
8
8
  export type InstrumentName = 'consensus' | RollNumber;
9
9
  /**
@@ -19,21 +19,6 @@ export declare const instrumentNames: readonly InstrumentName[];
19
19
  export declare const nuanceOf: (instrument: Instrument) => Record<Half, Parameters>;
20
20
  /** The instrument a pair of nuancing constants belongs to, if it is one. */
21
21
  export declare const instrumentNameOf: (nuance: Record<Half, Parameters>) => InstrumentName | undefined;
22
- /**
23
- * The two readings of the pedal mechanism the emulator offers, by name.
24
- * Under `damping` the dampers reach the strings within the shortest lift
25
- * the rolls punch, so every lift damps. Under `brushing` their fall is
26
- * slowed until the quick runs of latch changes in the SUPRA corpus dip
27
- * without damping, at the price that lifts shorter than about 265 ms brush
28
- * as well.
29
- */
30
- export declare const pedalPresets: {
31
- damping: Readonly<Record<string, number>>;
32
- brushing: Readonly<Record<string, number>>;
33
- };
34
- export type PedalPreset = keyof typeof pedalPresets;
35
- /** The preset a set of pedal constants is, if it is one. */
36
- export declare const pedalPresetOf: (pedals: Parameters) => PedalPreset | undefined;
37
22
  /** The T-100 takes the options every Welte system does; see `WelteOptions`. */
38
23
  export type WelteT100Options = WelteOptions;
39
24
  export declare const defaultWelteT100Options: WelteT100Options;
@@ -1,10 +1,10 @@
1
- import { DEFAULT_PUNCH_MM, pedalBrushing, pedalDefaults, TRACKER_BORE_MM, WELTE_SPOOL, } from "welte-mignon-emulator";
1
+ import { DEFAULT_PUNCH_MM, TRACKER_BORE_MM, WELTE_SPOOL, } from "welte-mignon-emulator";
2
2
  import { aperturePorts, CONSENSUS, pneumaticModel, PRESETS, runPedals, } from "welte-mignon-emulator/t100";
3
3
  import { welteT100 } from "./bar.js";
4
4
  import { mm, track } from "../../model/Quantity.js";
5
5
  import { defaultVelocityMap } from "../velocity.js";
6
- import { performWelte, sameParameters } from "../welte.js";
7
- export { secondsAt } from "../welte.js";
6
+ import { pedalPresets, performWelte, sameParameters } from "../welte.js";
7
+ export { pedalPresetOf, pedalPresets, secondsAt } from "../welte.js";
8
8
  /**
9
9
  * The instruments the emulator was fitted as: the consensus over the six
10
10
  * rolls with drawn nuance lines, and the setting that drew each of them,
@@ -18,20 +18,6 @@ export const instrumentNames = ['consensus', ...Object.keys(PRESETS)];
18
18
  export const nuanceOf = (instrument) => ({ bass: instrument.bass, treble: instrument.treble });
19
19
  /** The instrument a pair of nuancing constants belongs to, if it is one. */
20
20
  export const instrumentNameOf = (nuance) => instrumentNames.find(name => sameParameters(instruments[name].bass, nuance.bass) && sameParameters(instruments[name].treble, nuance.treble));
21
- /**
22
- * The two readings of the pedal mechanism the emulator offers, by name.
23
- * Under `damping` the dampers reach the strings within the shortest lift
24
- * the rolls punch, so every lift damps. Under `brushing` their fall is
25
- * slowed until the quick runs of latch changes in the SUPRA corpus dip
26
- * without damping, at the price that lifts shorter than about 265 ms brush
27
- * as well.
28
- */
29
- export const pedalPresets = {
30
- damping: pedalDefaults,
31
- brushing: pedalBrushing
32
- };
33
- /** The preset a set of pedal constants is, if it is one. */
34
- export const pedalPresetOf = (pedals) => Object.keys(pedalPresets).find(name => sameParameters(pedalPresets[name], pedals));
35
21
  export const defaultWelteT100Options = {
36
22
  spool: WELTE_SPOOL,
37
23
  nuance: nuanceOf(instruments.consensus),
@@ -4,7 +4,7 @@ import { ReproducingSystem } from "../ReproducingSystem.js";
4
4
  import { Millimeters } from "../../model/Quantity.js";
5
5
  import { type WelteOptions } from "../welte.js";
6
6
  export type { VelocityMap } from "../velocity.js";
7
- export { secondsAt } from "../welte.js";
7
+ export { pedalPresetOf, pedalPresets, secondsAt, type PedalPreset } from "../welte.js";
8
8
  export type { WelteT98Instrument, WelteT98InstrumentName } from "welte-mignon-emulator/t98";
9
9
  /**
10
10
  * The instruments the emulator offers for the green Welte, in three groups that
@@ -44,17 +44,6 @@ export declare const instrumentNames: readonly WelteT98InstrumentName[];
44
44
  /** The instrument a pair of nuancing constants belongs to, if it is one. */
45
45
  export declare const instrumentNameOf: (nuance: Record<Half, Parameters>) => WelteT98InstrumentName | undefined;
46
46
  export { instrumentT98Of, labelOf, nuanceOf };
47
- /**
48
- * The two readings of the pedal mechanism, which is the T-100's below the
49
- * command: Hagmann has the valves and bellows that carry out the movements "in
50
- * beiden Systemen dieselbe" (p. 106), and only the Vorpneumatik differs.
51
- */
52
- export declare const pedalPresets: {
53
- damping: Readonly<Record<string, number>>;
54
- brushing: Readonly<Record<string, number>>;
55
- };
56
- export type PedalPreset = keyof typeof pedalPresets;
57
- export declare const pedalPresetOf: (pedals: Parameters) => PedalPreset | undefined;
58
47
  /**
59
48
  * The options every Welte system takes (see `WelteOptions`), with what the
60
49
  * T-98 adds. No source states a T-98 spool geometry, so the default keeps the
@@ -1,10 +1,10 @@
1
- import { pedalBrushing, pedalDefaults, ROWS_PER_MM, WELTE_T98_SPOOL, } from "welte-mignon-emulator";
1
+ import { ROWS_PER_MM, WELTE_T98_SPOOL, } from "welte-mignon-emulator";
2
2
  import { aperturePorts, CHAIN_GAP_MM, DERIVED, GENUINE, instrumentT98Of, labelOf, nuanceOf, PUNCH_T98_MM, pneumaticT98Model, rewindAt, runPedals, sforzandoPianoLift, STARTING_VALUES, TRACKER_BORE_T98_MM, } from "welte-mignon-emulator/t98";
3
3
  import { welteT98 } from "./bar.js";
4
4
  import { mm, seconds, track } from "../../model/Quantity.js";
5
5
  import { defaultVelocityMap } from "../velocity.js";
6
- import { performWelte, sameParameters } from "../welte.js";
7
- export { secondsAt } from "../welte.js";
6
+ import { pedalPresets, performWelte, sameParameters } from "../welte.js";
7
+ export { pedalPresetOf, pedalPresets, secondsAt } from "../welte.js";
8
8
  /**
9
9
  * The instruments the emulator offers for the green Welte, in three groups that
10
10
  * answer three different questions and must not be listed as one.
@@ -46,16 +46,6 @@ export const instrumentNameOf = (nuance) => instrumentNames.find(name => {
46
46
  && sameParameters(instrument.treble, nuance.treble);
47
47
  });
48
48
  export { instrumentT98Of, labelOf, nuanceOf };
49
- /**
50
- * The two readings of the pedal mechanism, which is the T-100's below the
51
- * command: Hagmann has the valves and bellows that carry out the movements "in
52
- * beiden Systemen dieselbe" (p. 106), and only the Vorpneumatik differs.
53
- */
54
- export const pedalPresets = {
55
- damping: pedalDefaults,
56
- brushing: pedalBrushing
57
- };
58
- export const pedalPresetOf = (pedals) => Object.keys(pedalPresets).find(name => sameParameters(pedalPresets[name], pedals));
59
49
  export const defaultWelteT98Options = {
60
50
  spool: WELTE_T98_SPOOL,
61
51
  nuance: nuanceOf(GENUINE.consensus),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linked-rolls",
3
- "version": "0.64.0",
3
+ "version": "0.66.0",
4
4
  "description": "Digital editions of piano rolls: import, collation, editorial assumptions, JSON-LD export, and emulation through a reproducing system",
5
5
  "license": "MIT",
6
6
  "repository": {