@r_masseater/fumx 0.0.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/LICENSE +87 -0
- package/README.md +123 -1
- package/dist/analysis-BAPm6c9P.d.mts +75 -0
- package/dist/analysis-CRyaJD5D.mjs +294 -0
- package/dist/analysis-CRyaJD5D.mjs.map +1 -0
- package/dist/analysis.d.mts +3 -0
- package/dist/analysis.mjs +3 -0
- package/dist/cli-D2DptmOG.mjs +2506 -0
- package/dist/cli-D2DptmOG.mjs.map +1 -0
- package/dist/convert-als.d.mts +17 -0
- package/dist/convert-als.mjs +512 -0
- package/dist/convert-als.mjs.map +1 -0
- package/dist/convert-midi.d.mts +17 -0
- package/dist/convert-midi.mjs +273 -0
- package/dist/convert-midi.mjs.map +1 -0
- package/dist/fumx.mjs +9 -0
- package/dist/fumx.mjs.map +1 -0
- package/dist/grammar-Ds8M-PkG.mjs +9836 -0
- package/dist/grammar-Ds8M-PkG.mjs.map +1 -0
- package/dist/habits.d.mts +71 -0
- package/dist/habits.mjs +98 -0
- package/dist/habits.mjs.map +1 -0
- package/dist/index-Bc9UT9HF.d.mts +795 -0
- package/dist/index-C7av_aK1.d.mts +104 -0
- package/dist/index-DOfjU43D.d.mts +71 -0
- package/dist/index-KxUilka8.d.mts +6 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +4 -0
- package/dist/lint-Bnl4l0aI.mjs +296 -0
- package/dist/lint-Bnl4l0aI.mjs.map +1 -0
- package/dist/lint-CJ5lq-Fr.d.mts +37 -0
- package/dist/lint.d.mts +3 -0
- package/dist/lint.mjs +1 -0
- package/dist/mapper.mjs +14 -0
- package/dist/mapper.mjs.map +1 -0
- package/dist/mix-facts-QCYCXdIA.mjs +7006 -0
- package/dist/mix-facts-QCYCXdIA.mjs.map +1 -0
- package/dist/presets.d.mts +35 -0
- package/dist/presets.mjs +814 -0
- package/dist/presets.mjs.map +1 -0
- package/dist/read-song-B9342KUK.mjs +13017 -0
- package/dist/read-song-B9342KUK.mjs.map +1 -0
- package/dist/read-song-CsW4kd7v.d.mts +1326 -0
- package/dist/read-song-DW8MLsln.mjs +2783 -0
- package/dist/read-song-DW8MLsln.mjs.map +1 -0
- package/dist/song-BlIPWk7b.mjs +387 -0
- package/dist/song-BlIPWk7b.mjs.map +1 -0
- package/dist/song-UZ4T_dj9.d.mts +1477 -0
- package/dist/sounding-BCyExbPp.d.mts +20 -0
- package/dist/sounding-DYDZFp4e.mjs +41 -0
- package/dist/sounding-DYDZFp4e.mjs.map +1 -0
- package/dist/style-rules-CjaZTDt_.d.mts +131 -0
- package/dist/ticks-D6yACwHt.mjs +26 -0
- package/dist/ticks-D6yACwHt.mjs.map +1 -0
- package/dist/transform-CeFBPHqb.mjs +108 -0
- package/dist/transform-CeFBPHqb.mjs.map +1 -0
- package/dist/vite.d.mts +8 -0
- package/dist/vite.mjs +127 -0
- package/dist/vite.mjs.map +1 -0
- package/dist/write-CHtCd-bG.mjs +747 -0
- package/dist/write-CHtCd-bG.mjs.map +1 -0
- package/package.json +111 -5
- package/skills/lint-songs/SKILL.md +54 -0
- package/skills/read-fumx/SKILL.md +89 -0
- package/skills/use-fumx-tools/SKILL.md +69 -0
- package/skills/use-lint-presets/SKILL.md +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 masseater
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
@tanstack/eslint-plugin-start
|
|
26
|
+
|
|
27
|
+
MIT License
|
|
28
|
+
|
|
29
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
30
|
+
|
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
32
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
33
|
+
in the Software without restriction, including without limitation the rights
|
|
34
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
35
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
36
|
+
furnished to do so, subject to the following conditions:
|
|
37
|
+
|
|
38
|
+
The above copyright notice and this permission notice shall be included in all
|
|
39
|
+
copies or substantial portions of the Software.
|
|
40
|
+
|
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
42
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
43
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
44
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
45
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
46
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
47
|
+
SOFTWARE.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
@typescript-eslint/utils
|
|
52
|
+
|
|
53
|
+
MIT License
|
|
54
|
+
|
|
55
|
+
Copyright (c) 2019 typescript-eslint and other contributors
|
|
56
|
+
|
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
58
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
59
|
+
in the Software without restriction, including without limitation the rights
|
|
60
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
61
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
62
|
+
furnished to do so, subject to the following conditions:
|
|
63
|
+
|
|
64
|
+
The above copyright notice and this permission notice shall be included in all
|
|
65
|
+
copies or substantial portions of the Software.
|
|
66
|
+
|
|
67
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
68
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
69
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
70
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
71
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
72
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
73
|
+
SOFTWARE.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
globals
|
|
78
|
+
|
|
79
|
+
MIT License
|
|
80
|
+
|
|
81
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
82
|
+
|
|
83
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
84
|
+
|
|
85
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
86
|
+
|
|
87
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,125 @@
|
|
|
1
1
|
# @r_masseater/fumx
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Everything for `.fumx` songs: read a song as a typed value, import it from TypeScript with Vite, edit it with a language server, convert a MIDI file or an Ableton Live Set to `.fumx` with a check against the original, print the keys, chords and repeated bars of a song, and lint it against musical rules such as notes outside the key, part ranges and parallel fifths.
|
|
4
|
+
|
|
5
|
+
It requires [Vite+](https://viteplus.dev/) and Node.js 26 or later. `effect` and `vite-plus` are peer dependencies.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
vp add @r_masseater/fumx effect vite-plus
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Read a song
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { readSong } from "@r_masseater/fumx";
|
|
15
|
+
import { Effect } from "effect";
|
|
16
|
+
|
|
17
|
+
const source = await Effect.runPromise(
|
|
18
|
+
readSong({ path: "/song.fumx", read: () => Effect.succeed(text) }),
|
|
19
|
+
);
|
|
20
|
+
if (source.status === "valid") {
|
|
21
|
+
const tooHigh = source.song.notes.filter((note) => note.midi > 79);
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`readSong` follows `import` statements through `read`, so the files can come from disk, memory or a network. An invalid file gives `issues` with a path, line and column, in Japanese.
|
|
26
|
+
|
|
27
|
+
Times are integer ticks, `TICKS_PER_WHOLE` to a whole note. `@r_masseater/fumx/analysis` estimates what the notes imply but the file does not write: the key of a range of bars (`keyIn`), the chord on each beat (`chordsOf`) and bars that repeat. `analyze` returns all of them for a song. Chord names follow the spelling as written, so `E G C` is `CM/E`, not `Em#5`.
|
|
28
|
+
|
|
29
|
+
## Import a song
|
|
30
|
+
|
|
31
|
+
Add the Vite plugin. TypeScript then reads a compiled song as a value.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { fumx } from "@r_masseater/fumx/vite";
|
|
35
|
+
import { defineConfig } from "vite-plus";
|
|
36
|
+
|
|
37
|
+
export default defineConfig({ plugins: [fumx()] });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { song } from "./song.fumx";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For the TypeScript server to follow the import, list the package as a content mapper in `tsconfig.json`.
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"compilerOptions": { "allowArbitraryExtensions": true },
|
|
49
|
+
"contentMappers": [{ "package": "@r_masseater/fumx", "extensions": [".fumx"] }]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Commands
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
vp exec fumx report song.fumx # keys, chords and repeated bars as JSON
|
|
57
|
+
vp exec fumx convert song.mid # or song.als; writes song.fumx
|
|
58
|
+
vp exec fumx lint # every .fumx file git tracks, or the paths given
|
|
59
|
+
vp exec fumx language-server --stdio
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`fumx report` lets a reader that cannot listen to the song check what was written. `fumx convert` reads the written `.fumx` back, compares it with the events of the MIDI file or the Live Set arrangement, and fails if even one differs. `midiToFumx` of `@r_masseater/fumx/convert-midi` and `alsToFumx` of `@r_masseater/fumx/convert-als` do the same from code.
|
|
63
|
+
|
|
64
|
+
## Lint
|
|
65
|
+
|
|
66
|
+
`.fumx` writes music as text, so the habits a composer keeps can be checked like code. `fumx lint` runs rules written in TypeScript over the notes of each song and prints each finding with its file, line and column. It exits non-zero only when a rule set to `"error"` reports.
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import "@r_masseater/fumx/vite";
|
|
70
|
+
import { recommended } from "@r_masseater/fumx/presets";
|
|
71
|
+
import { defineConfig } from "vite-plus";
|
|
72
|
+
|
|
73
|
+
export default defineConfig({
|
|
74
|
+
fumx: {
|
|
75
|
+
lint: {
|
|
76
|
+
extends: [recommended({ ranges: { lead: ["A3", "E5"] } })],
|
|
77
|
+
rules: { "harmony/chord-above-melody": "off" },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
| Preset | What it checks |
|
|
84
|
+
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
85
|
+
| `pop({ ranges, maxLeap, breathSeconds })` | Notes outside the key and the chord, part ranges, melody leaps over an octave and sung lines too long for a breath |
|
|
86
|
+
| `harmony()` | Semitone clashes, close intervals in the low register, crowded low mids, harmony above the melody and voice leaps |
|
|
87
|
+
| `classical()` | Parallel fifths and octaves between melody and bass, and strong-beat dissonances that do not step down |
|
|
88
|
+
| `progressions()` | Names well-known progressions such as Marusa, Oudou, Komuro, Canon and ii–V–I where they start |
|
|
89
|
+
| `bach()` | Chord changes Bach rarely makes in his 370 chorales, with the chords he usually picks |
|
|
90
|
+
| `recommended(popOptions)` | `pop` and `harmony` |
|
|
91
|
+
|
|
92
|
+
Every rule warns and its finding says how to fix it. Rules find parts by the `role` of their track (`melody`, `countermelody`, `harmony`, `bass`, `drums`), so give each track a role.
|
|
93
|
+
|
|
94
|
+
Write your own rules with `defineRule` and `definePlugin` of `@r_masseater/fumx/lint`, and register the plugin under a name in `plugins`:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import { definePlugin, defineRule } from "@r_masseater/fumx/lint";
|
|
98
|
+
|
|
99
|
+
const noHighBass = defineRule({
|
|
100
|
+
meta: { description: "The bass stays at or below C3" },
|
|
101
|
+
check: (context) => {
|
|
102
|
+
for (const note of context.soundings) {
|
|
103
|
+
if (note.track === "bass" && note.midi > 48) {
|
|
104
|
+
context.report({ line: note.line, column: note.column, message: "The bass is too high" });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export const local = definePlugin({ rules: { "no-high-bass": noHighBass } });
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
When a passage breaks a rule on purpose, say so in the file, and write why after `--`. The directives follow ESLint's: `fumx-ignore`, `fumx-ignore-next-line`, `fumx-ignore-file`, and `fumx-disable` up to `fumx-enable`.
|
|
114
|
+
|
|
115
|
+
```fumx
|
|
116
|
+
lead: C5 1/2, F#5 1/2 // fumx-ignore pop/out-of-key -- borrowed from the parallel minor
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Agent skills
|
|
120
|
+
|
|
121
|
+
The package ships agent skills in `skills/`. Add `permissions: { "@r_masseater/fumx": { skills: true } }` to `pnpm-workspace.yaml` and `vp install` links them into the skill directories of your agents.
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
|
+
import "./index-Bc9UT9HF.mjs";
|
|
3
|
+
import { d as Song } from "./song-UZ4T_dj9.mjs";
|
|
4
|
+
import "./sounding-BCyExbPp.mjs";
|
|
5
|
+
declare const AnalysisSchema: Schema.Struct<{
|
|
6
|
+
readonly bars: Schema.Int;
|
|
7
|
+
readonly key: Schema.OptionFromNullOr<Schema.Struct<{
|
|
8
|
+
readonly fromBar: Schema.Int;
|
|
9
|
+
readonly toBar: Schema.Int;
|
|
10
|
+
readonly tonic: Schema.String;
|
|
11
|
+
readonly pitchClass: Schema.Int;
|
|
12
|
+
readonly mode: Schema.Literals<readonly ["major", "minor"]>;
|
|
13
|
+
readonly correlation: Schema.Finite;
|
|
14
|
+
}>>;
|
|
15
|
+
readonly keys: Schema.$Array<Schema.Struct<{
|
|
16
|
+
readonly fromBar: Schema.Int;
|
|
17
|
+
readonly toBar: Schema.Int;
|
|
18
|
+
readonly tonic: Schema.String;
|
|
19
|
+
readonly pitchClass: Schema.Int;
|
|
20
|
+
readonly mode: Schema.Literals<readonly ["major", "minor"]>;
|
|
21
|
+
readonly correlation: Schema.Finite;
|
|
22
|
+
}>>;
|
|
23
|
+
readonly chords: Schema.$Array<Schema.Struct<{
|
|
24
|
+
readonly from: Schema.Struct<{
|
|
25
|
+
readonly bar: Schema.Int;
|
|
26
|
+
readonly offset: Schema.String;
|
|
27
|
+
}>;
|
|
28
|
+
readonly to: Schema.Struct<{
|
|
29
|
+
readonly bar: Schema.Int;
|
|
30
|
+
readonly offset: Schema.String;
|
|
31
|
+
}>;
|
|
32
|
+
readonly start: Schema.Int;
|
|
33
|
+
readonly end: Schema.Int;
|
|
34
|
+
readonly symbol: Schema.String;
|
|
35
|
+
readonly notes: Schema.$Array<Schema.String>;
|
|
36
|
+
}>>;
|
|
37
|
+
readonly repeats: Schema.$Array<Schema.Struct<{
|
|
38
|
+
fromBar: Schema.Int;
|
|
39
|
+
toBar: Schema.Int;
|
|
40
|
+
}>>;
|
|
41
|
+
}>;
|
|
42
|
+
type Analysis = typeof AnalysisSchema.Type;
|
|
43
|
+
declare const analyze: (song: Song) => Analysis;
|
|
44
|
+
declare const ChordSpanSchema: Schema.Struct<{
|
|
45
|
+
readonly from: Schema.Struct<{
|
|
46
|
+
readonly bar: Schema.Int;
|
|
47
|
+
readonly offset: Schema.String;
|
|
48
|
+
}>;
|
|
49
|
+
readonly to: Schema.Struct<{
|
|
50
|
+
readonly bar: Schema.Int;
|
|
51
|
+
readonly offset: Schema.String;
|
|
52
|
+
}>;
|
|
53
|
+
readonly start: Schema.Int;
|
|
54
|
+
readonly end: Schema.Int;
|
|
55
|
+
readonly symbol: Schema.String;
|
|
56
|
+
readonly notes: Schema.$Array<Schema.String>;
|
|
57
|
+
}>;
|
|
58
|
+
type ChordSpan = typeof ChordSpanSchema.Type;
|
|
59
|
+
declare const chordsOf: (song: Song) => readonly ChordSpan[];
|
|
60
|
+
declare const BarRangeSchema: Schema.Struct<{
|
|
61
|
+
fromBar: Schema.Int;
|
|
62
|
+
toBar: Schema.Int;
|
|
63
|
+
}>;
|
|
64
|
+
type BarRange = typeof BarRangeSchema.Type;
|
|
65
|
+
declare const KeySpanSchema: Schema.Struct<{
|
|
66
|
+
readonly fromBar: Schema.Int;
|
|
67
|
+
readonly toBar: Schema.Int;
|
|
68
|
+
readonly tonic: Schema.String;
|
|
69
|
+
readonly pitchClass: Schema.Int;
|
|
70
|
+
readonly mode: Schema.Literals<readonly ["major", "minor"]>;
|
|
71
|
+
readonly correlation: Schema.Finite;
|
|
72
|
+
}>;
|
|
73
|
+
type KeySpan = typeof KeySpanSchema.Type;
|
|
74
|
+
declare const keyIn: (song: Song) => (range: BarRange) => Option.Option<KeySpan>;
|
|
75
|
+
export { keyIn as a, chordsOf as c, analyze as d, KeySpanSchema as i, Analysis as l, BarRangeSchema as n, ChordSpan as o, KeySpan as r, ChordSpanSchema as s, BarRange as t, AnalysisSchema as u };
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { Array, Number as Number$1, Option, Order, Record, Schema, pipe } from "effect";
|
|
2
|
+
import { Chord } from "tonal";
|
|
3
|
+
import { t as TICKS_PER_WHOLE } from "./ticks-D6yACwHt.mjs";
|
|
4
|
+
import { n as positionOf, r as soundingsOf, t as overlapOf } from "./sounding-DYDZFp4e.mjs";
|
|
5
|
+
// src/features/analyze-song/model/chords.ts
|
|
6
|
+
const FIRST$2 = 1;
|
|
7
|
+
const HELD_SHARE = .25;
|
|
8
|
+
const UNKNOWN$1 = "?";
|
|
9
|
+
const PositionSchema = Schema.Struct({
|
|
10
|
+
bar: Schema.Int,
|
|
11
|
+
offset: Schema.String
|
|
12
|
+
});
|
|
13
|
+
const ChordSpanSchema = Schema.Struct({
|
|
14
|
+
from: PositionSchema,
|
|
15
|
+
to: PositionSchema,
|
|
16
|
+
start: Schema.Int,
|
|
17
|
+
end: Schema.Int,
|
|
18
|
+
symbol: Schema.String,
|
|
19
|
+
notes: Schema.Array(Schema.String)
|
|
20
|
+
});
|
|
21
|
+
const heldIn = (window) => (note) => overlapOf(note)(window) >= (window.end - window.start) * HELD_SHARE;
|
|
22
|
+
const isHarmonic = (note) => Option.exists(note.role, (role) => role === "bass" || role === "harmony");
|
|
23
|
+
const OCTAVE$1 = 12;
|
|
24
|
+
const UNISON = 0;
|
|
25
|
+
const samePitchClass = (left, right) => (left - right) % OCTAVE$1 === UNISON;
|
|
26
|
+
const byMidi = Order.mapInput(Order.Number, (note) => note.midi);
|
|
27
|
+
const harmonicOrAll = (held) => {
|
|
28
|
+
const harmonic = pipe(held, Array.filter(isHarmonic));
|
|
29
|
+
if (Array.isReadonlyArrayNonEmpty(harmonic)) return harmonic;
|
|
30
|
+
return held;
|
|
31
|
+
};
|
|
32
|
+
const chordNotesIn = (notes) => (window) => pipe(notes, Array.filter(heldIn(window)), harmonicOrAll, (held) => Array.sort(held, byMidi), Array.dedupeWith((left, right) => samePitchClass(left.midi, right.midi)), Array.map((note) => note.pitchClass));
|
|
33
|
+
const spells = (notes) => (symbol) => {
|
|
34
|
+
const spelled = Chord.get(symbol).notes;
|
|
35
|
+
return spelled.length === notes.length && pipe(spelled, Array.every((note) => Array.contains(notes, note)));
|
|
36
|
+
};
|
|
37
|
+
const symbolOf = (notes) => {
|
|
38
|
+
const candidates = Chord.detect(Array.copy(notes));
|
|
39
|
+
return pipe(candidates, Array.findFirst(spells(notes)), Option.orElse(() => Array.head(candidates)), Option.getOrElse(() => UNKNOWN$1));
|
|
40
|
+
};
|
|
41
|
+
const beatWindowsOf = (song) => pipe(song.bars, Array.flatMap((bar) => {
|
|
42
|
+
const beat = TICKS_PER_WHOLE / bar.meter.denominator;
|
|
43
|
+
return Array.makeBy(bar.meter.numerator, (index) => ({
|
|
44
|
+
start: bar.start + index * beat,
|
|
45
|
+
end: bar.start + (index + FIRST$2) * beat
|
|
46
|
+
}));
|
|
47
|
+
}));
|
|
48
|
+
const extend = (spans, beat) => Option.match(Array.last(spans), {
|
|
49
|
+
onNone: () => [beat],
|
|
50
|
+
onSome: (last) => {
|
|
51
|
+
if (last.symbol !== beat.symbol || last.end !== beat.start) return [...spans, beat];
|
|
52
|
+
return [...Array.dropRight(spans, FIRST$2), {
|
|
53
|
+
...last,
|
|
54
|
+
end: beat.end
|
|
55
|
+
}];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const beatChordOf = (notes) => (window) => {
|
|
59
|
+
const held = chordNotesIn(notes)(window);
|
|
60
|
+
if (!Array.isReadonlyArrayNonEmpty(held)) return Option.none();
|
|
61
|
+
return Option.some({
|
|
62
|
+
...window,
|
|
63
|
+
notes: held,
|
|
64
|
+
symbol: symbolOf(held)
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const chordsOf = (song) => {
|
|
68
|
+
const notes = soundingsOf(song);
|
|
69
|
+
const beats = pipe(beatWindowsOf(song), Array.map(beatChordOf(notes)), Array.getSomes);
|
|
70
|
+
const at = positionOf(song);
|
|
71
|
+
return pipe(Array.reduce(beats, [], extend), Array.map((span) => ({
|
|
72
|
+
from: at(span.start),
|
|
73
|
+
to: at(span.end),
|
|
74
|
+
start: span.start,
|
|
75
|
+
end: span.end,
|
|
76
|
+
symbol: span.symbol,
|
|
77
|
+
notes: span.notes
|
|
78
|
+
})));
|
|
79
|
+
};
|
|
80
|
+
// src/features/analyze-song/model/keys.ts
|
|
81
|
+
const NONE$1 = 0;
|
|
82
|
+
const OCTAVE = 12;
|
|
83
|
+
const SQUARE = 2;
|
|
84
|
+
const CORRELATION_DIGITS = 3;
|
|
85
|
+
const UNKNOWN = "?";
|
|
86
|
+
const MAJOR_PROFILE = {
|
|
87
|
+
tonic: 6.35,
|
|
88
|
+
minorSecond: 2.23,
|
|
89
|
+
majorSecond: 3.48,
|
|
90
|
+
minorThird: 2.33,
|
|
91
|
+
majorThird: 4.38,
|
|
92
|
+
fourth: 4.09,
|
|
93
|
+
tritone: 2.52,
|
|
94
|
+
fifth: 5.19,
|
|
95
|
+
minorSixth: 2.39,
|
|
96
|
+
majorSixth: 3.66,
|
|
97
|
+
minorSeventh: 2.29,
|
|
98
|
+
majorSeventh: 2.88
|
|
99
|
+
};
|
|
100
|
+
const MINOR_PROFILE = {
|
|
101
|
+
tonic: 6.33,
|
|
102
|
+
minorSecond: 2.68,
|
|
103
|
+
majorSecond: 3.52,
|
|
104
|
+
minorThird: 5.38,
|
|
105
|
+
majorThird: 2.6,
|
|
106
|
+
fourth: 3.53,
|
|
107
|
+
tritone: 2.54,
|
|
108
|
+
fifth: 4.75,
|
|
109
|
+
minorSixth: 3.98,
|
|
110
|
+
majorSixth: 2.69,
|
|
111
|
+
minorSeventh: 3.34,
|
|
112
|
+
majorSeventh: 3.17
|
|
113
|
+
};
|
|
114
|
+
const MAJOR_TONICS = [
|
|
115
|
+
"C",
|
|
116
|
+
"Db",
|
|
117
|
+
"D",
|
|
118
|
+
"Eb",
|
|
119
|
+
"E",
|
|
120
|
+
"F",
|
|
121
|
+
"F#",
|
|
122
|
+
"G",
|
|
123
|
+
"Ab",
|
|
124
|
+
"A",
|
|
125
|
+
"Bb",
|
|
126
|
+
"B"
|
|
127
|
+
];
|
|
128
|
+
const MINOR_TONICS = [
|
|
129
|
+
"C",
|
|
130
|
+
"C#",
|
|
131
|
+
"D",
|
|
132
|
+
"Eb",
|
|
133
|
+
"E",
|
|
134
|
+
"F",
|
|
135
|
+
"F#",
|
|
136
|
+
"G",
|
|
137
|
+
"G#",
|
|
138
|
+
"A",
|
|
139
|
+
"Bb",
|
|
140
|
+
"B"
|
|
141
|
+
];
|
|
142
|
+
const ModeSchema = Schema.Literals(["major", "minor"]);
|
|
143
|
+
const barRangeFields = {
|
|
144
|
+
fromBar: Schema.Int,
|
|
145
|
+
toBar: Schema.Int
|
|
146
|
+
};
|
|
147
|
+
const BarRangeSchema = Schema.Struct(barRangeFields);
|
|
148
|
+
const KeySpanSchema = Schema.Struct({
|
|
149
|
+
...barRangeFields,
|
|
150
|
+
tonic: Schema.String,
|
|
151
|
+
pitchClass: Schema.Int,
|
|
152
|
+
mode: ModeSchema,
|
|
153
|
+
correlation: Schema.Finite
|
|
154
|
+
});
|
|
155
|
+
const pitchClassOf = (midi) => (midi % OCTAVE + OCTAVE) % OCTAVE;
|
|
156
|
+
const addWeight = (window) => (weights, note) => {
|
|
157
|
+
const share = overlapOf(note)(window);
|
|
158
|
+
const pitchClass = pitchClassOf(note.midi);
|
|
159
|
+
return pipe(weights, Array.map((weight, index) => {
|
|
160
|
+
if (index === pitchClass) return weight + share;
|
|
161
|
+
return weight;
|
|
162
|
+
}));
|
|
163
|
+
};
|
|
164
|
+
const histogramOf = (window) => (notes) => Array.reduce(notes, Array.makeBy(OCTAVE, () => NONE$1), addWeight(window));
|
|
165
|
+
const add = (sum, value) => sum + value;
|
|
166
|
+
const sumOf = (values) => Array.reduce(values, NONE$1, add);
|
|
167
|
+
const meanOf = (values) => sumOf(values) / values.length;
|
|
168
|
+
const spreadOf = (values) => {
|
|
169
|
+
const center = meanOf(values);
|
|
170
|
+
const squares = pipe(values, Array.map((value) => (value - center) ** SQUARE));
|
|
171
|
+
return Math.sqrt(sumOf(squares));
|
|
172
|
+
};
|
|
173
|
+
const correlationOf = (profile) => (histogram) => {
|
|
174
|
+
const histogramMean = meanOf(histogram);
|
|
175
|
+
const profileMean = meanOf(profile);
|
|
176
|
+
const covariance = sumOf(pipe(Array.zip(histogram, profile), Array.map(([weight, expected]) => (weight - histogramMean) * (expected - profileMean))));
|
|
177
|
+
const scale = spreadOf(histogram) * spreadOf(profile);
|
|
178
|
+
if (scale === NONE$1) return NONE$1;
|
|
179
|
+
return covariance / scale;
|
|
180
|
+
};
|
|
181
|
+
const rotated = (tonic) => (profile) => {
|
|
182
|
+
const weights = Record.values(profile);
|
|
183
|
+
return Array.makeBy(OCTAVE, (index) => weights[(index - tonic + OCTAVE) % OCTAVE] ?? NONE$1);
|
|
184
|
+
};
|
|
185
|
+
const candidatesAt = (histogram) => (tonic) => [{
|
|
186
|
+
tonic: MAJOR_TONICS[tonic] ?? UNKNOWN,
|
|
187
|
+
pitchClass: tonic,
|
|
188
|
+
mode: "major",
|
|
189
|
+
correlation: correlationOf(rotated(tonic)(MAJOR_PROFILE))(histogram)
|
|
190
|
+
}, {
|
|
191
|
+
tonic: MINOR_TONICS[tonic] ?? UNKNOWN,
|
|
192
|
+
pitchClass: tonic,
|
|
193
|
+
mode: "minor",
|
|
194
|
+
correlation: correlationOf(rotated(tonic)(MINOR_PROFILE))(histogram)
|
|
195
|
+
}];
|
|
196
|
+
const byCorrelation = Order.flip(Order.mapInput(Order.Number, (candidate) => candidate.correlation));
|
|
197
|
+
const edgeOf = (song) => (index, end) => pipe(song.bars, Array.findFirst((bar) => bar.index === index), Option.match({
|
|
198
|
+
onNone: () => NONE$1,
|
|
199
|
+
onSome: (bar) => bar.start + Number(end) * bar.length
|
|
200
|
+
}));
|
|
201
|
+
const keyIn = (song) => (range) => {
|
|
202
|
+
const edge = edgeOf(song);
|
|
203
|
+
const histogram = histogramOf({
|
|
204
|
+
start: edge(range.fromBar, false),
|
|
205
|
+
end: edge(range.toBar, true)
|
|
206
|
+
})(soundingsOf(song));
|
|
207
|
+
if (pipe(histogram, Array.every((weight) => weight === NONE$1))) return Option.none();
|
|
208
|
+
const candidates = pipe(Array.range(NONE$1, 11), Array.flatMap(candidatesAt(histogram)));
|
|
209
|
+
return pipe(Array.sort(candidates, byCorrelation), Array.head, Option.map((best) => ({
|
|
210
|
+
fromBar: range.fromBar,
|
|
211
|
+
toBar: range.toBar,
|
|
212
|
+
tonic: best.tonic,
|
|
213
|
+
pitchClass: best.pitchClass,
|
|
214
|
+
mode: best.mode,
|
|
215
|
+
correlation: Number$1.round(best.correlation, CORRELATION_DIGITS)
|
|
216
|
+
})));
|
|
217
|
+
};
|
|
218
|
+
// src/features/analyze-song/model/repeats.ts
|
|
219
|
+
const FIRST$1 = 1;
|
|
220
|
+
const SECOND = 2;
|
|
221
|
+
const fingerprintOf = (song) => (bar) => {
|
|
222
|
+
const notes = pipe(song.notes, Array.filter((note) => note.bar === bar), Array.map((note) => `${note.track}:${String(note.offset)}:${String(note.midi)}:${String(note.length)}`));
|
|
223
|
+
const hits = pipe(song.hits, Array.filter((hit) => hit.bar === bar), Array.map((hit) => `${hit.track}:${String(hit.offset)}:${hit.voice}`));
|
|
224
|
+
const slices = pipe(song.slices, Array.filter((slice) => slice.bar === bar), Array.map((slice) => `${slice.track}:${String(slice.offset)}:${slice.sample}:${String(slice.index)}`));
|
|
225
|
+
return pipe(Array.sort([
|
|
226
|
+
...notes,
|
|
227
|
+
...hits,
|
|
228
|
+
...slices
|
|
229
|
+
], Order.String), Array.join("|"));
|
|
230
|
+
};
|
|
231
|
+
const repeatOf = (prints) => (bar) => {
|
|
232
|
+
const print = prints[bar - FIRST$1] ?? "";
|
|
233
|
+
return print !== "" && print === prints[bar - SECOND];
|
|
234
|
+
};
|
|
235
|
+
const joinRun = (runs, bar) => Option.match(Array.last(runs), {
|
|
236
|
+
onNone: () => [{
|
|
237
|
+
fromBar: bar - FIRST$1,
|
|
238
|
+
toBar: bar
|
|
239
|
+
}],
|
|
240
|
+
onSome: (last) => {
|
|
241
|
+
if (last.toBar !== bar - FIRST$1) return [...runs, {
|
|
242
|
+
fromBar: bar - FIRST$1,
|
|
243
|
+
toBar: bar
|
|
244
|
+
}];
|
|
245
|
+
return [...Array.dropRight(runs, FIRST$1), {
|
|
246
|
+
...last,
|
|
247
|
+
toBar: bar
|
|
248
|
+
}];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
const repeatsOf = (song) => {
|
|
252
|
+
const bars = song.bars.length;
|
|
253
|
+
const prints = pipe(Array.range(FIRST$1, bars), Array.map(fingerprintOf(song)));
|
|
254
|
+
const repeated = pipe(Array.range(SECOND, bars), Array.filter(repeatOf(prints)));
|
|
255
|
+
return Array.reduce(repeated, [], joinRun);
|
|
256
|
+
};
|
|
257
|
+
// src/features/analyze-song/model/analysis.ts
|
|
258
|
+
const FIRST = 1;
|
|
259
|
+
const NONE = 0;
|
|
260
|
+
const PHRASE_BARS = 4;
|
|
261
|
+
const AnalysisSchema = Schema.Struct({
|
|
262
|
+
bars: Schema.Int,
|
|
263
|
+
key: Schema.OptionFromNullOr(KeySpanSchema),
|
|
264
|
+
keys: Schema.Array(KeySpanSchema),
|
|
265
|
+
chords: Schema.Array(ChordSpanSchema),
|
|
266
|
+
repeats: Schema.Array(BarRangeSchema)
|
|
267
|
+
});
|
|
268
|
+
const phrasesOf = (bars) => Array.makeBy(Math.ceil(bars / PHRASE_BARS), (phrase) => ({
|
|
269
|
+
fromBar: phrase * PHRASE_BARS + FIRST,
|
|
270
|
+
toBar: Math.min(bars, (phrase + FIRST) * PHRASE_BARS)
|
|
271
|
+
}));
|
|
272
|
+
const analyze = (song) => {
|
|
273
|
+
const bars = song.bars.length;
|
|
274
|
+
if (bars === NONE) return {
|
|
275
|
+
bars,
|
|
276
|
+
key: Option.none(),
|
|
277
|
+
keys: [],
|
|
278
|
+
chords: [],
|
|
279
|
+
repeats: []
|
|
280
|
+
};
|
|
281
|
+
return {
|
|
282
|
+
bars,
|
|
283
|
+
key: keyIn(song)({
|
|
284
|
+
fromBar: FIRST,
|
|
285
|
+
toBar: bars
|
|
286
|
+
}),
|
|
287
|
+
keys: pipe(phrasesOf(bars), Array.map(keyIn(song)), Array.getSomes),
|
|
288
|
+
chords: chordsOf(song),
|
|
289
|
+
repeats: repeatsOf(song)
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
export { keyIn as a, KeySpanSchema as i, analyze as n, ChordSpanSchema as o, BarRangeSchema as r, chordsOf as s, AnalysisSchema as t };
|
|
293
|
+
|
|
294
|
+
//# sourceMappingURL=analysis-CRyaJD5D.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis-CRyaJD5D.mjs","names":["FIRST","UNKNOWN","OCTAVE","Arr","NONE","Arr","Num","FIRST","Arr","Arr"],"sources":["../src/features/analyze-song/model/chords.ts","../src/features/analyze-song/model/keys.ts","../src/features/analyze-song/model/repeats.ts","../src/features/analyze-song/model/analysis.ts"],"sourcesContent":["import { Array as Arr, Option, Order, Schema, pipe } from \"effect\";\nimport { Chord } from \"tonal\";\n\nimport type { Song } from \"#/entities/song/index.ts\";\nimport { TICKS_PER_WHOLE } from \"#/shared/lib/ticks.ts\";\n\nimport { overlapOf, positionOf, soundingsOf } from \"./sounding.ts\";\nimport type { Sounding, Span } from \"./sounding.ts\";\n\nconst FIRST = 1;\nconst HELD_SHARE = 0.25;\nconst UNKNOWN = \"?\";\n\nconst PositionSchema = Schema.Struct({ bar: Schema.Int, offset: Schema.String });\n\nexport const ChordSpanSchema = Schema.Struct({\n from: PositionSchema,\n to: PositionSchema,\n start: Schema.Int,\n end: Schema.Int,\n symbol: Schema.String,\n notes: Schema.Array(Schema.String),\n});\n\nexport type ChordSpan = typeof ChordSpanSchema.Type;\n\ninterface BeatChord extends Span {\n readonly symbol: string;\n readonly notes: readonly string[];\n}\n\nconst heldIn =\n (window: Span) =>\n (note: Sounding): boolean =>\n overlapOf(note)(window) >= (window.end - window.start) * HELD_SHARE;\n\nconst isHarmonic = (note: Sounding): boolean =>\n Option.exists(note.role, (role) => role === \"bass\" || role === \"harmony\");\n\nconst OCTAVE = 12;\n\nconst UNISON = 0;\n\nconst samePitchClass = (left: number, right: number): boolean => (left - right) % OCTAVE === UNISON;\n\nconst byMidi = Order.mapInput(Order.Number, (note: Sounding) => note.midi);\n\nconst harmonicOrAll = (held: readonly Sounding[]): readonly Sounding[] => {\n const harmonic = pipe(held, Arr.filter(isHarmonic));\n if (Arr.isReadonlyArrayNonEmpty(harmonic)) {\n return harmonic;\n }\n return held;\n};\n\nconst chordNotesIn =\n (notes: readonly Sounding[]) =>\n (window: Span): readonly string[] =>\n pipe(\n notes,\n Arr.filter(heldIn(window)),\n harmonicOrAll,\n (held) => Arr.sort(held, byMidi),\n Arr.dedupeWith((left, right) => samePitchClass(left.midi, right.midi)),\n Arr.map((note) => note.pitchClass),\n );\n\nconst spells =\n (notes: readonly string[]) =>\n (symbol: string): boolean => {\n const spelled = Chord.get(symbol).notes;\n return (\n spelled.length === notes.length &&\n pipe(\n spelled,\n Arr.every((note) => Arr.contains(notes, note)),\n )\n );\n };\n\nconst symbolOf = (notes: readonly string[]): string => {\n const candidates = Chord.detect(Arr.copy(notes));\n return pipe(\n candidates,\n Arr.findFirst(spells(notes)),\n Option.orElse(() => Arr.head(candidates)),\n Option.getOrElse(() => UNKNOWN),\n );\n};\n\nconst beatWindowsOf = (song: Song): readonly Span[] =>\n pipe(\n song.bars,\n Arr.flatMap((bar) => {\n const beat = TICKS_PER_WHOLE / bar.meter.denominator;\n return Arr.makeBy(bar.meter.numerator, (index) => ({\n start: bar.start + index * beat,\n end: bar.start + (index + FIRST) * beat,\n }));\n }),\n );\n\nconst extend = (spans: readonly BeatChord[], beat: BeatChord): readonly BeatChord[] =>\n Option.match(Arr.last(spans), {\n onNone: () => [beat],\n onSome: (last) => {\n if (last.symbol !== beat.symbol || last.end !== beat.start) {\n return [...spans, beat];\n }\n return [...Arr.dropRight(spans, FIRST), { ...last, end: beat.end }];\n },\n });\n\nconst beatChordOf =\n (notes: readonly Sounding[]) =>\n (window: Span): Option.Option<BeatChord> => {\n const held = chordNotesIn(notes)(window);\n if (!Arr.isReadonlyArrayNonEmpty(held)) {\n return Option.none();\n }\n return Option.some({ ...window, notes: held, symbol: symbolOf(held) });\n };\n\nexport const chordsOf = (song: Song): readonly ChordSpan[] => {\n const notes = soundingsOf(song);\n const beats = pipe(beatWindowsOf(song), Arr.map(beatChordOf(notes)), Arr.getSomes);\n const at = positionOf(song);\n return pipe(\n Arr.reduce(beats, [] as readonly BeatChord[], extend),\n Arr.map((span) => ({\n from: at(span.start),\n to: at(span.end),\n start: span.start,\n end: span.end,\n symbol: span.symbol,\n notes: span.notes,\n })),\n );\n};\n","import { Array as Arr, Number as Num, Option, Order, Record, Schema, pipe } from \"effect\";\n\nimport type { Song } from \"#/entities/song/index.ts\";\n\nimport { overlapOf, soundingsOf } from \"./sounding.ts\";\nimport type { Sounding, Span } from \"./sounding.ts\";\n\nconst FIRST = 1;\nconst NONE = 0;\nconst OCTAVE = 12;\nconst SQUARE = 2;\nconst CORRELATION_DIGITS = 3;\nconst UNKNOWN = \"?\";\n\nconst MAJOR_PROFILE = {\n tonic: 6.35,\n minorSecond: 2.23,\n majorSecond: 3.48,\n minorThird: 2.33,\n majorThird: 4.38,\n fourth: 4.09,\n tritone: 2.52,\n fifth: 5.19,\n minorSixth: 2.39,\n majorSixth: 3.66,\n minorSeventh: 2.29,\n majorSeventh: 2.88,\n};\n\nconst MINOR_PROFILE = {\n tonic: 6.33,\n minorSecond: 2.68,\n majorSecond: 3.52,\n minorThird: 5.38,\n majorThird: 2.6,\n fourth: 3.53,\n tritone: 2.54,\n fifth: 4.75,\n minorSixth: 3.98,\n majorSixth: 2.69,\n minorSeventh: 3.34,\n majorSeventh: 3.17,\n};\n\nconst MAJOR_TONICS = [\"C\", \"Db\", \"D\", \"Eb\", \"E\", \"F\", \"F#\", \"G\", \"Ab\", \"A\", \"Bb\", \"B\"];\nconst MINOR_TONICS = [\"C\", \"C#\", \"D\", \"Eb\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"Bb\", \"B\"];\n\nconst ModeSchema = Schema.Literals([\"major\", \"minor\"]);\n\ntype Mode = typeof ModeSchema.Type;\n\nconst barRangeFields = { fromBar: Schema.Int, toBar: Schema.Int };\n\nexport const BarRangeSchema = Schema.Struct(barRangeFields);\n\nexport type BarRange = typeof BarRangeSchema.Type;\n\nexport const KeySpanSchema = Schema.Struct({\n ...barRangeFields,\n tonic: Schema.String,\n pitchClass: Schema.Int,\n mode: ModeSchema,\n correlation: Schema.Finite,\n});\n\nexport type KeySpan = typeof KeySpanSchema.Type;\n\ninterface Candidate {\n readonly tonic: string;\n readonly pitchClass: number;\n readonly mode: Mode;\n readonly correlation: number;\n}\n\nconst pitchClassOf = (midi: number): number => ((midi % OCTAVE) + OCTAVE) % OCTAVE;\n\nconst addWeight =\n (window: Span) =>\n (weights: readonly number[], note: Sounding): readonly number[] => {\n const share = overlapOf(note)(window);\n const pitchClass = pitchClassOf(note.midi);\n return pipe(\n weights,\n Arr.map((weight, index) => {\n if (index === pitchClass) {\n return weight + share;\n }\n return weight;\n }),\n );\n };\n\nconst histogramOf =\n (window: Span) =>\n (notes: readonly Sounding[]): readonly number[] =>\n Arr.reduce(\n notes,\n Arr.makeBy(OCTAVE, () => NONE),\n addWeight(window),\n );\n\nconst add = (sum: number, value: number): number => sum + value;\n\nconst sumOf = (values: readonly number[]): number => Arr.reduce(values, NONE, add);\n\nconst meanOf = (values: readonly number[]): number => sumOf(values) / values.length;\n\nconst spreadOf = (values: readonly number[]): number => {\n const center = meanOf(values);\n const squares = pipe(\n values,\n Arr.map((value) => (value - center) ** SQUARE),\n );\n return Math.sqrt(sumOf(squares));\n};\n\nconst correlationOf =\n (profile: readonly number[]) =>\n (histogram: readonly number[]): number => {\n const histogramMean = meanOf(histogram);\n const profileMean = meanOf(profile);\n const covariance = sumOf(\n pipe(\n Arr.zip(histogram, profile),\n Arr.map(([weight, expected]) => (weight - histogramMean) * (expected - profileMean)),\n ),\n );\n const scale = spreadOf(histogram) * spreadOf(profile);\n if (scale === NONE) {\n return NONE;\n }\n return covariance / scale;\n };\n\nconst rotated =\n (tonic: number) =>\n (profile: Readonly<Record<string, number>>): readonly number[] => {\n const weights = Record.values(profile);\n return Arr.makeBy(OCTAVE, (index) => weights[(index - tonic + OCTAVE) % OCTAVE] ?? NONE);\n };\n\nconst candidatesAt =\n (histogram: readonly number[]) =>\n (tonic: number): readonly Candidate[] => [\n {\n tonic: MAJOR_TONICS[tonic] ?? UNKNOWN,\n pitchClass: tonic,\n mode: \"major\",\n correlation: correlationOf(rotated(tonic)(MAJOR_PROFILE))(histogram),\n },\n {\n tonic: MINOR_TONICS[tonic] ?? UNKNOWN,\n pitchClass: tonic,\n mode: \"minor\",\n correlation: correlationOf(rotated(tonic)(MINOR_PROFILE))(histogram),\n },\n ];\n\nconst byCorrelation = Order.flip(\n Order.mapInput(Order.Number, (candidate: Candidate) => candidate.correlation),\n);\n\nconst edgeOf =\n (song: Song) =>\n (index: number, end: boolean): number =>\n pipe(\n song.bars,\n Arr.findFirst((bar) => bar.index === index),\n Option.match({\n onNone: () => NONE,\n onSome: (bar) => bar.start + Number(end) * bar.length,\n }),\n );\n\nexport const keyIn =\n (song: Song) =>\n (range: BarRange): Option.Option<KeySpan> => {\n const edge = edgeOf(song);\n const histogram = histogramOf({\n start: edge(range.fromBar, false),\n end: edge(range.toBar, true),\n })(soundingsOf(song));\n const silent = pipe(\n histogram,\n Arr.every((weight) => weight === NONE),\n );\n if (silent) {\n return Option.none();\n }\n const candidates = pipe(Arr.range(NONE, OCTAVE - FIRST), Arr.flatMap(candidatesAt(histogram)));\n return pipe(\n Arr.sort(candidates, byCorrelation),\n Arr.head,\n Option.map((best) => ({\n fromBar: range.fromBar,\n toBar: range.toBar,\n tonic: best.tonic,\n pitchClass: best.pitchClass,\n mode: best.mode,\n correlation: Num.round(best.correlation, CORRELATION_DIGITS),\n })),\n );\n };\n","import { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport type { Song } from \"#/entities/song/index.ts\";\n\nimport type { BarRange } from \"./keys.ts\";\n\nconst FIRST = 1;\nconst SECOND = 2;\n\nconst fingerprintOf =\n (song: Song) =>\n (bar: number): string => {\n const notes = pipe(\n song.notes,\n Arr.filter((note) => note.bar === bar),\n Arr.map(\n (note) =>\n `${note.track}:${String(note.offset)}:${String(note.midi)}:${String(note.length)}`,\n ),\n );\n const hits = pipe(\n song.hits,\n Arr.filter((hit) => hit.bar === bar),\n Arr.map((hit) => `${hit.track}:${String(hit.offset)}:${hit.voice}`),\n );\n const slices = pipe(\n song.slices,\n Arr.filter((slice) => slice.bar === bar),\n Arr.map(\n (slice) => `${slice.track}:${String(slice.offset)}:${slice.sample}:${String(slice.index)}`,\n ),\n );\n return pipe(Arr.sort([...notes, ...hits, ...slices], Order.String), Arr.join(\"|\"));\n };\n\nconst repeatOf =\n (prints: readonly string[]) =>\n (bar: number): boolean => {\n const print = prints[bar - FIRST] ?? \"\";\n return print !== \"\" && print === prints[bar - SECOND];\n };\n\nconst joinRun = (runs: readonly BarRange[], bar: number): readonly BarRange[] =>\n Option.match(Arr.last(runs), {\n onNone: () => [{ fromBar: bar - FIRST, toBar: bar }],\n onSome: (last) => {\n if (last.toBar !== bar - FIRST) {\n return [...runs, { fromBar: bar - FIRST, toBar: bar }];\n }\n return [...Arr.dropRight(runs, FIRST), { ...last, toBar: bar }];\n },\n });\n\nexport const repeatsOf = (song: Song): readonly BarRange[] => {\n const bars = song.bars.length;\n const prints = pipe(Arr.range(FIRST, bars), Arr.map(fingerprintOf(song)));\n const repeated = pipe(Arr.range(SECOND, bars), Arr.filter(repeatOf(prints)));\n return Arr.reduce(repeated, [] as readonly BarRange[], joinRun);\n};\n","import { Array as Arr, Option, Schema, pipe } from \"effect\";\n\nimport type { Song } from \"#/entities/song/index.ts\";\n\nimport { ChordSpanSchema, chordsOf } from \"./chords.ts\";\nimport { BarRangeSchema, KeySpanSchema, keyIn } from \"./keys.ts\";\nimport type { BarRange } from \"./keys.ts\";\nimport { repeatsOf } from \"./repeats.ts\";\n\nconst FIRST = 1;\nconst NONE = 0;\nconst PHRASE_BARS = 4;\n\nexport const AnalysisSchema = Schema.Struct({\n bars: Schema.Int,\n key: Schema.OptionFromNullOr(KeySpanSchema),\n keys: Schema.Array(KeySpanSchema),\n chords: Schema.Array(ChordSpanSchema),\n repeats: Schema.Array(BarRangeSchema),\n});\n\nexport type Analysis = typeof AnalysisSchema.Type;\n\nconst phrasesOf = (bars: number): readonly BarRange[] =>\n Arr.makeBy(Math.ceil(bars / PHRASE_BARS), (phrase) => ({\n fromBar: phrase * PHRASE_BARS + FIRST,\n toBar: Math.min(bars, (phrase + FIRST) * PHRASE_BARS),\n }));\n\nexport const analyze = (song: Song): Analysis => {\n const bars = song.bars.length;\n if (bars === NONE) {\n return { bars, key: Option.none(), keys: [], chords: [], repeats: [] };\n }\n return {\n bars,\n key: keyIn(song)({ fromBar: FIRST, toBar: bars }),\n keys: pipe(phrasesOf(bars), Arr.map(keyIn(song)), Arr.getSomes),\n chords: chordsOf(song),\n repeats: repeatsOf(song),\n };\n};\n"],"mappings":";;;;;AASA,MAAMA,UAAQ;AACd,MAAM,aAAa;AACnB,MAAMC,YAAU;AAEhB,MAAM,iBAAiB,OAAO,OAAO;CAAE,KAAK,OAAO;CAAK,QAAQ,OAAO;AAAO,CAAC;AAE/E,MAAa,kBAAkB,OAAO,OAAO;CAC3C,MAAM;CACN,IAAI;CACJ,OAAO,OAAO;CACd,KAAK,OAAO;CACZ,QAAQ,OAAO;CACf,OAAO,OAAO,MAAM,OAAO,MAAM;AACnC,CAAC;AASD,MAAM,UACH,YACA,SACC,UAAU,IAAI,CAAC,CAAC,MAAM,MAAM,OAAO,MAAM,OAAO,SAAS;AAE7D,MAAM,cAAc,SAClB,OAAO,OAAO,KAAK,OAAO,SAAS,SAAS,UAAU,SAAS,SAAS;AAE1E,MAAMC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AC/C,MAAM,OAAO,KAAK,KAAK;CACvB,IAAI,SAAS,MACX,OAAO;EAAE;EAAM,KAAK,OAAO,KAAK;EAAG,MAAM,CAAC;EAAG,QAAQ,CAAC;EAAG,SAAS,CAAC;CAAE;CAEvE,OAAO;EACL;EACA,KAAK,MAAM,IAAI,CAAC,CAAC;GAAE,SAAS;GAAO,OAAO;EAAK,CAAC;EAChD,MAAM,KAAK,UAAU,IAAI,GAAGA,MAAI,IAAI,MAAM,IAAI,CAAC,GAAGA,MAAI,QAAQ;EAC9D,QAAQ,SAAS,IAAI;EACrB,SAAS,UAAU,IAAI;CACzB;AACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as keyIn, c as chordsOf, d as analyze, i as KeySpanSchema, l as Analysis, n as BarRangeSchema, o as ChordSpan, r as KeySpan, s as ChordSpanSchema, t as BarRange, u as AnalysisSchema } from "./analysis-BAPm6c9P.mjs";
|
|
2
|
+
import { i as soundingsOf, n as Span, r as overlapOf, t as Sounding } from "./sounding-BCyExbPp.mjs";
|
|
3
|
+
export { type Analysis, AnalysisSchema, type BarRange, BarRangeSchema, type ChordSpan, ChordSpanSchema, type KeySpan, KeySpanSchema, type Sounding, type Span, analyze, chordsOf, keyIn, overlapOf, soundingsOf };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { r as soundingsOf, t as overlapOf } from "./sounding-DYDZFp4e.mjs";
|
|
2
|
+
import { a as keyIn, i as KeySpanSchema, n as analyze, o as ChordSpanSchema, r as BarRangeSchema, s as chordsOf, t as AnalysisSchema } from "./analysis-CRyaJD5D.mjs";
|
|
3
|
+
export { AnalysisSchema, BarRangeSchema, ChordSpanSchema, KeySpanSchema, analyze, chordsOf, keyIn, overlapOf, soundingsOf };
|