@sudobility/music_types 0.11.17 → 0.11.18
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/dist/platform/mod.d.ts +44 -25
- package/dist/platform/mod.d.ts.map +1 -1
- package/dist/platform/mod.js +12 -7
- package/dist/platform/mod.js.map +1 -1
- package/package.json +1 -1
package/dist/platform/mod.d.ts
CHANGED
|
@@ -1,49 +1,68 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A neutral model of
|
|
3
|
-
* `.MOD` importer in music_lib reads — so that music_lib carries no byte
|
|
4
|
-
* handling of its own, the same split `MidiFile` uses.
|
|
2
|
+
* A format-neutral model of a tracker module.
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* only
|
|
9
|
-
*
|
|
4
|
+
* Was `ModFile`, shaped by exactly what ProTracker stores. That shape does not
|
|
5
|
+
* survive contact with the rest of the family: only MOD uses Amiga periods,
|
|
6
|
+
* only MOD has fixed 64-row patterns, and only MOD lets a sample stand in for
|
|
7
|
+
* an instrument. So the model states what every format agrees on and each
|
|
8
|
+
* decoder normalises its own quirks behind it — which is what keeps
|
|
9
|
+
* `trackerToScore` free of format branches.
|
|
10
|
+
*
|
|
11
|
+
* Decoding stops here deliberately. Turning this into a score is musical work
|
|
12
|
+
* and lives in music_lib; only the byte reading is platform-shaped, and even
|
|
13
|
+
* that is shared by all three `MusicIo` implementations rather than
|
|
14
|
+
* reimplemented per platform.
|
|
10
15
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
export type TrackerFormat = 'mod' | 's3m' | 'xm' | 'it' | 'dsm' | 'mptm';
|
|
17
|
+
/** One instrument slot. In MOD/S3M/DSM a sample *is* the instrument; XM, IT and MPTM put a layer above. */
|
|
18
|
+
export type TrackerInstrument = {
|
|
13
19
|
index: number;
|
|
14
20
|
name: string;
|
|
15
21
|
};
|
|
16
22
|
/**
|
|
17
23
|
* One channel's cell in one row.
|
|
18
24
|
*
|
|
19
|
-
* `
|
|
20
|
-
*
|
|
21
|
-
*
|
|
25
|
+
* `note` is a MIDI note number rather than a period: MOD is the only format
|
|
26
|
+
* that stores periods, so converting in its decoder keeps the approximation
|
|
27
|
+
* that conversion involves in one place instead of leaking into shared code.
|
|
28
|
+
*
|
|
29
|
+
* `effect`/`param` are deliberately absent. Notation import reads exactly one
|
|
30
|
+
* thing from the effect column — speed and tempo — and *which* effect carries
|
|
31
|
+
* it is format knowledge (XM splits `F` at 0x20; S3M and IT use `A` and `T`).
|
|
32
|
+
* Each decoder normalises to `speed`/`bpm`, so nothing downstream branches on
|
|
33
|
+
* format.
|
|
22
34
|
*/
|
|
23
|
-
export type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
export type TrackerCell = {
|
|
36
|
+
/** 0 means "keep whatever this channel was already playing". */
|
|
37
|
+
instrument: number;
|
|
38
|
+
/** MIDI note number, `'off'` for an explicit release or cut, `null` for an empty cell. */
|
|
39
|
+
note: number | 'off' | null;
|
|
40
|
+
/** Ticks per row, where this cell changes it. */
|
|
41
|
+
speed?: number;
|
|
42
|
+
/** Beats per minute, where this cell changes it. */
|
|
43
|
+
bpm?: number;
|
|
44
|
+
/** `Dxx` — this row ends the pattern early. */
|
|
45
|
+
patternBreak?: boolean;
|
|
28
46
|
};
|
|
29
|
-
export type
|
|
47
|
+
export type TrackerModule = {
|
|
48
|
+
format: TrackerFormat;
|
|
30
49
|
title: string;
|
|
31
50
|
channels: number;
|
|
32
|
-
|
|
51
|
+
instruments: TrackerInstrument[];
|
|
33
52
|
/** Pattern indices in playback order; a pattern played three times appears three times. */
|
|
34
53
|
order: number[];
|
|
35
|
-
/** `patterns[
|
|
36
|
-
patterns:
|
|
54
|
+
/** `patterns[p][row][channel]`. Row count varies per pattern — MOD is always 64, IT allows 200. */
|
|
55
|
+
patterns: TrackerCell[][][];
|
|
37
56
|
};
|
|
38
57
|
/**
|
|
39
|
-
* Reading a
|
|
58
|
+
* Reading a tracker module.
|
|
40
59
|
*
|
|
41
60
|
* A capability for surface consistency — the app reaches every file format
|
|
42
61
|
* through `getAppServices().io` — even though nothing about parsing is
|
|
43
62
|
* platform-bound. All three implementations delegate to one shared module.
|
|
44
63
|
*/
|
|
45
|
-
export interface
|
|
46
|
-
/**
|
|
47
|
-
decode(bytes: ArrayBuffer):
|
|
64
|
+
export interface TrackerCodec {
|
|
65
|
+
/** Sniffs the format from the bytes and decodes it. Throws on anything that is not one, rather than returning a garbage module that looks imported. */
|
|
66
|
+
decode(bytes: ArrayBuffer): TrackerModule;
|
|
48
67
|
}
|
|
49
68
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/platform/mod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/platform/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;AAEzE,2GAA2G;AAC3G,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAC5B,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,2FAA2F;IAC3F,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,mGAAmG;IACnG,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;CAC7B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,uJAAuJ;IACvJ,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,CAAC;CAC3C"}
|
package/dist/platform/mod.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A neutral model of
|
|
3
|
-
* `.MOD` importer in music_lib reads — so that music_lib carries no byte
|
|
4
|
-
* handling of its own, the same split `MidiFile` uses.
|
|
2
|
+
* A format-neutral model of a tracker module.
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* only
|
|
9
|
-
*
|
|
4
|
+
* Was `ModFile`, shaped by exactly what ProTracker stores. That shape does not
|
|
5
|
+
* survive contact with the rest of the family: only MOD uses Amiga periods,
|
|
6
|
+
* only MOD has fixed 64-row patterns, and only MOD lets a sample stand in for
|
|
7
|
+
* an instrument. So the model states what every format agrees on and each
|
|
8
|
+
* decoder normalises its own quirks behind it — which is what keeps
|
|
9
|
+
* `trackerToScore` free of format branches.
|
|
10
|
+
*
|
|
11
|
+
* Decoding stops here deliberately. Turning this into a score is musical work
|
|
12
|
+
* and lives in music_lib; only the byte reading is platform-shaped, and even
|
|
13
|
+
* that is shared by all three `MusicIo` implementations rather than
|
|
14
|
+
* reimplemented per platform.
|
|
10
15
|
*/
|
|
11
16
|
export {};
|
|
12
17
|
//# sourceMappingURL=mod.js.map
|
package/dist/platform/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/platform/mod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/platform/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
package/package.json
CHANGED