@ac-kit/format-midi 0.1.0 → 0.1.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @ac-kit/format-midi
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - cdbcb8a: `isMidiNoteRelease` no longer narrows every `noteOn` away when it answers
8
+ `false`: its guard is now the new `MidiNoteRelease` type, a `noteOff` or a
9
+ `noteOn` with `velocity: 0`, so a note-on with a velocity stays a `noteOn` in
10
+ the `false` branch.
11
+
3
12
  ## 0.1.0
4
13
 
5
14
  ### Minor Changes
@@ -1,4 +1,12 @@
1
1
  import type { MidiMessage } from "./midi-message.js";
2
+ /** A message that releases a note: any `noteOff`, or a `noteOn` with velocity 0. */
3
+ export type MidiNoteRelease = Extract<MidiMessage, {
4
+ type: "noteOff";
5
+ }> | (Extract<MidiMessage, {
6
+ type: "noteOn";
7
+ }> & {
8
+ velocity: 0;
9
+ });
2
10
  /**
3
11
  * Whether `message` releases a note: a `noteOff`, or a `noteOn` with velocity
4
12
  * 0, which every MIDI receiver treats as a note-off.
@@ -6,10 +14,11 @@ import type { MidiMessage } from "./midi-message.js";
6
14
  * Use it instead of testing `type === "noteOff"`, which misses the note-on form
7
15
  * most senders use so that running status covers a whole phrase.
8
16
  *
17
+ * When it answers `false`, `message` may still be a `noteOn`: only a `noteOff`
18
+ * is ruled out.
19
+ *
9
20
  * @example
10
21
  * isMidiNoteRelease({ type: "noteOn", channel: 0, note: 60, velocity: 0 }); // true
11
22
  */
12
- export declare function isMidiNoteRelease(message: MidiMessage): message is Extract<MidiMessage, {
13
- type: "noteOff" | "noteOn";
14
- }>;
23
+ export declare function isMidiNoteRelease(message: MidiMessage): message is MidiNoteRelease;
15
24
  //# sourceMappingURL=is-midi-note-release.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-midi-note-release.d.ts","sourceRoot":"","sources":["../../src/message/is-midi-note-release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,WAAW,GAClB,OAAO,IAAI,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAA;CAAE,CAAC,CAKjE"}
1
+ {"version":3,"file":"is-midi-note-release.d.ts","sourceRoot":"","sources":["../../src/message/is-midi-note-release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,oFAAoF;AACpF,MAAM,MAAM,eAAe,GACxB,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,GACzC,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG;IAAE,QAAQ,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAEhE;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,WAAW,GAClB,OAAO,IAAI,eAAe,CAK5B"}
@@ -5,6 +5,9 @@
5
5
  * Use it instead of testing `type === "noteOff"`, which misses the note-on form
6
6
  * most senders use so that running status covers a whole phrase.
7
7
  *
8
+ * When it answers `false`, `message` may still be a `noteOn`: only a `noteOff`
9
+ * is ruled out.
10
+ *
8
11
  * @example
9
12
  * isMidiNoteRelease({ type: "noteOn", channel: 0, note: 60, velocity: 0 }); // true
10
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"is-midi-note-release.js","sourceRoot":"","sources":["../../src/message/is-midi-note-release.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAChC,OAAoB;IAEpB,OAAO,CACN,OAAO,CAAC,IAAI,KAAK,SAAS;QAC1B,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,CACrD,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"is-midi-note-release.js","sourceRoot":"","sources":["../../src/message/is-midi-note-release.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAChC,OAAoB;IAEpB,OAAO,CACN,OAAO,CAAC,IAAI,KAAK,SAAS;QAC1B,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,CACrD,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ac-kit/format-midi",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "MIDI 1.0: the message model with a live byte-stream Decoder/Encoder, Standard MIDI File parse/print, and tick-to-seconds timelines.",
5
5
  "keywords": [
6
6
  "midi",