@flat/instruments 1.0.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 ADDED
@@ -0,0 +1,76 @@
1
+ # @flat/instruments
2
+
3
+ The public catalog of musical **instrument IDs** used by the [Flat](https://flat.io) platform and API.
4
+
5
+ When you create scores or correct OMR-detected parts through the
6
+ [Flat API](https://flat.io/developers/docs), each instrument is referenced by a canonical ID in
7
+ `group.instrument` form — for example `keyboards.piano`, `brass.trumpet`, or
8
+ `unpitched-percussion.drumset-rock`. This package is the discoverable, typed list of those IDs.
9
+
10
+ > Looking for the human-readable reference? See the
11
+ > [Instruments page in the Flat developer docs](https://flat.io/developers/docs/api/instruments).
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @flat/instruments
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```ts
22
+ import { instruments, groups, getInstrument, isValidInstrumentId } from '@flat/instruments';
23
+
24
+ instruments.length; // → every instrument, in catalog order
25
+ getInstrument('keyboards.piano'); // → { id, group, name, shortname, type, premium }
26
+ getInstrument('nope.nope'); // → undefined
27
+ isValidInstrumentId('brass.trumpet'); // → true
28
+
29
+ // Grouped by family (Keyboards, Brass, Strings, …), in display order:
30
+ for (const group of groups) {
31
+ console.log(group.name, group.instruments.map(i => i.id));
32
+ }
33
+ ```
34
+
35
+ Each instrument has the following shape:
36
+
37
+ ```ts
38
+ interface Instrument {
39
+ id: string; // canonical "group.instrument" ID, e.g. "keyboards.piano"
40
+ group: string; // family ID, e.g. "keyboards"
41
+ name: string; // English display name, e.g. "Piano"
42
+ shortname: string; // short staff label, e.g. "Pno."
43
+ type: 'pitched' | 'unpitched';
44
+ premium: boolean; // true → requires a paid Flat plan
45
+ }
46
+ ```
47
+
48
+ ## Raw JSON
49
+
50
+ If you are not using JavaScript, the same data is available as plain JSON, bundled in this package at
51
+ [`data/instruments.json`](./data/instruments.json)
52
+ (validated against [`schema/instruments.schema.json`](./schema/instruments.schema.json)).
53
+
54
+ ## How this data is maintained
55
+
56
+ The catalog is the source of truth in Flat's internal `@flat/instruments-meta` package. A maintainer
57
+ syncs the public subset into `data/instruments.json` (English names only, plus the `premium` flag), and
58
+ `pnpm validate` checks it against the JSON Schema before each release. The data therefore reflects the
59
+ instrument IDs the live Flat API accepts.
60
+
61
+ ## Development
62
+
63
+ ```bash
64
+ pnpm install
65
+ pnpm build-schema # regenerate schema/instruments.schema.json from src/types.ts
66
+ pnpm validate # validate data/instruments.json against the schema + invariants
67
+ pnpm build # compile to dist/
68
+ pnpm test # run the test suite
69
+ ```
70
+
71
+ ## License
72
+
73
+ Proprietary — © Tutteo Limited. All rights reserved.
74
+
75
+ This package is published publicly so that Flat API consumers can discover valid instrument IDs.
76
+ It does not grant any license to use, copy, modify, or redistribute the package or its data.