@r_masseater/i68 0.2.3 → 0.2.4
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.
|
@@ -91,7 +91,7 @@ const runCli$1 = (cli) => {
|
|
|
91
91
|
runMain(cli.name)(Command.run(command, { version: cli.version }));
|
|
92
92
|
};
|
|
93
93
|
// package.json
|
|
94
|
-
var version = "0.2.
|
|
94
|
+
var version = "0.2.4";
|
|
95
95
|
var description = "A linter for .fumx songs that checks musical rules such as notes outside the key, part ranges, voicing clashes and parallel fifths, configured from vite.config.ts with rules written in TypeScript.";
|
|
96
96
|
// src/app/cli.ts
|
|
97
97
|
const runCli = () => {
|
|
@@ -108,4 +108,4 @@ const runCli = () => {
|
|
|
108
108
|
};
|
|
109
109
|
export { runCli };
|
|
110
110
|
|
|
111
|
-
//# sourceMappingURL=cli-
|
|
111
|
+
//# sourceMappingURL=cli-cJLiG0az.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-DKVZdFYo.mjs","names":["Arr","Fn","Str","runCli","manifest.version","manifest.description"],"sources":["../../lint-host/src/features/run-cli/model/cli.ts","../package.json","../src/app/cli.ts"],"sourcesContent":["import { runMain } from \"@r_masseater/node-main\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Option,\n Path,\n Record as Rec,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Argument, Command, Flag } from \"effect/cli\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { NotUtf8Error } from \"#/shared/lib/fail.ts\";\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst DATA_FIRST_ARITY = 2;\nconst STRICT_UTF8 = new TextDecoder(\"utf-8\", { fatal: true });\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config, Failure> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n readonly read: (file: string) => Effect.Effect<string, Failure | NotUtf8Error>;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface SectionSource<Config, Failure> {\n readonly name: string;\n readonly version: string;\n readonly description: string;\n readonly section: (config: unknown) => Config;\n readonly failWith: FailWith<Failure>;\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> extends SectionSource<\n Config,\n Failure\n> {\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config, Failure>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolParameter {\n readonly name: string;\n readonly description: string;\n}\n\nexport interface ToolInput {\n readonly flags: ReadonlySet<string>;\n readonly args: readonly string[];\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly input: ToolInput;\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly flags: readonly ToolParameter[];\n readonly argument: ToolParameter;\n readonly scan: (call: ToolCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\ntype CliServices = FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;\n\nconst readSectionIn = <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: source.failWith(`could not load ${file}`),\n }),\n });\n return source.section(loaded);\n }).pipe(Effect.withSpan(`${source.name}.config`));\n\n/** @internal */\nexport const readSection: {\n (\n root: string,\n ): <Config, Failure>(\n source: SectionSource<Config, Failure>,\n ) => Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n ): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n} = Fn.dual(DATA_FIRST_ARITY, readSectionIn);\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst failWhen = (failed: boolean): Effect.Effect<void> =>\n Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.succeed(failed),\n ).pipe(Effect.asVoid);\n\nconst printAll = <Found>(\n found: readonly Found[],\n format: (found: Found) => string,\n): Effect.Effect<void> =>\n Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(format), Arr.join(\"\\n\"))),\n });\n\nconst readerIn = <Failure>(\n root: string,\n failWith: FailWith<Failure>,\n): Effect.Effect<\n (file: string) => Effect.Effect<string, Failure | NotUtf8Error>,\n never,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* reader() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return (file: string): Effect.Effect<string, Failure | NotUtf8Error> =>\n fileSystem.readFile(path.resolve(root, file)).pipe(\n Effect.mapError(failWith(`could not read ${file}`)),\n Effect.flatMap((bytes) =>\n Effect.try({\n try: () => STRICT_UTF8.decode(bytes),\n catch: () => NotUtf8Error.make({ path: file }),\n }),\n ),\n );\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n patterns: readonly string[],\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(cli, root);\n const pathspecs = cli.pathspecs(requestOf(config, patterns));\n const { files, projectFiles } = yield* Effect.all(\n {\n files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),\n projectFiles: trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`)),\n },\n { concurrency: \"unbounded\" },\n );\n const read = yield* readerIn(root, cli.failWith);\n const found = yield* cli.lint({ root, files, projectFiles, config, read });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf =\n <Config, Found, Failure>(tool: Tool<Config, Found, Failure>) =>\n (input: ToolInput): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(tool, root);\n const found = yield* tool.scan({ root, config, input });\n yield* printAll(found, tool.format);\n yield* failWhen(Arr.isReadonlyArrayNonEmpty(found));\n });\n\nconst variadicOf = ({ name, description }: ToolParameter): Argument.Argument<readonly string[]> =>\n Argument.String(name).pipe(Argument.withDescription(description), Argument.variadic());\n\nconst flagsOf = (flags: readonly ToolParameter[]): Readonly<Record<string, Flag.Flag<boolean>>> =>\n Rec.fromEntries(\n pipe(\n flags,\n Arr.map(({ name, description }) => [\n name,\n Flag.Boolean(name).pipe(Flag.withDescription(description), Flag.withDefault(false)),\n ]),\n ),\n );\n\nconst setFlags = (values: Readonly<Record<string, boolean>>): ReadonlySet<string> =>\n new Set(pipe(values, Rec.filter(Fn.identity), Rec.keys));\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n const command = Command.make(\n tool.name,\n { args: variadicOf(tool.argument), flags: flagsOf(tool.flags) },\n ({ args, flags }) => toolMainOf(tool)({ args, flags: setFlags(flags) }),\n ).pipe(Command.withDescription(tool.description));\n runMain(tool.name)(Command.run(command, { version: tool.version }));\n};\n\nconst pathspecArgument = (): Argument.Argument<readonly string[]> =>\n variadicOf({\n name: \"pathspec\",\n description: \"Git pathspecs of the files to lint, in place of the configured ones\",\n });\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n const command = Command.make(cli.name, { pathspecs: pathspecArgument() }, ({ pathspecs }) =>\n mainOf(cli, pathspecs),\n ).pipe(Command.withDescription(cli.description));\n runMain(cli.name)(Command.run(command, { version: cli.version }));\n};\n","","import { formatDiagnostic, runCli as runLinter } from \"@masseater.dev/lint-host\";\nimport manifest from \"@r_masseater/i68/package.json\" with { type: \"json\" };\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\n\nimport { lint } from \"./lint.ts\";\nimport { i68Section, songPathspecs } from \"./section.ts\";\n\nexport const runCli = (): void => {\n runLinter({\n name: \"i68\",\n version: manifest.version,\n description: manifest.description,\n section: i68Section,\n pathspecs: songPathspecs,\n lint,\n format: formatDiagnostic,\n failWith: failedWith,\n });\n};\n"],"mappings":";;;;;;;AAqBA,MAAM,eAAe;CAAC;CAAkB;CAAmB;CAAkB;AAAiB;AAC9F,MAAM,SAAS;AACf,MAAM,mBAAmB;AACzB,MAAM,cAAc,IAAI,YAAY,SAAS,EAAE,OAAO,KAAK,CAAC;AA6D5D,MAAM,iBACJ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,IAAI,MAAM;CACjC,OAAO,SAAS,SAAS,KAAK,CAAC;AACjC,CAAC;AAaH,MAAM,cAAc,EAAE,MAAM,kBAC1B,SAAS,OAAO,IAAI,CAAC,CAAC,KAAK,SAAS,gBAAgB,WAAW,GAAG,SAAS,SAAS,CAAC;AAyBvF,MAAM,yBACJ,WAAW;CACT,MAAM;CACN,aAAa;AACf,CAAC;AAEH,MAAaG,YACX,QACS;CACT,MAAM,UAAU,QAAQ,KAAK,IAAI,MAAM,EAAE,WAAW,iBAAiB,EAAE,IAAI,EAAE,gBAC3E,OAAO,KAAK,SAAS,CACvB,CAAC,CAAC,KAAK,QAAQ,gBAAgB,IAAI,WAAW,CAAC;CAC/C,QAAQ,IAAI,IAAI,CAAC,CAAC,QAAQ,IAAI,SAAS,EAAE,SAAS,IAAI,QAAQ,CAAC,CAAC;AAClE;;;;;AE5PA,MAAa,eAAqB;CAChC,SAAU;EACR,MAAM;EACGC;EACIC;EACb,SAAS;EACT,WAAW;EACX;EACA,QAAQ;EACR,UAAU;CACZ,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"cli-cJLiG0az.mjs","names":["Arr","Fn","Str","runCli","manifest.version","manifest.description"],"sources":["../../lint-host/src/features/run-cli/model/cli.ts","../package.json","../src/app/cli.ts"],"sourcesContent":["import { runMain } from \"@r_masseater/node-main\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Option,\n Path,\n Record as Rec,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Argument, Command, Flag } from \"effect/cli\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { NotUtf8Error } from \"#/shared/lib/fail.ts\";\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst DATA_FIRST_ARITY = 2;\nconst STRICT_UTF8 = new TextDecoder(\"utf-8\", { fatal: true });\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config, Failure> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n readonly read: (file: string) => Effect.Effect<string, Failure | NotUtf8Error>;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface SectionSource<Config, Failure> {\n readonly name: string;\n readonly version: string;\n readonly description: string;\n readonly section: (config: unknown) => Config;\n readonly failWith: FailWith<Failure>;\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> extends SectionSource<\n Config,\n Failure\n> {\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config, Failure>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolParameter {\n readonly name: string;\n readonly description: string;\n}\n\nexport interface ToolInput {\n readonly flags: ReadonlySet<string>;\n readonly args: readonly string[];\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly input: ToolInput;\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly flags: readonly ToolParameter[];\n readonly argument: ToolParameter;\n readonly scan: (call: ToolCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\ntype CliServices = FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;\n\nconst readSectionIn = <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: source.failWith(`could not load ${file}`),\n }),\n });\n return source.section(loaded);\n }).pipe(Effect.withSpan(`${source.name}.config`));\n\n/** @internal */\nexport const readSection: {\n (\n root: string,\n ): <Config, Failure>(\n source: SectionSource<Config, Failure>,\n ) => Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n ): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n} = Fn.dual(DATA_FIRST_ARITY, readSectionIn);\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst failWhen = (failed: boolean): Effect.Effect<void> =>\n Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.succeed(failed),\n ).pipe(Effect.asVoid);\n\nconst printAll = <Found>(\n found: readonly Found[],\n format: (found: Found) => string,\n): Effect.Effect<void> =>\n Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(format), Arr.join(\"\\n\"))),\n });\n\nconst readerIn = <Failure>(\n root: string,\n failWith: FailWith<Failure>,\n): Effect.Effect<\n (file: string) => Effect.Effect<string, Failure | NotUtf8Error>,\n never,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* reader() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return (file: string): Effect.Effect<string, Failure | NotUtf8Error> =>\n fileSystem.readFile(path.resolve(root, file)).pipe(\n Effect.mapError(failWith(`could not read ${file}`)),\n Effect.flatMap((bytes) =>\n Effect.try({\n try: () => STRICT_UTF8.decode(bytes),\n catch: () => NotUtf8Error.make({ path: file }),\n }),\n ),\n );\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n patterns: readonly string[],\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(cli, root);\n const pathspecs = cli.pathspecs(requestOf(config, patterns));\n const { files, projectFiles } = yield* Effect.all(\n {\n files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),\n projectFiles: trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`)),\n },\n { concurrency: \"unbounded\" },\n );\n const read = yield* readerIn(root, cli.failWith);\n const found = yield* cli.lint({ root, files, projectFiles, config, read });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf =\n <Config, Found, Failure>(tool: Tool<Config, Found, Failure>) =>\n (input: ToolInput): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(tool, root);\n const found = yield* tool.scan({ root, config, input });\n yield* printAll(found, tool.format);\n yield* failWhen(Arr.isReadonlyArrayNonEmpty(found));\n });\n\nconst variadicOf = ({ name, description }: ToolParameter): Argument.Argument<readonly string[]> =>\n Argument.String(name).pipe(Argument.withDescription(description), Argument.variadic());\n\nconst flagsOf = (flags: readonly ToolParameter[]): Readonly<Record<string, Flag.Flag<boolean>>> =>\n Rec.fromEntries(\n pipe(\n flags,\n Arr.map(({ name, description }) => [\n name,\n Flag.Boolean(name).pipe(Flag.withDescription(description), Flag.withDefault(false)),\n ]),\n ),\n );\n\nconst setFlags = (values: Readonly<Record<string, boolean>>): ReadonlySet<string> =>\n new Set(pipe(values, Rec.filter(Fn.identity), Rec.keys));\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n const command = Command.make(\n tool.name,\n { args: variadicOf(tool.argument), flags: flagsOf(tool.flags) },\n ({ args, flags }) => toolMainOf(tool)({ args, flags: setFlags(flags) }),\n ).pipe(Command.withDescription(tool.description));\n runMain(tool.name)(Command.run(command, { version: tool.version }));\n};\n\nconst pathspecArgument = (): Argument.Argument<readonly string[]> =>\n variadicOf({\n name: \"pathspec\",\n description: \"Git pathspecs of the files to lint, in place of the configured ones\",\n });\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n const command = Command.make(cli.name, { pathspecs: pathspecArgument() }, ({ pathspecs }) =>\n mainOf(cli, pathspecs),\n ).pipe(Command.withDescription(cli.description));\n runMain(cli.name)(Command.run(command, { version: cli.version }));\n};\n","","import { formatDiagnostic, runCli as runLinter } from \"@masseater.dev/lint-host\";\nimport manifest from \"@r_masseater/i68/package.json\" with { type: \"json\" };\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\n\nimport { lint } from \"./lint.ts\";\nimport { i68Section, songPathspecs } from \"./section.ts\";\n\nexport const runCli = (): void => {\n runLinter({\n name: \"i68\",\n version: manifest.version,\n description: manifest.description,\n section: i68Section,\n pathspecs: songPathspecs,\n lint,\n format: formatDiagnostic,\n failWith: failedWith,\n });\n};\n"],"mappings":";;;;;;;AAqBA,MAAM,eAAe;CAAC;CAAkB;CAAmB;CAAkB;AAAiB;AAC9F,MAAM,SAAS;AACf,MAAM,mBAAmB;AACzB,MAAM,cAAc,IAAI,YAAY,S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;EAAc;EAAQ;CAAK,CAAC;CACzE,OAAO,SAAS,OAAO,IAAI,MAAM;CACjC,OAAO,SAAS,SAAS,KAAK,CAAC;AACjC,CAAC;AAaH,MAAM,cAAc,EAAE,MAAM,kBAC1B,SAAS,OAAO,IAAI,CAAC,CAAC,KAAK,SAAS,gBAAgB,WAAW,GAAG,SAAS,SAAS,CAAC;AAyBvF,MAAM,yBACJ,WAAW;CACT,MAAM;CACN,aAAa;AACf,CAAC;AAEH,MAAaG,YACX,QACS;CACT,MAAM,UAAU,QAAQ,KAAK,IAAI,MAAM,EAAE,WAAW,iBAAiB,EAAE,IAAI,EAAE,gBAC3E,OAAO,KAAK,SAAS,CACvB,CAAC,CAAC,KAAK,QAAQ,gBAAgB,IAAI,WAAW,CAAC;CAC/C,QAAQ,IAAI,IAAI,CAAC,CAAC,QAAQ,IAAI,SAAS,EAAE,SAAS,IAAI,QAAQ,CAAC,CAAC;AAClE;;;;;AE5PA,MAAa,eAAqB;CAChC,SAAU;EACR,MAAM;EACGC;EACIC;EACb,SAAS;EACT,WAAW;EACX;EACA,QAAQ;EACR,UAAU;CACZ,CAAC;AACH"}
|
package/dist/cli.mjs
CHANGED
package/dist/presets.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as defineRule, t as definePlugin } from "./app-Dvnt_9zv.mjs";
|
|
2
|
-
import { A as tracksOf, C as neighborsOf, D as sortByPitch, E as reporterOf, O as soundingAt, S as lowest, T as overlappingPairs, _ as pitchClassOf, a as StyleRulesSchema, b as highest, c as mixKeyOf, d as bach_chorales_default, f as progressionOf, g as nameOf, h as midiOf, i as HABIT_KINDS, k as topLineOf, m as keysOf, n as placeIn, p as keyAt, r as trackKeyOf, s as subjectKeyOf, t as mixFactsOf, u as longestContext, v as MELODIC, w as onsetsOf, x as isPitched, y as hasRole } from "./mix-facts-fJHVIUfj.mjs";
|
|
2
|
+
import { A as tracksOf, C as neighborsOf, D as sortByPitch, E as reporterOf, O as soundingAt, S as lowest, T as overlappingPairs, _ as pitchClassOf, a as StyleRulesSchema, b as highest, c as mixKeyOf, d as bach_chorales_default, f as progressionOf, g as nameOf, h as midiOf$1, i as HABIT_KINDS, k as topLineOf, m as keysOf, n as placeIn, p as keyAt, r as trackKeyOf, s as subjectKeyOf, t as mixFactsOf, u as longestContext, v as MELODIC, w as onsetsOf, x as isPitched, y as hasRole } from "./mix-facts-fJHVIUfj.mjs";
|
|
3
3
|
import { Array, Match, Number, Option, Order, Predicate, Record, String as String$1, pipe } from "effect";
|
|
4
4
|
import { TICKS_PER_WHOLE } from "@r_masseater/song-format";
|
|
5
|
-
import { Chord } from "tonal";
|
|
5
|
+
import { Chord, Note, VoiceLeading } from "tonal";
|
|
6
6
|
// src/app/presets/shared/lib/options.ts
|
|
7
7
|
const numberOption = ({ key, fallback }) => (options) => pipe(Option.fromNullishOr(options[key]), Option.filter(Predicate.isNumber), Option.getOrElse(() => fallback));
|
|
8
8
|
// src/app/presets/features/check-harmony/model/chord-above-melody.ts
|
|
@@ -152,9 +152,15 @@ const chordOf = (onset) => ({
|
|
|
152
152
|
first: Array.headNonEmpty(onset),
|
|
153
153
|
pitches: pipe(onset, Array.map((sounding) => sounding.midi), Array.dedupe)
|
|
154
154
|
});
|
|
155
|
-
const
|
|
155
|
+
const midiOf = (note) => Option.fromNullishOr(Note.midi(note));
|
|
156
|
+
const sizeOf = ([from, to]) => Option.map(Option.all([midiOf(from), midiOf(to)]), ([start, end]) => Math.abs(end - start));
|
|
157
|
+
const namesOf = (chord) => pipe(chord.pitches, Array.map((midi) => Note.fromMidi(midi)));
|
|
158
|
+
const movesOf = (previous, next) => {
|
|
159
|
+
const { moves } = VoiceLeading.get(namesOf(previous), namesOf(next));
|
|
160
|
+
return pipe(moves, Array.map(sizeOf), Array.getSomes);
|
|
161
|
+
};
|
|
156
162
|
const checkChange = (report, max) => ([previous, next]) => {
|
|
157
|
-
const leaps = pipe(
|
|
163
|
+
const leaps = pipe(movesOf(previous, next), Array.filter((move) => move > max));
|
|
158
164
|
if (next.first.start - previous.first.start <= NEARBY && Array.isReadonlyArrayNonEmpty(leaps)) report(`${String(next.first.line)}:${String(next.first.start)}`, {
|
|
159
165
|
line: next.first.line,
|
|
160
166
|
column: next.first.column,
|
|
@@ -393,8 +399,8 @@ const DEFAULT_RANGES = {
|
|
|
393
399
|
const RANGE_LENGTH = 2;
|
|
394
400
|
const isRange = (value) => Array.isArray(value) && value.length === RANGE_LENGTH && pipe(value, Array.every(Predicate.isString));
|
|
395
401
|
const boundsOf = ([low, high]) => Option.all({
|
|
396
|
-
low: midiOf(low),
|
|
397
|
-
high: midiOf(high),
|
|
402
|
+
low: midiOf$1(low),
|
|
403
|
+
high: midiOf$1(high),
|
|
398
404
|
name: Option.some(`${low}-${high}`)
|
|
399
405
|
});
|
|
400
406
|
const configured = (options) => pipe(Option.fromNullishOr(options["ranges"]), Option.filter(Predicate.isObject), Option.map((value) => ({
|
package/dist/presets.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.mjs","names":["UNISON","checkPair","Arr","stepsOf","Arr","checkPair","Rec","Arr","MAJOR_THIRD","Arr","Arr","Arr","Arr","checkStep","Arr","Arr","Rec","Arr","checkNote","Arr","Rec","checkNote","Arr","Rec","Arr","Arr","Str","FIRST","Rec","Arr","Num","BACH_CHORALES","Str","Arr","Arr"],"sources":["../src/app/presets/shared/lib/options.ts","../src/app/presets/features/check-harmony/model/chord-above-melody.ts","../src/app/presets/features/check-harmony/model/crowded-low-mids.ts","../src/app/presets/features/check-harmony/model/low-interval-limit.ts","../src/app/presets/features/check-harmony/model/semitone-clash.ts","../src/app/presets/features/check-harmony/model/voice-jump.ts","../src/app/presets/features/check-harmony/model/preset.ts","../src/app/presets/shared/lib/time.ts","../src/app/presets/features/check-pop/model/breath.ts","../src/app/presets/features/check-pop/model/melody-leap.ts","../src/app/presets/shared/lib/chords.ts","../src/app/presets/features/check-pop/model/out-of-key.ts","../src/app/presets/features/check-pop/model/part-range.ts","../src/app/presets/features/check-pop/model/preset.ts","../src/app/presets/features/check-classical/model/outer-voices.ts","../src/app/presets/features/check-classical/model/parallel-perfects.ts","../src/app/presets/features/check-classical/model/unresolved-dissonance.ts","../src/app/presets/features/check-classical/model/preset.ts","../src/app/presets/features/check-progressions/model/named.ts","../src/app/presets/features/check-progressions/model/preset.ts","../src/app/presets/features/check-style/model/rare-transition.ts","../src/app/presets/features/check-style/model/preset.ts","../src/app/presets/features/check-habits/model/occasions.ts","../src/app/presets/features/check-habits/model/habit-rule.ts","../src/app/presets/features/check-habits/model/preset.ts","../src/app/presets.ts"],"sourcesContent":["import { Option, Predicate, pipe } from \"effect\";\n\nimport type { RuleOptions } from \"#/shared/config/index.ts\";\n\nexport interface NumberOption {\n readonly key: string;\n readonly fallback: number;\n}\n\nexport const numberOption =\n ({ key, fallback }: NumberOption) =>\n (options: RuleOptions): number =>\n pipe(\n Option.fromNullishOr(options[key]),\n Option.filter(Predicate.isNumber),\n Option.getOrElse(() => fallback),\n );\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport { hasRole, overlappingPairs, reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Pair, Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst UNISON = 0;\nconst within = numberOption({ key: \"within\", fallback: UNISON });\nconst isMelody = hasRole([\"melody\"]);\nconst isHarmony = hasRole([\"harmony\"]);\n\nconst placementOf = (distance: number, room: number): Option.Option<string> => {\n if (distance < UNISON) {\n return Option.some(\"above\");\n }\n if (distance > UNISON && distance <= room) {\n return Option.some(\"just below\");\n }\n return Option.none();\n};\n\nconst checkPair =\n (report: Reporter, room: number) =>\n (pair: Pair): void => {\n const parts = Option.all({\n melody: pipe(pair, Arr.findFirst(isMelody)),\n chord: pipe(pair, Arr.findFirst(isHarmony)),\n });\n for (const { melody, chord } of Option.toArray(parts)) {\n for (const where of Option.toArray(placementOf(melody.midi - chord.midi, room))) {\n report(`${String(chord.line)}:${String(chord.column)}:${String(chord.bar)}`, {\n line: chord.line,\n column: chord.column,\n message: `${chord.spelling} in ${chord.track} sits ${where} the melody note ${melody.spelling}`,\n detail: \"Keep the chord below the melody with some room between them\",\n });\n }\n }\n };\n\nconst isPart = (sounding: Sounding): boolean => isMelody(sounding) || isHarmony(sounding);\n\nexport const chordAboveMelody: Rule = defineRule({\n meta: { description: \"Chord parts stay below the lead melody\" },\n check: (context) => {\n const check = checkPair(reporterOf(context), within(context.options));\n for (const pair of overlappingPairs(pipe(context.soundings, Arr.filter(isPart)))) {\n check(pair);\n }\n },\n});\n","import type { Bar } from \"@r_masseater/song-format\";\nimport { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport { hasRole, isPitched, reporterOf, soundingAt } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst SIXTEENTHS_PER_WHOLE = 16;\nconst SIXTEENTH = TICKS_PER_WHOLE / SIXTEENTHS_PER_WHOLE;\nconst LOW_MID_FLOOR = 45;\nconst BASS_FLOOR = 40;\nconst LOW_MID_CEILING = 59;\nconst DEFAULT_MAX = 3;\nconst maxNotes = numberOption({ key: \"max\", fallback: DEFAULT_MAX });\n\nconst floorOf = (sounding: Sounding): number => {\n if (hasRole([\"bass\"])(sounding)) {\n return BASS_FLOOR;\n }\n return LOW_MID_FLOOR;\n};\n\nconst inLowMids = (sounding: Sounding): boolean =>\n isPitched(sounding) && sounding.midi <= LOW_MID_CEILING && sounding.midi >= floorOf(sounding);\n\nconst stepsOf = (bar: Bar): readonly number[] =>\n Arr.makeBy(Math.ceil(bar.length / SIXTEENTH), (index) => bar.start + index * SIXTEENTH);\n\nconst crowdAt =\n (low: readonly Sounding[]) =>\n (tick: number): readonly Sounding[] =>\n pipe(\n soundingAt(low)(tick),\n Arr.dedupeWith((left, right) => left.track === right.track && left.midi === right.midi),\n );\n\nconst spellingsOf = (notes: readonly Sounding[]): string =>\n pipe(\n notes,\n Arr.map((note) => note.spelling),\n Arr.join(\", \"),\n );\n\nconst checkBar =\n (report: Reporter, low: readonly Sounding[], max: number) =>\n (bar: Bar): void => {\n const crowded = pipe(\n stepsOf(bar),\n Arr.map(crowdAt(low)),\n Arr.findFirst((notes) => notes.length > max),\n );\n for (const notes of Option.toArray(crowded)) {\n for (const first of Option.toArray(Arr.head(notes))) {\n report(String(bar.index), {\n line: first.line,\n column: first.column,\n message: `${String(notes.length)} notes crowd the low mids in bar ${String(bar.index)}: ${spellingsOf(notes)}`,\n detail: \"Thin the chord or move notes out of A2-B3\",\n });\n }\n }\n };\n\nexport const crowdedLowMids: Rule = defineRule({\n meta: { description: \"Few notes pile up between A2 and B3 at once\" },\n check: (context) => {\n const low = pipe(context.soundings, Arr.filter(inLowMids));\n const check = checkBar(reporterOf(context), low, maxNotes(context.options));\n for (const bar of context.song.bars) {\n check(bar);\n }\n },\n});\n","import { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport { nameOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport { isPitched, overlappingPairs, reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Pair, Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst LIMITS: Readonly<Record<string, number>> = {\n \"1\": 52,\n \"2\": 51,\n \"3\": 48,\n \"4\": 46,\n \"5\": 46,\n \"6\": 46,\n \"7\": 34,\n \"8\": 43,\n \"9\": 41,\n \"10\": 41,\n \"11\": 41,\n \"13\": 40,\n \"14\": 39,\n};\n\nconst checkPair =\n (report: Reporter) =>\n (pair: Pair): void => {\n const [first, second] = pair;\n const low = Math.min(first.midi, second.midi);\n const gap = Math.abs(first.midi - second.midi);\n const limits = pipe(LIMITS, Rec.get(String(gap)), Option.toArray);\n for (const limit of limits) {\n if (low < limit) {\n report(`${String(second.line)}:${String(low)}:${String(gap)}`, {\n line: second.line,\n column: second.column,\n message: `${String(gap)} semitones between ${first.spelling} (${first.track}) and ${second.spelling} (${second.track}) is below its limit ${nameOf(limit)}`,\n detail: \"Widen the interval or move the upper note up an octave\",\n });\n }\n }\n };\n\nexport const lowIntervalLimit: Rule = defineRule({\n meta: { description: \"Close intervals stay above the pitch where they turn muddy\" },\n check: (context) => {\n const check = checkPair(reporterOf(context));\n for (const pair of overlappingPairs(pipe(context.soundings, Arr.filter(isPitched)))) {\n check(pair);\n }\n },\n});\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Match, Option, pipe } from \"effect\";\n\nimport { pitchClassOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport {\n hasRole,\n isPitched,\n overlappingPairs,\n reporterOf,\n soundingAt,\n sortByPitch,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Pair, Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst MINOR_SECOND = 1;\nconst MINOR_NINTH = 13;\nconst CLUSTER_FLOOR = 59;\n\nconst MAJOR_THIRD = 4;\nconst MINOR_SEVENTH = 10;\nconst isBass = hasRole([\"bass\"]);\n\ntype Excused = (bottom: Sounding, top: Sounding) => boolean;\n\nconst dominantOver =\n (soundings: readonly Sounding[]): Excused =>\n (bottom, top) => {\n if (!isBass(bottom) && !isBass(top)) {\n return false;\n }\n if (!isBass(bottom) || top.midi - bottom.midi !== MINOR_NINTH) {\n return true;\n }\n const classes = pipe(\n soundingAt(soundings)(top.start),\n Arr.map((other) => pitchClassOf(other.midi - bottom.midi)),\n );\n return Arr.contains(classes, MAJOR_THIRD) && Arr.contains(classes, MINOR_SEVENTH);\n };\n\nconst nameOfGap = (gap: number): Option.Option<string> =>\n Match.value(gap).pipe(\n Match.when(MINOR_SECOND, () => Option.some(\"minor 2nd\")),\n Match.when(MINOR_NINTH, () => Option.some(\"minor 9th\")),\n Match.orElse(() => Option.none()),\n );\n\nconst isCluster = (low: Sounding, high: Sounding): boolean =>\n low.track === high.track && high.midi - low.midi === MINOR_SECOND && low.midi >= CLUSTER_FLOOR;\n\nconst checkPair =\n (report: Reporter, excused: Excused) =>\n (pair: Pair): void => {\n const [low, high] = sortByPitch(pair);\n const [, later] = pair;\n for (const [bottom, top] of Option.toArray(\n Option.all([Option.fromNullishOr(low), Option.fromNullishOr(high)]),\n )) {\n for (const name of Option.toArray(nameOfGap(top.midi - bottom.midi))) {\n if (!isCluster(bottom, top) && !excused(bottom, top)) {\n report(`${String(later.line)}:${String(bottom.midi)}:${String(top.midi)}`, {\n line: later.line,\n column: later.column,\n message: `${top.spelling} (${top.track}) and ${bottom.spelling} (${bottom.track}) clash a ${name} apart`,\n detail: \"Move one of the two notes to a chord note\",\n });\n }\n }\n }\n };\n\nexport const semitoneClash: Rule = defineRule({\n meta: {\n description:\n \"Parts do not sound a minor 2nd or minor 9th apart, except the flat 9th of a dominant over its bass\",\n },\n check: (context) => {\n const pitched = pipe(context.soundings, Arr.filter(isPitched));\n const check = checkPair(reporterOf(context), dominantOver(pitched));\n for (const pair of overlappingPairs(pitched)) {\n check(pair);\n }\n },\n});\n","import { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport {\n hasRole,\n neighborsOf,\n onsetsOf,\n reporterOf,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Onset, Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst MAJOR_THIRD = 4;\nconst MIN_VOICES = 3;\nconst NEARBY_WHOLES = 1.5;\nconst NEARBY = NEARBY_WHOLES * TICKS_PER_WHOLE;\nconst maxMove = numberOption({ key: \"max\", fallback: MAJOR_THIRD });\n\ninterface Chord {\n readonly first: Sounding;\n readonly pitches: readonly number[];\n}\n\nconst chordOf = (onset: Onset): Chord => ({\n first: Arr.headNonEmpty(onset),\n pitches: pipe(\n onset,\n Arr.map((sounding) => sounding.midi),\n Arr.dedupe,\n ),\n});\n\nconst nearestMove =\n (from: readonly number[]) =>\n (pitch: number): number =>\n Math.min(\n ...pipe(\n from,\n Arr.map((other) => Math.abs(pitch - other)),\n ),\n );\n\nconst checkChange =\n (report: Reporter, max: number) =>\n ([previous, next]: readonly [Chord, Chord]): void => {\n const leaps = pipe(\n next.pitches,\n Arr.map(nearestMove(previous.pitches)),\n Arr.filter((move) => move > max),\n );\n if (next.first.start - previous.first.start <= NEARBY && Arr.isReadonlyArrayNonEmpty(leaps)) {\n report(`${String(next.first.line)}:${String(next.first.start)}`, {\n line: next.first.line,\n column: next.first.column,\n message: `${String(leaps.length)} voices of ${next.first.track} leap more than ${String(max)} semitones into the next chord`,\n detail: \"Keep shared notes and move each voice to the closest note\",\n });\n }\n };\n\nconst chordsOf = (track: readonly Sounding[]): readonly Chord[] =>\n pipe(\n onsetsOf(track),\n Arr.map(chordOf),\n Arr.filter((chord) => chord.pitches.length >= MIN_VOICES),\n );\n\nexport const voiceJump: Rule = defineRule({\n meta: { description: \"Chord voices move to the nearest note of the next chord\" },\n check: (context) => {\n const check = checkChange(reporterOf(context), maxMove(context.options));\n const harmony = pipe(context.soundings, Arr.filter(hasRole([\"harmony\"])));\n for (const track of tracksOf(harmony)) {\n for (const change of neighborsOf(chordsOf(track))) {\n check(change);\n }\n }\n },\n});\n","import { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin } from \"#/shared/config/index.ts\";\n\nimport { chordAboveMelody } from \"./chord-above-melody.ts\";\nimport { crowdedLowMids } from \"./crowded-low-mids.ts\";\nimport { lowIntervalLimit } from \"./low-interval-limit.ts\";\nimport { semitoneClash } from \"./semitone-clash.ts\";\nimport { voiceJump } from \"./voice-jump.ts\";\n\nexport const harmonyPlugin: Plugin = definePlugin({\n rules: {\n \"semitone-clash\": semitoneClash,\n \"low-interval-limit\": lowIntervalLimit,\n \"crowded-low-mids\": crowdedLowMids,\n \"chord-above-melody\": chordAboveMelody,\n \"voice-jump\": voiceJump,\n },\n});\n\nexport const harmony = (): I68Config => ({\n plugins: { harmony: harmonyPlugin },\n rules: {\n \"harmony/semitone-clash\": \"warn\",\n \"harmony/low-interval-limit\": \"warn\",\n \"harmony/crowded-low-mids\": \"warn\",\n \"harmony/chord-above-melody\": \"warn\",\n \"harmony/voice-jump\": \"warn\",\n },\n});\n","import type { Bar, Song } from \"@r_masseater/song-format\";\nimport { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport { Array as Arr, pipe } from \"effect\";\n\nconst SECONDS_PER_MINUTE = 60;\nconst QUARTERS_PER_WHOLE = 4;\nconst NONE = 0;\n\ninterface Segment {\n readonly start: number;\n readonly end: number;\n readonly bpm: number;\n}\n\nconst segmentsIn = (bar: Bar): readonly Segment[] =>\n Arr.match(bar.tempoSteps, {\n onEmpty: () => [{ start: bar.start, end: bar.start + bar.length, bpm: bar.tempo.bpm }],\n onNonEmpty: (steps) =>\n pipe(\n steps,\n Arr.map((step) => ({\n start: bar.start + step.offset,\n end: bar.start + step.offset + step.length,\n bpm: step.bpm,\n })),\n ),\n });\n\nconst secondsPerTick = (bpm: number): number =>\n (SECONDS_PER_MINUTE * QUARTERS_PER_WHOLE) / (bpm * TICKS_PER_WHOLE);\n\nexport const clockOf = (song: Song): ((tick: number) => number) => {\n const segments = pipe(song.bars, Arr.flatMap(segmentsIn));\n return (tick) => {\n let seconds = NONE;\n for (const segment of segments) {\n if (segment.start < tick) {\n seconds += (Math.min(tick, segment.end) - segment.start) * secondsPerTick(segment.bpm);\n }\n }\n return seconds;\n };\n};\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport { clockOf } from \"#/app/presets/shared/lib/time.ts\";\nimport {\n MELODIC,\n hasRole,\n reporterOf,\n topLineOf,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst DEFAULT_SECONDS = 8;\nconst DEFAULT_REST = 0.15;\nconst DIGITS = 1;\nconst LAST = 1;\nconst maxSeconds = numberOption({ key: \"seconds\", fallback: DEFAULT_SECONDS });\nconst minRest = numberOption({ key: \"rest\", fallback: DEFAULT_REST });\n\ntype Clock = (tick: number) => number;\n\ntype Phrase = Arr.NonEmptyReadonlyArray<Sounding>;\n\nconst phrasesOf =\n (clock: Clock, rest: number) =>\n (line: readonly Sounding[]): readonly Phrase[] =>\n Arr.reduce(line, Arr.empty<Phrase>(), (phrases, note): readonly Phrase[] =>\n pipe(\n Arr.last(phrases),\n Option.filter((phrase) => clock(note.start) - clock(Arr.lastNonEmpty(phrase).end) < rest),\n Option.match({\n onNone: () => Arr.append(phrases, Arr.of(note)),\n onSome: (phrase) => Arr.append(Arr.dropRight(phrases, LAST), Arr.append(phrase, note)),\n }),\n ),\n );\n\nconst endOf = (phrase: Phrase): number =>\n pipe(\n phrase,\n Arr.map((sounding) => sounding.end),\n (ends) => Math.max(...ends),\n );\n\nconst checkPhrase =\n (report: Reporter, clock: Clock, max: number) =>\n (phrase: Phrase): void => {\n const first = Arr.headNonEmpty(phrase);\n const seconds = clock(endOf(phrase)) - clock(first.start);\n if (seconds > max) {\n report(`${String(first.line)}:${String(first.start)}`, {\n line: first.line,\n column: first.column,\n message: `${first.track} sings for ${seconds.toFixed(DIGITS)} seconds without a rest`,\n detail: \"Put a short rest in the phrase\",\n });\n }\n };\n\nexport const breath: Rule = defineRule({\n meta: { description: \"A sung line leaves room to breathe\" },\n check: (context) => {\n const clock = clockOf(context.song);\n const check = checkPhrase(reporterOf(context), clock, maxSeconds(context.options));\n const split = phrasesOf(clock, minRest(context.options));\n const melodic = pipe(context.soundings, Arr.filter(hasRole(MELODIC)));\n for (const track of tracksOf(melodic)) {\n for (const phrase of split(topLineOf(track))) {\n check(phrase);\n }\n }\n },\n});\n","import { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport {\n MELODIC,\n hasRole,\n neighborsOf,\n reporterOf,\n topLineOf,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst OCTAVE = 12;\nconst maxLeap = numberOption({ key: \"max\", fallback: OCTAVE });\n\nconst checkStep =\n (report: Reporter, max: number) =>\n ([previous, next]: readonly [Sounding, Sounding]): void => {\n const leap = Math.abs(next.midi - previous.midi);\n if (leap > max && next.start - previous.end < TICKS_PER_WHOLE) {\n report(`${String(next.line)}:${String(next.start)}`, {\n line: next.line,\n column: next.column,\n message: `${next.track} leaps ${String(leap)} semitones from ${previous.spelling} to ${next.spelling}`,\n detail: \"Make the jump smaller, or step back the other way right after it\",\n });\n }\n };\n\nexport const melodyLeap: Rule = defineRule({\n meta: { description: \"A melody does not jump further than an octave from one note to the next\" },\n check: (context) => {\n const check = checkStep(reporterOf(context), maxLeap(context.options));\n const melodic = pipe(context.soundings, Arr.filter(hasRole(MELODIC)));\n for (const track of tracksOf(melodic)) {\n for (const step of neighborsOf(topLineOf(track))) {\n check(step);\n }\n }\n },\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { Chord } from \"tonal\";\n\nconst COMMON = [\n \"M\",\n \"m\",\n \"dim\",\n \"aug\",\n \"7\",\n \"maj7\",\n \"m7\",\n \"m7b5\",\n \"dim7\",\n \"sus4\",\n \"sus2\",\n \"6\",\n \"m6\",\n \"Madd9\",\n \"madd9\",\n \"9\",\n \"maj9\",\n \"m9\",\n \"7sus4\",\n \"m/ma7\",\n \"6add9\",\n \"m69\",\n \"5\",\n];\nconst DYAD = 2;\n\nconst isCommonName = (name: string): boolean =>\n pipe(\n Arr.head(Chord.get(name).aliases),\n Option.exists((alias) => Arr.contains(COMMON, alias)),\n );\n\nexport const isCommonChord = (pitchClasses: readonly string[]): boolean => {\n const names = Arr.dedupe(pitchClasses);\n if (names.length < DYAD) {\n return true;\n }\n return pipe(Chord.detect(names), Arr.some(isCommonName));\n};\n","import { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport type { KeySpan, Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport { isCommonChord } from \"#/app/presets/shared/lib/chords.ts\";\nimport { keyAt, keysOf } from \"#/app/presets/shared/lib/keys.ts\";\nimport { pitchClassOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport {\n hasRole,\n isPitched,\n reporterOf,\n soundingAt,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst EIGHTHS_PER_WHOLE = 8;\nconst ORNAMENT = TICKS_PER_WHOLE / EIGHTHS_PER_WHOLE;\nconst HALF_STEP = 1;\nconst WHOLE_STEP = 2;\nconst MAJOR_STEPS = { tonic: 0, second: 2, third: 4, fourth: 5, fifth: 7, sixth: 9, seventh: 11 };\nconst MINOR_STEPS = {\n tonic: 0,\n second: 2,\n flatThird: 3,\n fourth: 5,\n fifth: 7,\n flatSixth: 8,\n raisedSixth: 9,\n flatSeventh: 10,\n leadingTone: 11,\n};\nconst MAJOR = Rec.values(MAJOR_STEPS);\nconst MINOR = Rec.values(MINOR_STEPS);\nconst stepsOf = (key: KeySpan): readonly number[] => {\n if (key.mode === \"major\") {\n return MAJOR;\n }\n return MINOR;\n};\n\nconst inScale =\n (key: KeySpan) =>\n (midi: number): boolean =>\n Arr.contains(stepsOf(key), pitchClassOf(midi - key.pitchClass));\n\ntype Fits = (sounding: Sounding) => boolean;\n\nconst inChordOf = (soundings: readonly Sounding[]): Fits => {\n const harmony = pipe(soundings, Arr.filter(hasRole([\"bass\", \"harmony\"])));\n return (sounding) => {\n const under = soundingAt(harmony)(sounding.start);\n const shared = pipe(\n under,\n Arr.some(\n (other) =>\n other.track !== sounding.track &&\n pitchClassOf(other.midi) === pitchClassOf(sounding.midi),\n ),\n );\n const voicesChord =\n hasRole([\"bass\", \"harmony\"])(sounding) &&\n isCommonChord(\n pipe(\n under,\n Arr.map((other) => other.pitchClass),\n ),\n );\n return shared || voicesChord;\n };\n};\n\nconst isStep = (from: Sounding, to: Sounding): boolean => {\n const distance = Math.abs(to.midi - from.midi);\n return distance >= HALF_STEP && distance <= WHOLE_STEP;\n};\n\nconst neighboursOf =\n (track: readonly Sounding[]) =>\n (sounding: Sounding): Option.Option<readonly [Sounding, Sounding]> => {\n const before = pipe(\n track,\n Arr.findLast((other) => other.end === sounding.start),\n );\n const after = pipe(\n track,\n Arr.findFirst((other) => other.start === sounding.end),\n );\n return Option.all([before, after]);\n };\n\nconst isOrnament =\n (fits: Fits, track: readonly Sounding[]) =>\n (sounding: Sounding): boolean =>\n sounding.end - sounding.start <= ORNAMENT &&\n pipe(\n neighboursOf(track)(sounding),\n Option.exists(\n ([before, after]) =>\n isStep(before, sounding) && isStep(sounding, after) && fits(before) && fits(after),\n ),\n );\n\nconst fitsOf =\n (keys: readonly KeySpan[], inChord: Fits): Fits =>\n (sounding) =>\n inChord(sounding) ||\n pipe(\n keyAt(keys)(sounding.bar),\n Option.match({ onNone: () => true, onSome: (key) => inScale(key)(sounding.midi) }),\n );\n\ninterface NoteCheck {\n readonly report: Reporter;\n readonly keys: readonly KeySpan[];\n readonly fits: Fits;\n readonly tracks: readonly (readonly Sounding[])[];\n}\n\nconst trackOf =\n (tracks: readonly (readonly Sounding[])[]) =>\n (sounding: Sounding): readonly Sounding[] =>\n pipe(\n tracks,\n Arr.findFirst((candidate) =>\n pipe(\n candidate,\n Arr.some((other) => other.track === sounding.track),\n ),\n ),\n Option.getOrElse((): readonly Sounding[] => []),\n );\n\nconst checkNote =\n ({ report, keys, fits, tracks }: NoteCheck) =>\n (sounding: Sounding): void => {\n const track = trackOf(tracks)(sounding);\n for (const key of Option.toArray(keyAt(keys)(sounding.bar))) {\n if (!fits(sounding) && !isOrnament(fits, track)(sounding)) {\n report(`${String(sounding.line)}:${String(sounding.column)}`, {\n line: sounding.line,\n column: sounding.column,\n message: `${sounding.spelling} in ${sounding.track} is outside ${key.tonic} ${key.mode} and the chord under it`,\n detail: \"Move it a semitone, or ignore the line if the borrowed note is intended\",\n });\n }\n }\n };\n\nexport const outOfKey: Rule = defineRule({\n meta: { description: \"Notes stay in the key the notes around them imply\" },\n check: (context) => {\n const keys = keysOf(context.song);\n const pitched = pipe(context.soundings, Arr.filter(isPitched));\n const fits = fitsOf(keys, inChordOf(context.soundings));\n const check = checkNote({ report: reporterOf(context), keys, fits, tracks: tracksOf(pitched) });\n for (const sounding of pitched) {\n check(sounding);\n }\n },\n});\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Predicate, Record as Rec, pipe } from \"effect\";\n\nimport { midiOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport { reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule, RuleOptions } from \"#/shared/config/index.ts\";\n\nexport type Range = readonly [string, string];\n\nexport type Ranges = Readonly<Record<string, Range>>;\n\nexport const DEFAULT_RANGES: Ranges = {\n melody: [\"C3\", \"C6\"],\n countermelody: [\"C3\", \"C6\"],\n bass: [\"E1\", \"C4\"],\n};\n\ninterface Bounds {\n readonly low: number;\n readonly high: number;\n readonly name: string;\n}\n\nconst RANGE_LENGTH = 2;\n\nconst isRange = (value: unknown): value is Range =>\n Arr.isArray(value) && value.length === RANGE_LENGTH && pipe(value, Arr.every(Predicate.isString));\n\nconst boundsOf = ([low, high]: Range): Option.Option<Bounds> =>\n Option.all({ low: midiOf(low), high: midiOf(high), name: Option.some(`${low}-${high}`) });\n\nconst configured = (options: RuleOptions): Readonly<Record<string, unknown>> =>\n pipe(\n Option.fromNullishOr(options[\"ranges\"]),\n Option.filter(Predicate.isObject),\n Option.map((value): Readonly<Record<string, unknown>> => ({ ...DEFAULT_RANGES, ...value })),\n Option.getOrElse((): Readonly<Record<string, unknown>> => DEFAULT_RANGES),\n );\n\nconst rangesOf = (options: RuleOptions): Readonly<Record<string, Bounds>> =>\n pipe(\n configured(options),\n Rec.toEntries,\n Arr.flatMap(([name, value]) =>\n pipe(\n Option.liftPredicate(value, isRange),\n Option.flatMap(boundsOf),\n Option.map((bounds): readonly [string, Bounds] => [name, bounds]),\n Option.toArray,\n ),\n ),\n Rec.fromEntries,\n );\n\nconst boundsFor =\n (ranges: Readonly<Record<string, Bounds>>) =>\n (sounding: Sounding): Option.Option<Bounds> =>\n pipe(\n ranges,\n Rec.get(sounding.track),\n Option.orElse(() =>\n pipe(\n sounding.role,\n Option.flatMap((role) => pipe(ranges, Rec.get(role))),\n ),\n ),\n );\n\nconst checkNote =\n (report: Reporter) =>\n (sounding: Sounding, bounds: Bounds): void => {\n if (sounding.midi < bounds.low || sounding.midi > bounds.high) {\n report(`${String(sounding.line)}:${String(sounding.column)}`, {\n line: sounding.line,\n column: sounding.column,\n message: `${sounding.spelling} in ${sounding.track} is outside ${bounds.name}`,\n detail: \"Move the phrase an octave, or set the range of this track\",\n });\n }\n };\n\nexport const partRange: Rule = defineRule({\n meta: { description: \"Each part stays inside the range its singer or instrument can play\" },\n check: (context) => {\n const check = checkNote(reporterOf(context));\n const lookup = boundsFor(rangesOf(context.options));\n for (const sounding of context.soundings) {\n for (const bounds of Option.toArray(lookup(sounding))) {\n check(sounding, bounds);\n }\n }\n },\n});\n","import { Option, pipe } from \"effect\";\n\nimport { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin, RuleEntry } from \"#/shared/config/index.ts\";\n\nimport { breath } from \"./breath.ts\";\nimport { melodyLeap } from \"./melody-leap.ts\";\nimport { outOfKey } from \"./out-of-key.ts\";\nimport { partRange } from \"./part-range.ts\";\nimport type { Ranges } from \"./part-range.ts\";\n\nexport interface PopOptions {\n readonly ranges?: Ranges;\n readonly maxLeap?: number;\n readonly breathSeconds?: number;\n}\n\nexport const popPlugin: Plugin = definePlugin({\n rules: {\n \"out-of-key\": outOfKey,\n \"part-range\": partRange,\n \"melody-leap\": melodyLeap,\n breath,\n },\n});\n\nconst warnWith =\n (key: string) =>\n (value: unknown): RuleEntry =>\n pipe(\n Option.fromNullishOr(value),\n Option.match({\n onNone: (): RuleEntry => \"warn\",\n onSome: (given): RuleEntry => [\"warn\", { [key]: given }],\n }),\n );\n\nexport const pop = (options: PopOptions = {}): I68Config => ({\n plugins: { pop: popPlugin },\n rules: {\n \"pop/out-of-key\": \"warn\",\n \"pop/part-range\": warnWith(\"ranges\")(options.ranges),\n \"pop/melody-leap\": warnWith(\"max\")(options.maxLeap),\n \"pop/breath\": warnWith(\"seconds\")(options.breathSeconds),\n },\n});\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport { MELODIC, hasRole, highest, lowest, soundingAt } from \"#/app/presets/shared/lib/voices.ts\";\n\nexport interface OuterPair {\n readonly tick: number;\n readonly melody: Sounding;\n readonly bass: Sounding;\n}\n\nconst pickAt =\n (\n soundings: readonly Sounding[],\n pick: (found: Arr.NonEmptyReadonlyArray<Sounding>) => Sounding,\n ) =>\n (tick: number): Option.Option<Sounding> =>\n pipe(\n soundingAt(soundings)(tick),\n Arr.match({ onEmpty: () => Option.none(), onNonEmpty: (found) => Option.some(pick(found)) }),\n );\n\nexport const outerVoicesOf = (soundings: readonly Sounding[]): readonly OuterPair[] => {\n const melodic = pipe(soundings, Arr.filter(hasRole(MELODIC)));\n const low = pipe(soundings, Arr.filter(hasRole([\"bass\"])));\n const topAt = pickAt(melodic, highest);\n const bottomAt = pickAt(low, lowest);\n const ticks = pipe(\n [...melodic, ...low],\n Arr.map((sounding) => sounding.start),\n Arr.dedupe,\n (all) => Arr.sort(all, Order.Number),\n );\n const pairAt = (tick: number): Option.Option<OuterPair> =>\n pipe(\n Option.all({ melody: topAt(tick), bass: bottomAt(tick) }),\n Option.map(({ melody, bass }) => ({ tick, melody, bass })),\n );\n return pipe(ticks, Arr.map(pairAt), Arr.getSomes);\n};\n","import { Match, Option } from \"effect\";\n\nimport { pitchClassOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport { neighborsOf, reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nimport { outerVoicesOf } from \"./outer-voices.ts\";\nimport type { OuterPair } from \"./outer-voices.ts\";\n\nconst UNISON = 0;\nconst FIFTH = 7;\nconst STILL = 0;\n\nconst perfectName = (interval: number): Option.Option<string> =>\n Match.value(interval).pipe(\n Match.when(UNISON, () => Option.some(\"octaves\")),\n Match.when(FIFTH, () => Option.some(\"fifths\")),\n Match.orElse(() => Option.none()),\n );\n\nconst intervalOf = (pair: OuterPair): number => pitchClassOf(pair.melody.midi - pair.bass.midi);\n\nconst movesTogether = (previous: OuterPair, next: OuterPair): boolean => {\n const melody = Math.sign(next.melody.midi - previous.melody.midi);\n return melody !== STILL && melody === Math.sign(next.bass.midi - previous.bass.midi);\n};\n\nconst checkMove =\n (report: Reporter) =>\n ([previous, next]: readonly [OuterPair, OuterPair]): void => {\n const name = perfectName(intervalOf(next));\n if (\n Option.isSome(name) &&\n intervalOf(previous) === intervalOf(next) &&\n movesTogether(previous, next)\n ) {\n report(`${String(next.melody.line)}:${String(next.tick)}`, {\n line: next.melody.line,\n column: next.melody.column,\n message: `Parallel ${name.value}: ${previous.melody.spelling}/${previous.bass.spelling} to ${next.melody.spelling}/${next.bass.spelling} between ${next.melody.track} and ${next.bass.track}`,\n detail: \"Move the melody or the bass the other way\",\n });\n }\n };\n\nexport const parallelPerfects: Rule = defineRule({\n meta: { description: \"Melody and bass do not move in parallel fifths or octaves\" },\n check: (context) => {\n const check = checkMove(reporterOf(context));\n for (const move of neighborsOf(outerVoicesOf(context.soundings))) {\n check(move);\n }\n },\n});\n","import type { Song } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport { pitchClassOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport {\n MELODIC,\n hasRole,\n neighborsOf,\n reporterOf,\n topLineOf,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nimport { outerVoicesOf } from \"./outer-voices.ts\";\n\nconst DISSONANT_STEPS = {\n minorSecond: 1,\n majorSecond: 2,\n fourth: 5,\n tritone: 6,\n minorSeventh: 10,\n majorSeventh: 11,\n};\nconst DISSONANT = Rec.values(DISSONANT_STEPS);\nconst STEP_DOWN = Rec.values({ halfStep: -1, wholeStep: -2 });\nconst HALVES = 2;\nconst ON_BEAT = 0;\n\nconst strongLength = (length: number, numerator: number): number => {\n if (numerator % HALVES === ON_BEAT) {\n return length / HALVES;\n }\n return length;\n};\n\nconst isStrongBeat =\n (song: Song) =>\n (sounding: Sounding): boolean =>\n pipe(\n song.bars,\n Arr.findFirst((bar) => bar.index === sounding.bar),\n Option.exists(\n (bar) =>\n (sounding.start - bar.start) % strongLength(bar.length, bar.meter.numerator) === ON_BEAT,\n ),\n );\n\ntype BassAt = (tick: number) => Option.Option<Sounding>;\n\nconst bassOf = (soundings: readonly Sounding[]): BassAt => {\n const pairs = outerVoicesOf(soundings);\n return (tick) =>\n pipe(\n pairs,\n Arr.findFirst((pair) => pair.tick === tick),\n Option.map((pair) => pair.bass),\n );\n};\n\nconst checkNote =\n (report: Reporter, strong: (sounding: Sounding) => boolean, bassAt: BassAt) =>\n ([note, next]: readonly [Sounding, Option.Option<Sounding>]): void => {\n const dissonant = Option.exists(bassAt(note.start), (bass) =>\n Arr.contains(DISSONANT, pitchClassOf(note.midi - bass.midi)),\n );\n const resolved = Option.exists(next, (found) =>\n Arr.contains(STEP_DOWN, found.midi - note.midi),\n );\n if (strong(note) && dissonant && !resolved) {\n report(`${String(note.line)}:${String(note.start)}`, {\n line: note.line,\n column: note.column,\n message: `${note.spelling} in ${note.track} is dissonant against the bass and does not step down`,\n detail: \"Move the next note down a step\",\n });\n }\n };\n\nconst withNext = (\n line: readonly Sounding[],\n): readonly (readonly [Sounding, Option.Option<Sounding>])[] => [\n ...pipe(\n neighborsOf(line),\n Arr.map(([note, next]): readonly [Sounding, Option.Option<Sounding>] => [\n note,\n Option.some(next),\n ]),\n ),\n ...pipe(\n Arr.last(line),\n Option.map((note): readonly [Sounding, Option.Option<Sounding>] => [note, Option.none()]),\n Option.toArray,\n ),\n];\n\nexport const unresolvedDissonance: Rule = defineRule({\n meta: { description: \"A dissonant melody note on a strong beat steps down to resolve\" },\n check: (context) => {\n const check = checkNote(\n reporterOf(context),\n isStrongBeat(context.song),\n bassOf(context.soundings),\n );\n const melodic = pipe(context.soundings, Arr.filter(hasRole(MELODIC)));\n for (const track of tracksOf(melodic)) {\n for (const entry of withNext(topLineOf(track))) {\n check(entry);\n }\n }\n },\n});\n","import { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin } from \"#/shared/config/index.ts\";\n\nimport { parallelPerfects } from \"./parallel-perfects.ts\";\nimport { unresolvedDissonance } from \"./unresolved-dissonance.ts\";\n\nexport const classicalPlugin: Plugin = definePlugin({\n rules: {\n \"parallel-perfects\": parallelPerfects,\n \"unresolved-dissonance\": unresolvedDissonance,\n },\n});\n\nexport const classical = (): I68Config => ({\n plugins: { classical: classicalPlugin },\n rules: {\n \"classical/parallel-perfects\": \"warn\",\n \"classical/unresolved-dissonance\": \"warn\",\n },\n});\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { progressionOf } from \"#/app/presets/shared/lib/degrees.ts\";\nimport type { Step } from \"#/app/presets/shared/lib/degrees.ts\";\nimport { reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nexport interface Progression {\n readonly name: string;\n readonly degrees: readonly string[];\n}\n\nexport const PROGRESSIONS: readonly Progression[] = [\n { name: \"丸サ進行 (Just the Two of Us)\", degrees: [\"IVM7\", \"III7\", \"VIm7\"] },\n { name: \"王道進行\", degrees: [\"IV\", \"V\", \"IIIm\", \"VIm\"] },\n { name: \"小室進行\", degrees: [\"VIm\", \"IV\", \"V\", \"I\"] },\n { name: \"カノン進行\", degrees: [\"I\", \"V\", \"VIm\", \"IIIm\", \"IV\", \"I\", \"IV\", \"V\"] },\n { name: \"ii–V–I\", degrees: [\"IIm\", \"V\", \"I\"] },\n { name: \"Andalusian cadence\", degrees: [\"VIm\", \"V\", \"IV\", \"III\"] },\n];\n\nconst START = 0;\n\nconst FAMILIES = [\n [\"M7\", \"\"],\n [\"m7b5\", \"dim\"],\n [\"m7\", \"m\"],\n [\"dim7\", \"dim\"],\n [\"7\", \"\"],\n] as const;\n\nconst familyOf = (token: string): string =>\n pipe(\n FAMILIES,\n Arr.findFirst(([suffix]) => Str.endsWith(suffix)(token)),\n Option.match({\n onNone: () => token,\n onSome: ([suffix, triad]) =>\n `${Str.slice(START, token.length - suffix.length)(token)}${triad}`,\n }),\n );\n\nconst matches =\n (steps: readonly Step[], degrees: readonly string[]) =>\n (start: number): boolean =>\n pipe(\n degrees,\n Arr.every((degree, offset) =>\n pipe(\n Arr.get(steps, start + offset),\n Option.exists((step) => familyOf(step.token) === familyOf(degree)),\n ),\n ),\n );\n\nexport const namedProgression: Rule = defineRule({\n meta: { description: \"Names the well-known chord progressions a song uses\" },\n check: (context) => {\n const steps = progressionOf(context.soundings)(context.song);\n const report = reporterOf(context);\n for (const progression of PROGRESSIONS) {\n const starts = pipe(\n Arr.makeBy(steps.length, (index) => index),\n Arr.filter(matches(steps, progression.degrees)),\n );\n for (const step of pipe(\n starts,\n Arr.flatMap((start) => Option.toArray(Arr.get(steps, start))),\n )) {\n report(`${progression.name}:${String(step.line)}:${String(step.bar)}`, {\n line: step.line,\n column: step.column,\n message: `${progression.name} (${Arr.join(progression.degrees, \"–\")}) starts in bar ${String(step.bar)}`,\n });\n }\n }\n },\n});\n","import { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin } from \"#/shared/config/index.ts\";\n\nimport { namedProgression } from \"./named.ts\";\n\nexport const progressionsPlugin: Plugin = definePlugin({\n rules: { named: namedProgression },\n});\n\nexport const progressions = (): I68Config => ({\n plugins: { progressions: progressionsPlugin },\n rules: { \"progressions/named\": \"warn\" },\n});\n","import { Array as Arr, Number as Num, Option, Record as Rec, pipe } from \"effect\";\n\nimport { progressionOf } from \"#/app/presets/shared/lib/degrees.ts\";\nimport type { Step } from \"#/app/presets/shared/lib/degrees.ts\";\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport { longestContext } from \"#/app/presets/shared/lib/style-table.ts\";\nimport type { Context, StyleTable } from \"#/app/presets/shared/lib/style-table.ts\";\nimport { reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst DEFAULT_SHARE = 0.03;\nconst DEFAULT_SEEN = 8;\nconst PERCENT = 100;\nconst SUGGESTIONS = 3;\nconst FIRST = 1;\nconst NEVER = 0;\nconst minShare = numberOption({ key: \"share\", fallback: DEFAULT_SHARE });\nconst minSeen = numberOption({ key: \"seen\", fallback: DEFAULT_SEEN });\n\nconst percentOf = (count: number, total: number): string =>\n `${String(Math.round((count / total) * PERCENT))}%`;\n\nconst suggestionsOf = (context: Context): string =>\n pipe(\n Rec.toEntries(context.next),\n Arr.sortWith(([, count]) => -count, Num.Order),\n Arr.take(SUGGESTIONS),\n Arr.map(([token, count]) => `${token} (${percentOf(count, context.total)})`),\n Arr.join(\", \"),\n );\n\ninterface Limits {\n readonly share: number;\n readonly seen: number;\n}\n\nconst checkStep =\n (report: Reporter, table: StyleTable, { share, seen }: Limits) =>\n (steps: readonly Step[], index: number): void => {\n const before = Arr.take(steps, index);\n for (const step of Option.toArray(Arr.get(steps, index))) {\n for (const context of Option.toArray(longestContext({ table, seen })(before))) {\n const count = Option.getOrElse(Rec.get(context.next, step.token), () => NEVER);\n if (count / context.total < share) {\n report(`${String(step.line)}:${step.token}:${String(index)}`, {\n line: step.line,\n column: step.column,\n message: `${context.words} → ${step.token} is rare in ${table.name} (${percentOf(count, context.total)})`,\n detail: `${table.name} usually goes to ${suggestionsOf(context)}`,\n });\n }\n }\n }\n };\n\nexport const rareTransitionOf = (table: StyleTable): Rule =>\n defineRule({\n meta: { description: `Chord changes follow what ${table.name} usually does next` },\n check: (context) => {\n const steps = progressionOf(context.soundings)(context.song);\n const check = checkStep(reporterOf(context), table, {\n share: minShare(context.options),\n seen: minSeen(context.options),\n });\n const indices = Arr.makeBy(steps.length, (at) => at);\n for (const index of Arr.drop(indices, FIRST)) {\n check(steps, index);\n }\n },\n });\n","import BACH_CHORALES from \"#/app/presets/features/check-style/data/bach-chorales.json\" with { type: \"json\" };\nimport type { StyleTable } from \"#/app/presets/shared/lib/style-table.ts\";\nimport { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin } from \"#/shared/config/index.ts\";\n\nimport { rareTransitionOf } from \"./rare-transition.ts\";\n\nexport const bachPlugin: Plugin = definePlugin({\n rules: { \"rare-transition\": rareTransitionOf(BACH_CHORALES) },\n});\n\nexport const bach = (): I68Config => ({\n plugins: { bach: bachPlugin },\n rules: { \"bach/rare-transition\": \"warn\" },\n});\n\nexport const stylePluginOf = (table: StyleTable): Plugin =>\n definePlugin({ rules: { \"rare-transition\": rareTransitionOf(table) } });\n","import type { RuleContext } from \"@r_masseater/i68\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { progressionOf } from \"#/app/presets/shared/lib/degrees.ts\";\nimport type { Step } from \"#/app/presets/shared/lib/degrees.ts\";\nimport { mixFactsOf, placeIn, trackKeyOf } from \"#/app/presets/shared/lib/mix-facts.ts\";\nimport type { MixFact, MixPlace } from \"#/app/presets/shared/lib/mix-facts.ts\";\nimport { mixKeyOf } from \"#/app/presets/shared/lib/mix-habit.ts\";\nimport type { MixHabit } from \"#/app/presets/shared/lib/mix-habit.ts\";\nimport type { Subject } from \"#/app/presets/shared/lib/style-rules.ts\";\n\nconst FIRST = 1;\n\nexport interface Occasion {\n readonly id: string;\n readonly line: number;\n readonly column: number;\n readonly holds: boolean;\n}\n\ntype Chord = Extract<Subject, { readonly type: \"chord\" }>;\n\nconst follows = (before: readonly Step[], context: string): boolean => {\n const words = Str.split(\" \")(context);\n return (\n before.length >= words.length &&\n pipe(\n Arr.takeRight(before, words.length),\n Arr.map((step) => step.token),\n Arr.join(\" \"),\n ) === context\n );\n};\n\nconst chordOccasions =\n (context: RuleContext) =>\n (chord: Chord): readonly Occasion[] => {\n const steps = progressionOf(context.soundings)(context.song);\n return pipe(\n Arr.makeBy(steps.length, (index) => index),\n Arr.drop(FIRST),\n Arr.filter((index) => follows(Arr.take(steps, index), chord.context)),\n Arr.map((index) => {\n const step = Arr.getUnsafe(steps, index);\n return {\n id: String(index),\n line: step.line,\n column: step.column,\n holds: step.token === chord.next,\n };\n }),\n );\n };\n\nconst sectionStartsOf = (context: RuleContext): readonly number[] =>\n pipe(\n context.song.bars,\n Arr.drop(FIRST),\n Arr.filter((bar) => Option.isSome(bar.section) || Option.isSome(bar.mark)),\n Arr.map((bar) => bar.index),\n );\n\nconst occasionAt = (place: MixPlace, holds: boolean): Occasion => ({\n id: String(place.bar),\n line: place.line,\n column: place.column,\n holds,\n});\n\nconst has =\n (facts: readonly MixFact[], habit: MixHabit) =>\n (bar: Option.Option<number>): boolean =>\n pipe(\n facts,\n Arr.some(\n (fact) =>\n mixKeyOf(fact.habit) === mixKeyOf(habit) &&\n Option.match(bar, { onNone: () => true, onSome: (at) => fact.place.bar === at }),\n ),\n );\n\nconst mixOccasions =\n (context: RuleContext) =>\n (habit: MixHabit): readonly Occasion[] => {\n const facts = mixFactsOf(context.soundings)(context.song);\n const place = placeIn(context.soundings);\n const tracks = pipe(\n context.song.tracks,\n Arr.filter((track) => trackKeyOf(track.name) === habit.track),\n );\n if (habit.type !== \"move\") {\n return pipe(\n tracks,\n Arr.map((track) =>\n occasionAt(place({ track: track.name, bar: FIRST }), has(facts, habit)(Option.none())),\n ),\n );\n }\n return pipe(\n tracks,\n Arr.flatMap((track) =>\n pipe(\n sectionStartsOf(context),\n Arr.map((bar) =>\n occasionAt(place({ track: track.name, bar }), has(facts, habit)(Option.some(bar))),\n ),\n ),\n ),\n );\n };\n\nexport const occasionsOf =\n (context: RuleContext) =>\n (subject: Subject): readonly Occasion[] => {\n if (subject.type === \"chord\") {\n return chordOccasions(context)(subject);\n }\n return mixOccasions(context)(subject);\n };\n","import { defineRule } from \"@r_masseater/i68\";\nimport type { Rule } from \"@r_masseater/i68\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { subjectKeyOf } from \"#/app/presets/shared/lib/style-rules.ts\";\nimport type { HabitKind, HabitRule, StyleRules } from \"#/app/presets/shared/lib/style-rules.ts\";\nimport { reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\n\nimport { occasionsOf } from \"./occasions.ts\";\n\ntype Wording = Readonly<{\n description: (name: string) => string;\n reportsWhen: boolean;\n message: (name: string, key: string) => string;\n}>;\n\nconst WORDINGS: Readonly<Record<HabitKind, Wording>> = {\n keep: {\n description: (name) => `Songs keep the habits of ${name}`,\n reportsWhen: false,\n message: (name, key) => `${name} keeps ${key} here`,\n },\n fix: {\n description: (name) => `Songs avoid the habits ${name} is fixing`,\n reportsWhen: true,\n message: (name, key) => `${key} is a habit ${name} is fixing`,\n },\n suggest: {\n description: (name) => `Habits that would fit ${name}`,\n reportsWhen: false,\n message: (name, key) => `${key} would fit ${name} here`,\n },\n};\n\nconst detailOf = (habit: HabitRule): string =>\n pipe(\n Option.fromNullishOr(habit.reason),\n Option.match({\n onNone: () => habit.aim,\n onSome: (reason) => `${habit.aim}: ${reason}`,\n }),\n );\n\nexport type HabitRuleInput = Readonly<{ rules: StyleRules; kind: HabitKind }>;\n\nexport const habitRuleOf = ({ rules, kind }: HabitRuleInput): Rule => {\n const wording = WORDINGS[kind];\n const habits = pipe(\n rules.habits,\n Arr.filter((habit) => habit.kind === kind),\n );\n return defineRule({\n meta: { description: wording.description(rules.name) },\n check: (context) => {\n const report = reporterOf(context);\n for (const habit of habits) {\n const key = subjectKeyOf(habit.habit);\n for (const occasion of occasionsOf(context)(habit.habit)) {\n if (occasion.holds === wording.reportsWhen) {\n report(`${key}:${occasion.id}`, {\n line: occasion.line,\n column: occasion.column,\n message: wording.message(rules.name, key),\n detail: detailOf(habit),\n });\n }\n }\n }\n },\n });\n};\n","import { definePlugin } from \"@r_masseater/i68\";\nimport type { I68Config, Plugin } from \"@r_masseater/i68\";\n\nimport type { StyleRules } from \"#/app/presets/shared/lib/style-rules.ts\";\n\nimport { habitRuleOf } from \"./habit-rule.ts\";\n\nexport const styleRulesPluginOf = (rules: StyleRules): Plugin =>\n definePlugin({\n rules: {\n keep: habitRuleOf({ rules, kind: \"keep\" }),\n fix: habitRuleOf({ rules, kind: \"fix\" }),\n suggest: habitRuleOf({ rules, kind: \"suggest\" }),\n },\n });\n\nexport type StyleRulesPreset = Readonly<{ plugin: string; rules: StyleRules }>;\n\nexport const styleRules = ({ plugin, rules }: StyleRulesPreset): I68Config => ({\n plugins: { [plugin]: styleRulesPluginOf(rules) },\n rules: {\n [`${plugin}/keep`]: \"warn\",\n [`${plugin}/fix`]: \"error\",\n [`${plugin}/suggest`]: \"warn\",\n },\n});\n","import { harmony } from \"#/app/presets/features/check-harmony/index.ts\";\nimport { pop } from \"#/app/presets/features/check-pop/index.ts\";\nimport type { PopOptions } from \"#/app/presets/features/check-pop/index.ts\";\nimport type { I68Config } from \"#/shared/config/index.ts\";\n\nexport { classical, classicalPlugin } from \"#/app/presets/features/check-classical/index.ts\";\nexport { DEFAULT_RANGES, pop, popPlugin } from \"#/app/presets/features/check-pop/index.ts\";\nexport type { PopOptions, Range, Ranges } from \"#/app/presets/features/check-pop/index.ts\";\nexport {\n PROGRESSIONS,\n progressions,\n progressionsPlugin,\n} from \"#/app/presets/features/check-progressions/index.ts\";\nexport type { Progression } from \"#/app/presets/features/check-progressions/index.ts\";\nexport { bach, bachPlugin, stylePluginOf } from \"#/app/presets/features/check-style/index.ts\";\nexport { styleRules, styleRulesPluginOf } from \"#/app/presets/features/check-habits/index.ts\";\nexport type { StyleRulesPreset } from \"#/app/presets/features/check-habits/index.ts\";\nexport {\n HABIT_KINDS,\n StyleRulesSchema,\n subjectKeyOf,\n} from \"#/app/presets/shared/lib/style-rules.ts\";\nexport type {\n HabitKind,\n HabitRule,\n StyleRules,\n Subject,\n} from \"#/app/presets/shared/lib/style-rules.ts\";\nexport { mixKeyOf } from \"#/app/presets/shared/lib/mix-habit.ts\";\nexport type { MixHabit } from \"#/app/presets/shared/lib/mix-habit.ts\";\nexport type { StyleTable, Transitions } from \"#/app/presets/shared/lib/style-table.ts\";\nexport { harmony, harmonyPlugin } from \"#/app/presets/features/check-harmony/index.ts\";\n\nexport const recommended = (options: PopOptions = {}): I68Config => ({\n extends: [pop(options), harmony()],\n});\n"],"mappings":";;;;;;AASA,MAAa,gBACV,EAAE,KAAK,gBACP,YACC,KACE,OAAO,cAAc,QAAQ,IAAI,GACjC,OAAO,OAAO,UAAU,QAAQ,GAChC,OAAO,gBAAgB,QAAQ,CACjC;;ACPJ,MAAMA,WAAS;AACf,MAAM,SAAS,aAAa;CAAE,KAAK;CAAU,UAAUA;AAAO,CAAC;AAC/D,MAAM,WAAW,QAAQ,CAAC,QAAQ,CAAC;AACnC,MAAM,YAAY,QAAQ,CAAC,SAAS,CAAC;AAErC,MAAM,eAAe,UAAkB,SAAwC;CAC7E,IAAI,WAAWA,UACb,OAAO,OAAO,KAAK,OAAO;CAE5B,IAAI,WAAWA,YAAU,YAAY,MACnC,OAAO,OAAO,KAAK,YAAY;CAEjC,OAAO,OAAO,KAAK;AACrB;AAEA,MAAMC,eACH,QAAkB,UAClB,SAAqB;CACpB,MAAM,QAAQ,OAAO,IAAI;EACvB,QAAQ,KAAK,MAAMC,MAAI,UAAU,QAAQ,CAAC;EAC1C,OAAO,KAAK,MAAMA,MAAI,UAAU,SAAS,CAAC;CAC5C,CAAC;CACD,KAAK,MAAM,EAAE,QAAQ,WAAW,OAAO,QAAQ,KAAK,GAClD,KAAK,MAAM,SAAS,OAAO,QAAQ,YAAY,OAAO,OAAO,MAAM,MAAM,IAAI,CAAC,GAC5E,OAAO,GAAG,OAAO,MAAM,IAAI,EAAE,GAAG,OAAO,MAAM,MAAM,EAAE,GAAG,OAAO,MAAM,GAAG,KAAK;EAC3E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EAAE;EAAO,MAAM;CAAM,CAAC;CACvC,SAAS,YAAY;EAAE;EAAO,MAAM;CAAU,CAAC;AACjD,EACF,CAAC;AAIH,MAAa,cAAc,EAAE,QAAQ,aAA0C;CAC7E,SAAS,GAAG,SAAS,mBAAmB,KAAK,EAAE;CAC/C,OAAO;GACJ,GAAG,OAAO,SAAS;GACnB,GAAG,OAAO,QAAQ;GAClB,GAAG,OAAO,YAAY;CACzB;AACF;;ACQA,MAAa,eAAe,UAAsB,CAAC,OAAkB,EACnE,SAAS,CAAC,IAAI,OAAO,GAAG,QAAQ,CAAC,EACnC"}
|
|
1
|
+
{"version":3,"file":"presets.mjs","names":["UNISON","checkPair","Arr","stepsOf","Arr","checkPair","Rec","Arr","MAJOR_THIRD","Arr","Arr","Arr","Arr","checkStep","Arr","Arr","Rec","Arr","checkNote","Arr","midiOf","Rec","checkNote","Arr","Rec","Arr","Arr","Str","FIRST","Rec","Arr","Num","BACH_CHORALES","Str","Arr","Arr"],"sources":["../src/app/presets/shared/lib/options.ts","../src/app/presets/features/check-harmony/model/chord-above-melody.ts","../src/app/presets/features/check-harmony/model/crowded-low-mids.ts","../src/app/presets/features/check-harmony/model/low-interval-limit.ts","../src/app/presets/features/check-harmony/model/semitone-clash.ts","../src/app/presets/features/check-harmony/model/voice-jump.ts","../src/app/presets/features/check-harmony/model/preset.ts","../src/app/presets/shared/lib/time.ts","../src/app/presets/features/check-pop/model/breath.ts","../src/app/presets/features/check-pop/model/melody-leap.ts","../src/app/presets/shared/lib/chords.ts","../src/app/presets/features/check-pop/model/out-of-key.ts","../src/app/presets/features/check-pop/model/part-range.ts","../src/app/presets/features/check-pop/model/preset.ts","../src/app/presets/features/check-classical/model/outer-voices.ts","../src/app/presets/features/check-classical/model/parallel-perfects.ts","../src/app/presets/features/check-classical/model/unresolved-dissonance.ts","../src/app/presets/features/check-classical/model/preset.ts","../src/app/presets/features/check-progressions/model/named.ts","../src/app/presets/features/check-progressions/model/preset.ts","../src/app/presets/features/check-style/model/rare-transition.ts","../src/app/presets/features/check-style/model/preset.ts","../src/app/presets/features/check-habits/model/occasions.ts","../src/app/presets/features/check-habits/model/habit-rule.ts","../src/app/presets/features/check-habits/model/preset.ts","../src/app/presets.ts"],"sourcesContent":["import { Option, Predicate, pipe } from \"effect\";\n\nimport type { RuleOptions } from \"#/shared/config/index.ts\";\n\nexport interface NumberOption {\n readonly key: string;\n readonly fallback: number;\n}\n\nexport const numberOption =\n ({ key, fallback }: NumberOption) =>\n (options: RuleOptions): number =>\n pipe(\n Option.fromNullishOr(options[key]),\n Option.filter(Predicate.isNumber),\n Option.getOrElse(() => fallback),\n );\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport { hasRole, overlappingPairs, reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Pair, Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst UNISON = 0;\nconst within = numberOption({ key: \"within\", fallback: UNISON });\nconst isMelody = hasRole([\"melody\"]);\nconst isHarmony = hasRole([\"harmony\"]);\n\nconst placementOf = (distance: number, room: number): Option.Option<string> => {\n if (distance < UNISON) {\n return Option.some(\"above\");\n }\n if (distance > UNISON && distance <= room) {\n return Option.some(\"just below\");\n }\n return Option.none();\n};\n\nconst checkPair =\n (report: Reporter, room: number) =>\n (pair: Pair): void => {\n const parts = Option.all({\n melody: pipe(pair, Arr.findFirst(isMelody)),\n chord: pipe(pair, Arr.findFirst(isHarmony)),\n });\n for (const { melody, chord } of Option.toArray(parts)) {\n for (const where of Option.toArray(placementOf(melody.midi - chord.midi, room))) {\n report(`${String(chord.line)}:${String(chord.column)}:${String(chord.bar)}`, {\n line: chord.line,\n column: chord.column,\n message: `${chord.spelling} in ${chord.track} sits ${where} the melody note ${melody.spelling}`,\n detail: \"Keep the chord below the melody with some room between them\",\n });\n }\n }\n };\n\nconst isPart = (sounding: Sounding): boolean => isMelody(sounding) || isHarmony(sounding);\n\nexport const chordAboveMelody: Rule = defineRule({\n meta: { description: \"Chord parts stay below the lead melody\" },\n check: (context) => {\n const check = checkPair(reporterOf(context), within(context.options));\n for (const pair of overlappingPairs(pipe(context.soundings, Arr.filter(isPart)))) {\n check(pair);\n }\n },\n});\n","import type { Bar } from \"@r_masseater/song-format\";\nimport { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport { hasRole, isPitched, reporterOf, soundingAt } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst SIXTEENTHS_PER_WHOLE = 16;\nconst SIXTEENTH = TICKS_PER_WHOLE / SIXTEENTHS_PER_WHOLE;\nconst LOW_MID_FLOOR = 45;\nconst BASS_FLOOR = 40;\nconst LOW_MID_CEILING = 59;\nconst DEFAULT_MAX = 3;\nconst maxNotes = numberOption({ key: \"max\", fallback: DEFAULT_MAX });\n\nconst floorOf = (sounding: Sounding): number => {\n if (hasRole([\"bass\"])(sounding)) {\n return BASS_FLOOR;\n }\n return LOW_MID_FLOOR;\n};\n\nconst inLowMids = (sounding: Sounding): boolean =>\n isPitched(sounding) && sounding.midi <= LOW_MID_CEILING && sounding.midi >= floorOf(sounding);\n\nconst stepsOf = (bar: Bar): readonly number[] =>\n Arr.makeBy(Math.ceil(bar.length / SIXTEENTH), (index) => bar.start + index * SIXTEENTH);\n\nconst crowdAt =\n (low: readonly Sounding[]) =>\n (tick: number): readonly Sounding[] =>\n pipe(\n soundingAt(low)(tick),\n Arr.dedupeWith((left, right) => left.track === right.track && left.midi === right.midi),\n );\n\nconst spellingsOf = (notes: readonly Sounding[]): string =>\n pipe(\n notes,\n Arr.map((note) => note.spelling),\n Arr.join(\", \"),\n );\n\nconst checkBar =\n (report: Reporter, low: readonly Sounding[], max: number) =>\n (bar: Bar): void => {\n const crowded = pipe(\n stepsOf(bar),\n Arr.map(crowdAt(low)),\n Arr.findFirst((notes) => notes.length > max),\n );\n for (const notes of Option.toArray(crowded)) {\n for (const first of Option.toArray(Arr.head(notes))) {\n report(String(bar.index), {\n line: first.line,\n column: first.column,\n message: `${String(notes.length)} notes crowd the low mids in bar ${String(bar.index)}: ${spellingsOf(notes)}`,\n detail: \"Thin the chord or move notes out of A2-B3\",\n });\n }\n }\n };\n\nexport const crowdedLowMids: Rule = defineRule({\n meta: { description: \"Few notes pile up between A2 and B3 at once\" },\n check: (context) => {\n const low = pipe(context.soundings, Arr.filter(inLowMids));\n const check = checkBar(reporterOf(context), low, maxNotes(context.options));\n for (const bar of context.song.bars) {\n check(bar);\n }\n },\n});\n","import { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport { nameOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport { isPitched, overlappingPairs, reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Pair, Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst LIMITS: Readonly<Record<string, number>> = {\n \"1\": 52,\n \"2\": 51,\n \"3\": 48,\n \"4\": 46,\n \"5\": 46,\n \"6\": 46,\n \"7\": 34,\n \"8\": 43,\n \"9\": 41,\n \"10\": 41,\n \"11\": 41,\n \"13\": 40,\n \"14\": 39,\n};\n\nconst checkPair =\n (report: Reporter) =>\n (pair: Pair): void => {\n const [first, second] = pair;\n const low = Math.min(first.midi, second.midi);\n const gap = Math.abs(first.midi - second.midi);\n const limits = pipe(LIMITS, Rec.get(String(gap)), Option.toArray);\n for (const limit of limits) {\n if (low < limit) {\n report(`${String(second.line)}:${String(low)}:${String(gap)}`, {\n line: second.line,\n column: second.column,\n message: `${String(gap)} semitones between ${first.spelling} (${first.track}) and ${second.spelling} (${second.track}) is below its limit ${nameOf(limit)}`,\n detail: \"Widen the interval or move the upper note up an octave\",\n });\n }\n }\n };\n\nexport const lowIntervalLimit: Rule = defineRule({\n meta: { description: \"Close intervals stay above the pitch where they turn muddy\" },\n check: (context) => {\n const check = checkPair(reporterOf(context));\n for (const pair of overlappingPairs(pipe(context.soundings, Arr.filter(isPitched)))) {\n check(pair);\n }\n },\n});\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Match, Option, pipe } from \"effect\";\n\nimport { pitchClassOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport {\n hasRole,\n isPitched,\n overlappingPairs,\n reporterOf,\n soundingAt,\n sortByPitch,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Pair, Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst MINOR_SECOND = 1;\nconst MINOR_NINTH = 13;\nconst CLUSTER_FLOOR = 59;\n\nconst MAJOR_THIRD = 4;\nconst MINOR_SEVENTH = 10;\nconst isBass = hasRole([\"bass\"]);\n\ntype Excused = (bottom: Sounding, top: Sounding) => boolean;\n\nconst dominantOver =\n (soundings: readonly Sounding[]): Excused =>\n (bottom, top) => {\n if (!isBass(bottom) && !isBass(top)) {\n return false;\n }\n if (!isBass(bottom) || top.midi - bottom.midi !== MINOR_NINTH) {\n return true;\n }\n const classes = pipe(\n soundingAt(soundings)(top.start),\n Arr.map((other) => pitchClassOf(other.midi - bottom.midi)),\n );\n return Arr.contains(classes, MAJOR_THIRD) && Arr.contains(classes, MINOR_SEVENTH);\n };\n\nconst nameOfGap = (gap: number): Option.Option<string> =>\n Match.value(gap).pipe(\n Match.when(MINOR_SECOND, () => Option.some(\"minor 2nd\")),\n Match.when(MINOR_NINTH, () => Option.some(\"minor 9th\")),\n Match.orElse(() => Option.none()),\n );\n\nconst isCluster = (low: Sounding, high: Sounding): boolean =>\n low.track === high.track && high.midi - low.midi === MINOR_SECOND && low.midi >= CLUSTER_FLOOR;\n\nconst checkPair =\n (report: Reporter, excused: Excused) =>\n (pair: Pair): void => {\n const [low, high] = sortByPitch(pair);\n const [, later] = pair;\n for (const [bottom, top] of Option.toArray(\n Option.all([Option.fromNullishOr(low), Option.fromNullishOr(high)]),\n )) {\n for (const name of Option.toArray(nameOfGap(top.midi - bottom.midi))) {\n if (!isCluster(bottom, top) && !excused(bottom, top)) {\n report(`${String(later.line)}:${String(bottom.midi)}:${String(top.midi)}`, {\n line: later.line,\n column: later.column,\n message: `${top.spelling} (${top.track}) and ${bottom.spelling} (${bottom.track}) clash a ${name} apart`,\n detail: \"Move one of the two notes to a chord note\",\n });\n }\n }\n }\n };\n\nexport const semitoneClash: Rule = defineRule({\n meta: {\n description:\n \"Parts do not sound a minor 2nd or minor 9th apart, except the flat 9th of a dominant over its bass\",\n },\n check: (context) => {\n const pitched = pipe(context.soundings, Arr.filter(isPitched));\n const check = checkPair(reporterOf(context), dominantOver(pitched));\n for (const pair of overlappingPairs(pitched)) {\n check(pair);\n }\n },\n});\n","import { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, pipe } from \"effect\";\nimport { Note, VoiceLeading } from \"tonal\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport {\n hasRole,\n neighborsOf,\n onsetsOf,\n reporterOf,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Onset, Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst MAJOR_THIRD = 4;\nconst MIN_VOICES = 3;\nconst NEARBY_WHOLES = 1.5;\nconst NEARBY = NEARBY_WHOLES * TICKS_PER_WHOLE;\nconst maxMove = numberOption({ key: \"max\", fallback: MAJOR_THIRD });\n\ninterface Chord {\n readonly first: Sounding;\n readonly pitches: readonly number[];\n}\n\nconst chordOf = (onset: Onset): Chord => ({\n first: Arr.headNonEmpty(onset),\n pitches: pipe(\n onset,\n Arr.map((sounding) => sounding.midi),\n Arr.dedupe,\n ),\n});\n\nconst midiOf = (note: string): Option.Option<number> => Option.fromNullishOr(Note.midi(note));\n\nconst sizeOf = ([from, to]: readonly [string, string]): Option.Option<number> =>\n Option.map(Option.all([midiOf(from), midiOf(to)]), ([start, end]) => Math.abs(end - start));\n\nconst namesOf = (chord: Chord): string[] =>\n pipe(\n chord.pitches,\n Arr.map((midi) => Note.fromMidi(midi)),\n );\n\nconst movesOf = (previous: Chord, next: Chord): readonly number[] => {\n const { moves } = VoiceLeading.get(namesOf(previous), namesOf(next));\n return pipe(moves, Arr.map(sizeOf), Arr.getSomes);\n};\n\nconst checkChange =\n (report: Reporter, max: number) =>\n ([previous, next]: readonly [Chord, Chord]): void => {\n const leaps = pipe(\n movesOf(previous, next),\n Arr.filter((move) => move > max),\n );\n if (next.first.start - previous.first.start <= NEARBY && Arr.isReadonlyArrayNonEmpty(leaps)) {\n report(`${String(next.first.line)}:${String(next.first.start)}`, {\n line: next.first.line,\n column: next.first.column,\n message: `${String(leaps.length)} voices of ${next.first.track} leap more than ${String(max)} semitones into the next chord`,\n detail: \"Keep shared notes and move each voice to the closest note\",\n });\n }\n };\n\nconst chordsOf = (track: readonly Sounding[]): readonly Chord[] =>\n pipe(\n onsetsOf(track),\n Arr.map(chordOf),\n Arr.filter((chord) => chord.pitches.length >= MIN_VOICES),\n );\n\nexport const voiceJump: Rule = defineRule({\n meta: { description: \"Chord voices move to the nearest note of the next chord\" },\n check: (context) => {\n const check = checkChange(reporterOf(context), maxMove(context.options));\n const harmony = pipe(context.soundings, Arr.filter(hasRole([\"harmony\"])));\n for (const track of tracksOf(harmony)) {\n for (const change of neighborsOf(chordsOf(track))) {\n check(change);\n }\n }\n },\n});\n","import { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin } from \"#/shared/config/index.ts\";\n\nimport { chordAboveMelody } from \"./chord-above-melody.ts\";\nimport { crowdedLowMids } from \"./crowded-low-mids.ts\";\nimport { lowIntervalLimit } from \"./low-interval-limit.ts\";\nimport { semitoneClash } from \"./semitone-clash.ts\";\nimport { voiceJump } from \"./voice-jump.ts\";\n\nexport const harmonyPlugin: Plugin = definePlugin({\n rules: {\n \"semitone-clash\": semitoneClash,\n \"low-interval-limit\": lowIntervalLimit,\n \"crowded-low-mids\": crowdedLowMids,\n \"chord-above-melody\": chordAboveMelody,\n \"voice-jump\": voiceJump,\n },\n});\n\nexport const harmony = (): I68Config => ({\n plugins: { harmony: harmonyPlugin },\n rules: {\n \"harmony/semitone-clash\": \"warn\",\n \"harmony/low-interval-limit\": \"warn\",\n \"harmony/crowded-low-mids\": \"warn\",\n \"harmony/chord-above-melody\": \"warn\",\n \"harmony/voice-jump\": \"warn\",\n },\n});\n","import type { Bar, Song } from \"@r_masseater/song-format\";\nimport { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport { Array as Arr, pipe } from \"effect\";\n\nconst SECONDS_PER_MINUTE = 60;\nconst QUARTERS_PER_WHOLE = 4;\nconst NONE = 0;\n\ninterface Segment {\n readonly start: number;\n readonly end: number;\n readonly bpm: number;\n}\n\nconst segmentsIn = (bar: Bar): readonly Segment[] =>\n Arr.match(bar.tempoSteps, {\n onEmpty: () => [{ start: bar.start, end: bar.start + bar.length, bpm: bar.tempo.bpm }],\n onNonEmpty: (steps) =>\n pipe(\n steps,\n Arr.map((step) => ({\n start: bar.start + step.offset,\n end: bar.start + step.offset + step.length,\n bpm: step.bpm,\n })),\n ),\n });\n\nconst secondsPerTick = (bpm: number): number =>\n (SECONDS_PER_MINUTE * QUARTERS_PER_WHOLE) / (bpm * TICKS_PER_WHOLE);\n\nexport const clockOf = (song: Song): ((tick: number) => number) => {\n const segments = pipe(song.bars, Arr.flatMap(segmentsIn));\n return (tick) => {\n let seconds = NONE;\n for (const segment of segments) {\n if (segment.start < tick) {\n seconds += (Math.min(tick, segment.end) - segment.start) * secondsPerTick(segment.bpm);\n }\n }\n return seconds;\n };\n};\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport { clockOf } from \"#/app/presets/shared/lib/time.ts\";\nimport {\n MELODIC,\n hasRole,\n reporterOf,\n topLineOf,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst DEFAULT_SECONDS = 8;\nconst DEFAULT_REST = 0.15;\nconst DIGITS = 1;\nconst LAST = 1;\nconst maxSeconds = numberOption({ key: \"seconds\", fallback: DEFAULT_SECONDS });\nconst minRest = numberOption({ key: \"rest\", fallback: DEFAULT_REST });\n\ntype Clock = (tick: number) => number;\n\ntype Phrase = Arr.NonEmptyReadonlyArray<Sounding>;\n\nconst phrasesOf =\n (clock: Clock, rest: number) =>\n (line: readonly Sounding[]): readonly Phrase[] =>\n Arr.reduce(line, Arr.empty<Phrase>(), (phrases, note): readonly Phrase[] =>\n pipe(\n Arr.last(phrases),\n Option.filter((phrase) => clock(note.start) - clock(Arr.lastNonEmpty(phrase).end) < rest),\n Option.match({\n onNone: () => Arr.append(phrases, Arr.of(note)),\n onSome: (phrase) => Arr.append(Arr.dropRight(phrases, LAST), Arr.append(phrase, note)),\n }),\n ),\n );\n\nconst endOf = (phrase: Phrase): number =>\n pipe(\n phrase,\n Arr.map((sounding) => sounding.end),\n (ends) => Math.max(...ends),\n );\n\nconst checkPhrase =\n (report: Reporter, clock: Clock, max: number) =>\n (phrase: Phrase): void => {\n const first = Arr.headNonEmpty(phrase);\n const seconds = clock(endOf(phrase)) - clock(first.start);\n if (seconds > max) {\n report(`${String(first.line)}:${String(first.start)}`, {\n line: first.line,\n column: first.column,\n message: `${first.track} sings for ${seconds.toFixed(DIGITS)} seconds without a rest`,\n detail: \"Put a short rest in the phrase\",\n });\n }\n };\n\nexport const breath: Rule = defineRule({\n meta: { description: \"A sung line leaves room to breathe\" },\n check: (context) => {\n const clock = clockOf(context.song);\n const check = checkPhrase(reporterOf(context), clock, maxSeconds(context.options));\n const split = phrasesOf(clock, minRest(context.options));\n const melodic = pipe(context.soundings, Arr.filter(hasRole(MELODIC)));\n for (const track of tracksOf(melodic)) {\n for (const phrase of split(topLineOf(track))) {\n check(phrase);\n }\n }\n },\n});\n","import { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport {\n MELODIC,\n hasRole,\n neighborsOf,\n reporterOf,\n topLineOf,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst OCTAVE = 12;\nconst maxLeap = numberOption({ key: \"max\", fallback: OCTAVE });\n\nconst checkStep =\n (report: Reporter, max: number) =>\n ([previous, next]: readonly [Sounding, Sounding]): void => {\n const leap = Math.abs(next.midi - previous.midi);\n if (leap > max && next.start - previous.end < TICKS_PER_WHOLE) {\n report(`${String(next.line)}:${String(next.start)}`, {\n line: next.line,\n column: next.column,\n message: `${next.track} leaps ${String(leap)} semitones from ${previous.spelling} to ${next.spelling}`,\n detail: \"Make the jump smaller, or step back the other way right after it\",\n });\n }\n };\n\nexport const melodyLeap: Rule = defineRule({\n meta: { description: \"A melody does not jump further than an octave from one note to the next\" },\n check: (context) => {\n const check = checkStep(reporterOf(context), maxLeap(context.options));\n const melodic = pipe(context.soundings, Arr.filter(hasRole(MELODIC)));\n for (const track of tracksOf(melodic)) {\n for (const step of neighborsOf(topLineOf(track))) {\n check(step);\n }\n }\n },\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { Chord } from \"tonal\";\n\nconst COMMON = [\n \"M\",\n \"m\",\n \"dim\",\n \"aug\",\n \"7\",\n \"maj7\",\n \"m7\",\n \"m7b5\",\n \"dim7\",\n \"sus4\",\n \"sus2\",\n \"6\",\n \"m6\",\n \"Madd9\",\n \"madd9\",\n \"9\",\n \"maj9\",\n \"m9\",\n \"7sus4\",\n \"m/ma7\",\n \"6add9\",\n \"m69\",\n \"5\",\n];\nconst DYAD = 2;\n\nconst isCommonName = (name: string): boolean =>\n pipe(\n Arr.head(Chord.get(name).aliases),\n Option.exists((alias) => Arr.contains(COMMON, alias)),\n );\n\nexport const isCommonChord = (pitchClasses: readonly string[]): boolean => {\n const names = Arr.dedupe(pitchClasses);\n if (names.length < DYAD) {\n return true;\n }\n return pipe(Chord.detect(names), Arr.some(isCommonName));\n};\n","import { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport type { KeySpan, Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport { isCommonChord } from \"#/app/presets/shared/lib/chords.ts\";\nimport { keyAt, keysOf } from \"#/app/presets/shared/lib/keys.ts\";\nimport { pitchClassOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport {\n hasRole,\n isPitched,\n reporterOf,\n soundingAt,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst EIGHTHS_PER_WHOLE = 8;\nconst ORNAMENT = TICKS_PER_WHOLE / EIGHTHS_PER_WHOLE;\nconst HALF_STEP = 1;\nconst WHOLE_STEP = 2;\nconst MAJOR_STEPS = { tonic: 0, second: 2, third: 4, fourth: 5, fifth: 7, sixth: 9, seventh: 11 };\nconst MINOR_STEPS = {\n tonic: 0,\n second: 2,\n flatThird: 3,\n fourth: 5,\n fifth: 7,\n flatSixth: 8,\n raisedSixth: 9,\n flatSeventh: 10,\n leadingTone: 11,\n};\nconst MAJOR = Rec.values(MAJOR_STEPS);\nconst MINOR = Rec.values(MINOR_STEPS);\nconst stepsOf = (key: KeySpan): readonly number[] => {\n if (key.mode === \"major\") {\n return MAJOR;\n }\n return MINOR;\n};\n\nconst inScale =\n (key: KeySpan) =>\n (midi: number): boolean =>\n Arr.contains(stepsOf(key), pitchClassOf(midi - key.pitchClass));\n\ntype Fits = (sounding: Sounding) => boolean;\n\nconst inChordOf = (soundings: readonly Sounding[]): Fits => {\n const harmony = pipe(soundings, Arr.filter(hasRole([\"bass\", \"harmony\"])));\n return (sounding) => {\n const under = soundingAt(harmony)(sounding.start);\n const shared = pipe(\n under,\n Arr.some(\n (other) =>\n other.track !== sounding.track &&\n pitchClassOf(other.midi) === pitchClassOf(sounding.midi),\n ),\n );\n const voicesChord =\n hasRole([\"bass\", \"harmony\"])(sounding) &&\n isCommonChord(\n pipe(\n under,\n Arr.map((other) => other.pitchClass),\n ),\n );\n return shared || voicesChord;\n };\n};\n\nconst isStep = (from: Sounding, to: Sounding): boolean => {\n const distance = Math.abs(to.midi - from.midi);\n return distance >= HALF_STEP && distance <= WHOLE_STEP;\n};\n\nconst neighboursOf =\n (track: readonly Sounding[]) =>\n (sounding: Sounding): Option.Option<readonly [Sounding, Sounding]> => {\n const before = pipe(\n track,\n Arr.findLast((other) => other.end === sounding.start),\n );\n const after = pipe(\n track,\n Arr.findFirst((other) => other.start === sounding.end),\n );\n return Option.all([before, after]);\n };\n\nconst isOrnament =\n (fits: Fits, track: readonly Sounding[]) =>\n (sounding: Sounding): boolean =>\n sounding.end - sounding.start <= ORNAMENT &&\n pipe(\n neighboursOf(track)(sounding),\n Option.exists(\n ([before, after]) =>\n isStep(before, sounding) && isStep(sounding, after) && fits(before) && fits(after),\n ),\n );\n\nconst fitsOf =\n (keys: readonly KeySpan[], inChord: Fits): Fits =>\n (sounding) =>\n inChord(sounding) ||\n pipe(\n keyAt(keys)(sounding.bar),\n Option.match({ onNone: () => true, onSome: (key) => inScale(key)(sounding.midi) }),\n );\n\ninterface NoteCheck {\n readonly report: Reporter;\n readonly keys: readonly KeySpan[];\n readonly fits: Fits;\n readonly tracks: readonly (readonly Sounding[])[];\n}\n\nconst trackOf =\n (tracks: readonly (readonly Sounding[])[]) =>\n (sounding: Sounding): readonly Sounding[] =>\n pipe(\n tracks,\n Arr.findFirst((candidate) =>\n pipe(\n candidate,\n Arr.some((other) => other.track === sounding.track),\n ),\n ),\n Option.getOrElse((): readonly Sounding[] => []),\n );\n\nconst checkNote =\n ({ report, keys, fits, tracks }: NoteCheck) =>\n (sounding: Sounding): void => {\n const track = trackOf(tracks)(sounding);\n for (const key of Option.toArray(keyAt(keys)(sounding.bar))) {\n if (!fits(sounding) && !isOrnament(fits, track)(sounding)) {\n report(`${String(sounding.line)}:${String(sounding.column)}`, {\n line: sounding.line,\n column: sounding.column,\n message: `${sounding.spelling} in ${sounding.track} is outside ${key.tonic} ${key.mode} and the chord under it`,\n detail: \"Move it a semitone, or ignore the line if the borrowed note is intended\",\n });\n }\n }\n };\n\nexport const outOfKey: Rule = defineRule({\n meta: { description: \"Notes stay in the key the notes around them imply\" },\n check: (context) => {\n const keys = keysOf(context.song);\n const pitched = pipe(context.soundings, Arr.filter(isPitched));\n const fits = fitsOf(keys, inChordOf(context.soundings));\n const check = checkNote({ report: reporterOf(context), keys, fits, tracks: tracksOf(pitched) });\n for (const sounding of pitched) {\n check(sounding);\n }\n },\n});\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Predicate, Record as Rec, pipe } from \"effect\";\n\nimport { midiOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport { reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule, RuleOptions } from \"#/shared/config/index.ts\";\n\nexport type Range = readonly [string, string];\n\nexport type Ranges = Readonly<Record<string, Range>>;\n\nexport const DEFAULT_RANGES: Ranges = {\n melody: [\"C3\", \"C6\"],\n countermelody: [\"C3\", \"C6\"],\n bass: [\"E1\", \"C4\"],\n};\n\ninterface Bounds {\n readonly low: number;\n readonly high: number;\n readonly name: string;\n}\n\nconst RANGE_LENGTH = 2;\n\nconst isRange = (value: unknown): value is Range =>\n Arr.isArray(value) && value.length === RANGE_LENGTH && pipe(value, Arr.every(Predicate.isString));\n\nconst boundsOf = ([low, high]: Range): Option.Option<Bounds> =>\n Option.all({ low: midiOf(low), high: midiOf(high), name: Option.some(`${low}-${high}`) });\n\nconst configured = (options: RuleOptions): Readonly<Record<string, unknown>> =>\n pipe(\n Option.fromNullishOr(options[\"ranges\"]),\n Option.filter(Predicate.isObject),\n Option.map((value): Readonly<Record<string, unknown>> => ({ ...DEFAULT_RANGES, ...value })),\n Option.getOrElse((): Readonly<Record<string, unknown>> => DEFAULT_RANGES),\n );\n\nconst rangesOf = (options: RuleOptions): Readonly<Record<string, Bounds>> =>\n pipe(\n configured(options),\n Rec.toEntries,\n Arr.flatMap(([name, value]) =>\n pipe(\n Option.liftPredicate(value, isRange),\n Option.flatMap(boundsOf),\n Option.map((bounds): readonly [string, Bounds] => [name, bounds]),\n Option.toArray,\n ),\n ),\n Rec.fromEntries,\n );\n\nconst boundsFor =\n (ranges: Readonly<Record<string, Bounds>>) =>\n (sounding: Sounding): Option.Option<Bounds> =>\n pipe(\n ranges,\n Rec.get(sounding.track),\n Option.orElse(() =>\n pipe(\n sounding.role,\n Option.flatMap((role) => pipe(ranges, Rec.get(role))),\n ),\n ),\n );\n\nconst checkNote =\n (report: Reporter) =>\n (sounding: Sounding, bounds: Bounds): void => {\n if (sounding.midi < bounds.low || sounding.midi > bounds.high) {\n report(`${String(sounding.line)}:${String(sounding.column)}`, {\n line: sounding.line,\n column: sounding.column,\n message: `${sounding.spelling} in ${sounding.track} is outside ${bounds.name}`,\n detail: \"Move the phrase an octave, or set the range of this track\",\n });\n }\n };\n\nexport const partRange: Rule = defineRule({\n meta: { description: \"Each part stays inside the range its singer or instrument can play\" },\n check: (context) => {\n const check = checkNote(reporterOf(context));\n const lookup = boundsFor(rangesOf(context.options));\n for (const sounding of context.soundings) {\n for (const bounds of Option.toArray(lookup(sounding))) {\n check(sounding, bounds);\n }\n }\n },\n});\n","import { Option, pipe } from \"effect\";\n\nimport { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin, RuleEntry } from \"#/shared/config/index.ts\";\n\nimport { breath } from \"./breath.ts\";\nimport { melodyLeap } from \"./melody-leap.ts\";\nimport { outOfKey } from \"./out-of-key.ts\";\nimport { partRange } from \"./part-range.ts\";\nimport type { Ranges } from \"./part-range.ts\";\n\nexport interface PopOptions {\n readonly ranges?: Ranges;\n readonly maxLeap?: number;\n readonly breathSeconds?: number;\n}\n\nexport const popPlugin: Plugin = definePlugin({\n rules: {\n \"out-of-key\": outOfKey,\n \"part-range\": partRange,\n \"melody-leap\": melodyLeap,\n breath,\n },\n});\n\nconst warnWith =\n (key: string) =>\n (value: unknown): RuleEntry =>\n pipe(\n Option.fromNullishOr(value),\n Option.match({\n onNone: (): RuleEntry => \"warn\",\n onSome: (given): RuleEntry => [\"warn\", { [key]: given }],\n }),\n );\n\nexport const pop = (options: PopOptions = {}): I68Config => ({\n plugins: { pop: popPlugin },\n rules: {\n \"pop/out-of-key\": \"warn\",\n \"pop/part-range\": warnWith(\"ranges\")(options.ranges),\n \"pop/melody-leap\": warnWith(\"max\")(options.maxLeap),\n \"pop/breath\": warnWith(\"seconds\")(options.breathSeconds),\n },\n});\n","import type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Order, pipe } from \"effect\";\n\nimport { MELODIC, hasRole, highest, lowest, soundingAt } from \"#/app/presets/shared/lib/voices.ts\";\n\nexport interface OuterPair {\n readonly tick: number;\n readonly melody: Sounding;\n readonly bass: Sounding;\n}\n\nconst pickAt =\n (\n soundings: readonly Sounding[],\n pick: (found: Arr.NonEmptyReadonlyArray<Sounding>) => Sounding,\n ) =>\n (tick: number): Option.Option<Sounding> =>\n pipe(\n soundingAt(soundings)(tick),\n Arr.match({ onEmpty: () => Option.none(), onNonEmpty: (found) => Option.some(pick(found)) }),\n );\n\nexport const outerVoicesOf = (soundings: readonly Sounding[]): readonly OuterPair[] => {\n const melodic = pipe(soundings, Arr.filter(hasRole(MELODIC)));\n const low = pipe(soundings, Arr.filter(hasRole([\"bass\"])));\n const topAt = pickAt(melodic, highest);\n const bottomAt = pickAt(low, lowest);\n const ticks = pipe(\n [...melodic, ...low],\n Arr.map((sounding) => sounding.start),\n Arr.dedupe,\n (all) => Arr.sort(all, Order.Number),\n );\n const pairAt = (tick: number): Option.Option<OuterPair> =>\n pipe(\n Option.all({ melody: topAt(tick), bass: bottomAt(tick) }),\n Option.map(({ melody, bass }) => ({ tick, melody, bass })),\n );\n return pipe(ticks, Arr.map(pairAt), Arr.getSomes);\n};\n","import { Match, Option } from \"effect\";\n\nimport { pitchClassOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport { neighborsOf, reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nimport { outerVoicesOf } from \"./outer-voices.ts\";\nimport type { OuterPair } from \"./outer-voices.ts\";\n\nconst UNISON = 0;\nconst FIFTH = 7;\nconst STILL = 0;\n\nconst perfectName = (interval: number): Option.Option<string> =>\n Match.value(interval).pipe(\n Match.when(UNISON, () => Option.some(\"octaves\")),\n Match.when(FIFTH, () => Option.some(\"fifths\")),\n Match.orElse(() => Option.none()),\n );\n\nconst intervalOf = (pair: OuterPair): number => pitchClassOf(pair.melody.midi - pair.bass.midi);\n\nconst movesTogether = (previous: OuterPair, next: OuterPair): boolean => {\n const melody = Math.sign(next.melody.midi - previous.melody.midi);\n return melody !== STILL && melody === Math.sign(next.bass.midi - previous.bass.midi);\n};\n\nconst checkMove =\n (report: Reporter) =>\n ([previous, next]: readonly [OuterPair, OuterPair]): void => {\n const name = perfectName(intervalOf(next));\n if (\n Option.isSome(name) &&\n intervalOf(previous) === intervalOf(next) &&\n movesTogether(previous, next)\n ) {\n report(`${String(next.melody.line)}:${String(next.tick)}`, {\n line: next.melody.line,\n column: next.melody.column,\n message: `Parallel ${name.value}: ${previous.melody.spelling}/${previous.bass.spelling} to ${next.melody.spelling}/${next.bass.spelling} between ${next.melody.track} and ${next.bass.track}`,\n detail: \"Move the melody or the bass the other way\",\n });\n }\n };\n\nexport const parallelPerfects: Rule = defineRule({\n meta: { description: \"Melody and bass do not move in parallel fifths or octaves\" },\n check: (context) => {\n const check = checkMove(reporterOf(context));\n for (const move of neighborsOf(outerVoicesOf(context.soundings))) {\n check(move);\n }\n },\n});\n","import type { Song } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport { pitchClassOf } from \"#/app/presets/shared/lib/pitch.ts\";\nimport {\n MELODIC,\n hasRole,\n neighborsOf,\n reporterOf,\n topLineOf,\n tracksOf,\n} from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nimport { outerVoicesOf } from \"./outer-voices.ts\";\n\nconst DISSONANT_STEPS = {\n minorSecond: 1,\n majorSecond: 2,\n fourth: 5,\n tritone: 6,\n minorSeventh: 10,\n majorSeventh: 11,\n};\nconst DISSONANT = Rec.values(DISSONANT_STEPS);\nconst STEP_DOWN = Rec.values({ halfStep: -1, wholeStep: -2 });\nconst HALVES = 2;\nconst ON_BEAT = 0;\n\nconst strongLength = (length: number, numerator: number): number => {\n if (numerator % HALVES === ON_BEAT) {\n return length / HALVES;\n }\n return length;\n};\n\nconst isStrongBeat =\n (song: Song) =>\n (sounding: Sounding): boolean =>\n pipe(\n song.bars,\n Arr.findFirst((bar) => bar.index === sounding.bar),\n Option.exists(\n (bar) =>\n (sounding.start - bar.start) % strongLength(bar.length, bar.meter.numerator) === ON_BEAT,\n ),\n );\n\ntype BassAt = (tick: number) => Option.Option<Sounding>;\n\nconst bassOf = (soundings: readonly Sounding[]): BassAt => {\n const pairs = outerVoicesOf(soundings);\n return (tick) =>\n pipe(\n pairs,\n Arr.findFirst((pair) => pair.tick === tick),\n Option.map((pair) => pair.bass),\n );\n};\n\nconst checkNote =\n (report: Reporter, strong: (sounding: Sounding) => boolean, bassAt: BassAt) =>\n ([note, next]: readonly [Sounding, Option.Option<Sounding>]): void => {\n const dissonant = Option.exists(bassAt(note.start), (bass) =>\n Arr.contains(DISSONANT, pitchClassOf(note.midi - bass.midi)),\n );\n const resolved = Option.exists(next, (found) =>\n Arr.contains(STEP_DOWN, found.midi - note.midi),\n );\n if (strong(note) && dissonant && !resolved) {\n report(`${String(note.line)}:${String(note.start)}`, {\n line: note.line,\n column: note.column,\n message: `${note.spelling} in ${note.track} is dissonant against the bass and does not step down`,\n detail: \"Move the next note down a step\",\n });\n }\n };\n\nconst withNext = (\n line: readonly Sounding[],\n): readonly (readonly [Sounding, Option.Option<Sounding>])[] => [\n ...pipe(\n neighborsOf(line),\n Arr.map(([note, next]): readonly [Sounding, Option.Option<Sounding>] => [\n note,\n Option.some(next),\n ]),\n ),\n ...pipe(\n Arr.last(line),\n Option.map((note): readonly [Sounding, Option.Option<Sounding>] => [note, Option.none()]),\n Option.toArray,\n ),\n];\n\nexport const unresolvedDissonance: Rule = defineRule({\n meta: { description: \"A dissonant melody note on a strong beat steps down to resolve\" },\n check: (context) => {\n const check = checkNote(\n reporterOf(context),\n isStrongBeat(context.song),\n bassOf(context.soundings),\n );\n const melodic = pipe(context.soundings, Arr.filter(hasRole(MELODIC)));\n for (const track of tracksOf(melodic)) {\n for (const entry of withNext(topLineOf(track))) {\n check(entry);\n }\n }\n },\n});\n","import { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin } from \"#/shared/config/index.ts\";\n\nimport { parallelPerfects } from \"./parallel-perfects.ts\";\nimport { unresolvedDissonance } from \"./unresolved-dissonance.ts\";\n\nexport const classicalPlugin: Plugin = definePlugin({\n rules: {\n \"parallel-perfects\": parallelPerfects,\n \"unresolved-dissonance\": unresolvedDissonance,\n },\n});\n\nexport const classical = (): I68Config => ({\n plugins: { classical: classicalPlugin },\n rules: {\n \"classical/parallel-perfects\": \"warn\",\n \"classical/unresolved-dissonance\": \"warn\",\n },\n});\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { progressionOf } from \"#/app/presets/shared/lib/degrees.ts\";\nimport type { Step } from \"#/app/presets/shared/lib/degrees.ts\";\nimport { reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nexport interface Progression {\n readonly name: string;\n readonly degrees: readonly string[];\n}\n\nexport const PROGRESSIONS: readonly Progression[] = [\n { name: \"丸サ進行 (Just the Two of Us)\", degrees: [\"IVM7\", \"III7\", \"VIm7\"] },\n { name: \"王道進行\", degrees: [\"IV\", \"V\", \"IIIm\", \"VIm\"] },\n { name: \"小室進行\", degrees: [\"VIm\", \"IV\", \"V\", \"I\"] },\n { name: \"カノン進行\", degrees: [\"I\", \"V\", \"VIm\", \"IIIm\", \"IV\", \"I\", \"IV\", \"V\"] },\n { name: \"ii–V–I\", degrees: [\"IIm\", \"V\", \"I\"] },\n { name: \"Andalusian cadence\", degrees: [\"VIm\", \"V\", \"IV\", \"III\"] },\n];\n\nconst START = 0;\n\nconst FAMILIES = [\n [\"M7\", \"\"],\n [\"m7b5\", \"dim\"],\n [\"m7\", \"m\"],\n [\"dim7\", \"dim\"],\n [\"7\", \"\"],\n] as const;\n\nconst familyOf = (token: string): string =>\n pipe(\n FAMILIES,\n Arr.findFirst(([suffix]) => Str.endsWith(suffix)(token)),\n Option.match({\n onNone: () => token,\n onSome: ([suffix, triad]) =>\n `${Str.slice(START, token.length - suffix.length)(token)}${triad}`,\n }),\n );\n\nconst matches =\n (steps: readonly Step[], degrees: readonly string[]) =>\n (start: number): boolean =>\n pipe(\n degrees,\n Arr.every((degree, offset) =>\n pipe(\n Arr.get(steps, start + offset),\n Option.exists((step) => familyOf(step.token) === familyOf(degree)),\n ),\n ),\n );\n\nexport const namedProgression: Rule = defineRule({\n meta: { description: \"Names the well-known chord progressions a song uses\" },\n check: (context) => {\n const steps = progressionOf(context.soundings)(context.song);\n const report = reporterOf(context);\n for (const progression of PROGRESSIONS) {\n const starts = pipe(\n Arr.makeBy(steps.length, (index) => index),\n Arr.filter(matches(steps, progression.degrees)),\n );\n for (const step of pipe(\n starts,\n Arr.flatMap((start) => Option.toArray(Arr.get(steps, start))),\n )) {\n report(`${progression.name}:${String(step.line)}:${String(step.bar)}`, {\n line: step.line,\n column: step.column,\n message: `${progression.name} (${Arr.join(progression.degrees, \"–\")}) starts in bar ${String(step.bar)}`,\n });\n }\n }\n },\n});\n","import { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin } from \"#/shared/config/index.ts\";\n\nimport { namedProgression } from \"./named.ts\";\n\nexport const progressionsPlugin: Plugin = definePlugin({\n rules: { named: namedProgression },\n});\n\nexport const progressions = (): I68Config => ({\n plugins: { progressions: progressionsPlugin },\n rules: { \"progressions/named\": \"warn\" },\n});\n","import { Array as Arr, Number as Num, Option, Record as Rec, pipe } from \"effect\";\n\nimport { progressionOf } from \"#/app/presets/shared/lib/degrees.ts\";\nimport type { Step } from \"#/app/presets/shared/lib/degrees.ts\";\nimport { numberOption } from \"#/app/presets/shared/lib/options.ts\";\nimport { longestContext } from \"#/app/presets/shared/lib/style-table.ts\";\nimport type { Context, StyleTable } from \"#/app/presets/shared/lib/style-table.ts\";\nimport { reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\nimport type { Reporter } from \"#/app/presets/shared/lib/voices.ts\";\nimport { defineRule } from \"#/entities/rule/index.ts\";\nimport type { Rule } from \"#/shared/config/index.ts\";\n\nconst DEFAULT_SHARE = 0.03;\nconst DEFAULT_SEEN = 8;\nconst PERCENT = 100;\nconst SUGGESTIONS = 3;\nconst FIRST = 1;\nconst NEVER = 0;\nconst minShare = numberOption({ key: \"share\", fallback: DEFAULT_SHARE });\nconst minSeen = numberOption({ key: \"seen\", fallback: DEFAULT_SEEN });\n\nconst percentOf = (count: number, total: number): string =>\n `${String(Math.round((count / total) * PERCENT))}%`;\n\nconst suggestionsOf = (context: Context): string =>\n pipe(\n Rec.toEntries(context.next),\n Arr.sortWith(([, count]) => -count, Num.Order),\n Arr.take(SUGGESTIONS),\n Arr.map(([token, count]) => `${token} (${percentOf(count, context.total)})`),\n Arr.join(\", \"),\n );\n\ninterface Limits {\n readonly share: number;\n readonly seen: number;\n}\n\nconst checkStep =\n (report: Reporter, table: StyleTable, { share, seen }: Limits) =>\n (steps: readonly Step[], index: number): void => {\n const before = Arr.take(steps, index);\n for (const step of Option.toArray(Arr.get(steps, index))) {\n for (const context of Option.toArray(longestContext({ table, seen })(before))) {\n const count = Option.getOrElse(Rec.get(context.next, step.token), () => NEVER);\n if (count / context.total < share) {\n report(`${String(step.line)}:${step.token}:${String(index)}`, {\n line: step.line,\n column: step.column,\n message: `${context.words} → ${step.token} is rare in ${table.name} (${percentOf(count, context.total)})`,\n detail: `${table.name} usually goes to ${suggestionsOf(context)}`,\n });\n }\n }\n }\n };\n\nexport const rareTransitionOf = (table: StyleTable): Rule =>\n defineRule({\n meta: { description: `Chord changes follow what ${table.name} usually does next` },\n check: (context) => {\n const steps = progressionOf(context.soundings)(context.song);\n const check = checkStep(reporterOf(context), table, {\n share: minShare(context.options),\n seen: minSeen(context.options),\n });\n const indices = Arr.makeBy(steps.length, (at) => at);\n for (const index of Arr.drop(indices, FIRST)) {\n check(steps, index);\n }\n },\n });\n","import BACH_CHORALES from \"#/app/presets/features/check-style/data/bach-chorales.json\" with { type: \"json\" };\nimport type { StyleTable } from \"#/app/presets/shared/lib/style-table.ts\";\nimport { definePlugin } from \"#/entities/rule/index.ts\";\nimport type { I68Config, Plugin } from \"#/shared/config/index.ts\";\n\nimport { rareTransitionOf } from \"./rare-transition.ts\";\n\nexport const bachPlugin: Plugin = definePlugin({\n rules: { \"rare-transition\": rareTransitionOf(BACH_CHORALES) },\n});\n\nexport const bach = (): I68Config => ({\n plugins: { bach: bachPlugin },\n rules: { \"bach/rare-transition\": \"warn\" },\n});\n\nexport const stylePluginOf = (table: StyleTable): Plugin =>\n definePlugin({ rules: { \"rare-transition\": rareTransitionOf(table) } });\n","import type { RuleContext } from \"@r_masseater/i68\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { progressionOf } from \"#/app/presets/shared/lib/degrees.ts\";\nimport type { Step } from \"#/app/presets/shared/lib/degrees.ts\";\nimport { mixFactsOf, placeIn, trackKeyOf } from \"#/app/presets/shared/lib/mix-facts.ts\";\nimport type { MixFact, MixPlace } from \"#/app/presets/shared/lib/mix-facts.ts\";\nimport { mixKeyOf } from \"#/app/presets/shared/lib/mix-habit.ts\";\nimport type { MixHabit } from \"#/app/presets/shared/lib/mix-habit.ts\";\nimport type { Subject } from \"#/app/presets/shared/lib/style-rules.ts\";\n\nconst FIRST = 1;\n\nexport interface Occasion {\n readonly id: string;\n readonly line: number;\n readonly column: number;\n readonly holds: boolean;\n}\n\ntype Chord = Extract<Subject, { readonly type: \"chord\" }>;\n\nconst follows = (before: readonly Step[], context: string): boolean => {\n const words = Str.split(\" \")(context);\n return (\n before.length >= words.length &&\n pipe(\n Arr.takeRight(before, words.length),\n Arr.map((step) => step.token),\n Arr.join(\" \"),\n ) === context\n );\n};\n\nconst chordOccasions =\n (context: RuleContext) =>\n (chord: Chord): readonly Occasion[] => {\n const steps = progressionOf(context.soundings)(context.song);\n return pipe(\n Arr.makeBy(steps.length, (index) => index),\n Arr.drop(FIRST),\n Arr.filter((index) => follows(Arr.take(steps, index), chord.context)),\n Arr.map((index) => {\n const step = Arr.getUnsafe(steps, index);\n return {\n id: String(index),\n line: step.line,\n column: step.column,\n holds: step.token === chord.next,\n };\n }),\n );\n };\n\nconst sectionStartsOf = (context: RuleContext): readonly number[] =>\n pipe(\n context.song.bars,\n Arr.drop(FIRST),\n Arr.filter((bar) => Option.isSome(bar.section) || Option.isSome(bar.mark)),\n Arr.map((bar) => bar.index),\n );\n\nconst occasionAt = (place: MixPlace, holds: boolean): Occasion => ({\n id: String(place.bar),\n line: place.line,\n column: place.column,\n holds,\n});\n\nconst has =\n (facts: readonly MixFact[], habit: MixHabit) =>\n (bar: Option.Option<number>): boolean =>\n pipe(\n facts,\n Arr.some(\n (fact) =>\n mixKeyOf(fact.habit) === mixKeyOf(habit) &&\n Option.match(bar, { onNone: () => true, onSome: (at) => fact.place.bar === at }),\n ),\n );\n\nconst mixOccasions =\n (context: RuleContext) =>\n (habit: MixHabit): readonly Occasion[] => {\n const facts = mixFactsOf(context.soundings)(context.song);\n const place = placeIn(context.soundings);\n const tracks = pipe(\n context.song.tracks,\n Arr.filter((track) => trackKeyOf(track.name) === habit.track),\n );\n if (habit.type !== \"move\") {\n return pipe(\n tracks,\n Arr.map((track) =>\n occasionAt(place({ track: track.name, bar: FIRST }), has(facts, habit)(Option.none())),\n ),\n );\n }\n return pipe(\n tracks,\n Arr.flatMap((track) =>\n pipe(\n sectionStartsOf(context),\n Arr.map((bar) =>\n occasionAt(place({ track: track.name, bar }), has(facts, habit)(Option.some(bar))),\n ),\n ),\n ),\n );\n };\n\nexport const occasionsOf =\n (context: RuleContext) =>\n (subject: Subject): readonly Occasion[] => {\n if (subject.type === \"chord\") {\n return chordOccasions(context)(subject);\n }\n return mixOccasions(context)(subject);\n };\n","import { defineRule } from \"@r_masseater/i68\";\nimport type { Rule } from \"@r_masseater/i68\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { subjectKeyOf } from \"#/app/presets/shared/lib/style-rules.ts\";\nimport type { HabitKind, HabitRule, StyleRules } from \"#/app/presets/shared/lib/style-rules.ts\";\nimport { reporterOf } from \"#/app/presets/shared/lib/voices.ts\";\n\nimport { occasionsOf } from \"./occasions.ts\";\n\ntype Wording = Readonly<{\n description: (name: string) => string;\n reportsWhen: boolean;\n message: (name: string, key: string) => string;\n}>;\n\nconst WORDINGS: Readonly<Record<HabitKind, Wording>> = {\n keep: {\n description: (name) => `Songs keep the habits of ${name}`,\n reportsWhen: false,\n message: (name, key) => `${name} keeps ${key} here`,\n },\n fix: {\n description: (name) => `Songs avoid the habits ${name} is fixing`,\n reportsWhen: true,\n message: (name, key) => `${key} is a habit ${name} is fixing`,\n },\n suggest: {\n description: (name) => `Habits that would fit ${name}`,\n reportsWhen: false,\n message: (name, key) => `${key} would fit ${name} here`,\n },\n};\n\nconst detailOf = (habit: HabitRule): string =>\n pipe(\n Option.fromNullishOr(habit.reason),\n Option.match({\n onNone: () => habit.aim,\n onSome: (reason) => `${habit.aim}: ${reason}`,\n }),\n );\n\nexport type HabitRuleInput = Readonly<{ rules: StyleRules; kind: HabitKind }>;\n\nexport const habitRuleOf = ({ rules, kind }: HabitRuleInput): Rule => {\n const wording = WORDINGS[kind];\n const habits = pipe(\n rules.habits,\n Arr.filter((habit) => habit.kind === kind),\n );\n return defineRule({\n meta: { description: wording.description(rules.name) },\n check: (context) => {\n const report = reporterOf(context);\n for (const habit of habits) {\n const key = subjectKeyOf(habit.habit);\n for (const occasion of occasionsOf(context)(habit.habit)) {\n if (occasion.holds === wording.reportsWhen) {\n report(`${key}:${occasion.id}`, {\n line: occasion.line,\n column: occasion.column,\n message: wording.message(rules.name, key),\n detail: detailOf(habit),\n });\n }\n }\n }\n },\n });\n};\n","import { definePlugin } from \"@r_masseater/i68\";\nimport type { I68Config, Plugin } from \"@r_masseater/i68\";\n\nimport type { StyleRules } from \"#/app/presets/shared/lib/style-rules.ts\";\n\nimport { habitRuleOf } from \"./habit-rule.ts\";\n\nexport const styleRulesPluginOf = (rules: StyleRules): Plugin =>\n definePlugin({\n rules: {\n keep: habitRuleOf({ rules, kind: \"keep\" }),\n fix: habitRuleOf({ rules, kind: \"fix\" }),\n suggest: habitRuleOf({ rules, kind: \"suggest\" }),\n },\n });\n\nexport type StyleRulesPreset = Readonly<{ plugin: string; rules: StyleRules }>;\n\nexport const styleRules = ({ plugin, rules }: StyleRulesPreset): I68Config => ({\n plugins: { [plugin]: styleRulesPluginOf(rules) },\n rules: {\n [`${plugin}/keep`]: \"warn\",\n [`${plugin}/fix`]: \"error\",\n [`${plugin}/suggest`]: \"warn\",\n },\n});\n","import { harmony } from \"#/app/presets/features/check-harmony/index.ts\";\nimport { pop } from \"#/app/presets/features/check-pop/index.ts\";\nimport type { PopOptions } from \"#/app/presets/features/check-pop/index.ts\";\nimport type { I68Config } from \"#/shared/config/index.ts\";\n\nexport { classical, classicalPlugin } from \"#/app/presets/features/check-classical/index.ts\";\nexport { DEFAULT_RANGES, pop, popPlugin } from \"#/app/presets/features/check-pop/index.ts\";\nexport type { PopOptions, Range, Ranges } from \"#/app/presets/features/check-pop/index.ts\";\nexport {\n PROGRESSIONS,\n progressions,\n progressionsPlugin,\n} from \"#/app/presets/features/check-progressions/index.ts\";\nexport type { Progression } from \"#/app/presets/features/check-progressions/index.ts\";\nexport { bach, bachPlugin, stylePluginOf } from \"#/app/presets/features/check-style/index.ts\";\nexport { styleRules, styleRulesPluginOf } from \"#/app/presets/features/check-habits/index.ts\";\nexport type { StyleRulesPreset } from \"#/app/presets/features/check-habits/index.ts\";\nexport {\n HABIT_KINDS,\n StyleRulesSchema,\n subjectKeyOf,\n} from \"#/app/presets/shared/lib/style-rules.ts\";\nexport type {\n HabitKind,\n HabitRule,\n StyleRules,\n Subject,\n} from \"#/app/presets/shared/lib/style-rules.ts\";\nexport { mixKeyOf } from \"#/app/presets/shared/lib/mix-habit.ts\";\nexport type { MixHabit } from \"#/app/presets/shared/lib/mix-habit.ts\";\nexport type { StyleTable, Transitions } from \"#/app/presets/shared/lib/style-table.ts\";\nexport { harmony, harmonyPlugin } from \"#/app/presets/features/check-harmony/index.ts\";\n\nexport const recommended = (options: PopOptions = {}): I68Config => ({\n extends: [pop(options), harmony()],\n});\n"],"mappings":";;;;;;AASA,MAAa,gBACV,EAAE,KAAK,gBACP,YACC,KACE,OAAO,cAAc,QAAQ,IAAI,GACjC,OAAO,OAAO,UAAU,QAAQ,GAChC,OAAO,gBAAgB,QAAQ,CACjC;;ACPJ,MAAMA,WAAS;AACf,MAAM,SAAS,aAAa;CAAE,KAAK;CAAU,UAAUA;AAAO,CAAC;AAC/D,MAAM,WAAW,QAAQ,CAAC,QAAQ,CAAC;AACnC,MAAM,YAAY,QAAQ,CAAC,SAAS,CAAC;AAErC,MAAM,eAAe,UAAkB,SAAwC;CAC7E,IAAI,WAAWA,UACb,OAAO,OAAO,KAAK,OAAO;CAE5B,IAAI,WAAWA,YAAU,YAAY,MACnC,OAAO,OAAO,KAAK,YAAY;CAEjC,OAAO,OAAO,KAAK;AACrB;AAEA,MAAMC,eACH,QAAkB,UAClB,SAAqB;CACpB,MAAM,QAAQ,OAAO,IAAI;EACvB,QAAQ,KAAK,MAAMC,MAAI,UAAU,QAAQ,CAAC;EAC1C,OAAO,KAAK,MAAMA,MAAI,UAAU,SAAS,CAAC;CAC5C,CAAC;CACD,KAAK,MAAM,EAAE,QAAQ,WAAW,OAAO,QAAQ,KAAK,GAClD,KAAK,MAAM,SAAS,OAAO,QAAQ,YAAY,OAAO,OAAO,MAAM,MAAM,IAAI,CAAC,GAC5E,OAAO,GAAG,OAAO,MAAM,IAAI,EAAE,GAAG,OAAO,MAAM,MAAM,EAAE,GAAG,OAAO,MAA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AY,YAAY,OAAO,CAAC,CAAC,MAAM,KAAK,GACrD,IAAI,SAAS,UAAU,QAAQ,aAC7B,OAAO,GAAG,IAAI,GAAG,SAAS,MAAM;KAC9B,MAAM,SAAS;KACf,QAAQ,SAAS;KACjB,SAAS,QAAQ,QAAQ,MAAM,MAAM,GAAG;KACxC,QAAQ,SAAS,KAAK;IACxB,CAAC;GAGP;EACF;CACF,CAAC;AACH;;AC/DA,MAAa,sBAAsB,UACjC,aAAa,EACX,OAAO;CACL,MAAM,YAAY;EAAE;EAAO,MAAM;CAAO,CAAC;CACzC,KAAK,YAAY;EAAE;EAAO,MAAM;CAAM,CAAC;CACvC,SAAS,YAAY;EAAE;EAAO,MAAM;CAAU,CAAC;AACjD,EACF,CAAC;AAIH,MAAa,cAAc,EAAE,QAAQ,aAA0C;CAC7E,SAAS,GAAG,SAAS,mBAAmB,KAAK,EAAE;CAC/C,OAAO;GACJ,GAAG,OAAO,SAAS;GACnB,GAAG,OAAO,QAAQ;GAClB,GAAG,OAAO,YAAY;CACzB;AACF;;ACQA,MAAa,eAAe,UAAsB,CAAC,OAAkB,EACnE,SAAS,CAAC,IAAI,OAAO,GAAG,QAAQ,CAAC,EACnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r_masseater/i68",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "A linter for .fumx songs that checks musical rules such as notes outside the key, part ranges, voicing clashes and parallel fifths, configured from vite.config.ts with rules written in TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fumx",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"effect": "^4.1.0",
|
|
80
|
-
"tonal": ">=6.
|
|
80
|
+
"tonal": ">=6.10.0",
|
|
81
81
|
"vite": "*",
|
|
82
82
|
"vite-plus": ">=1.8.0"
|
|
83
83
|
},
|