@libraz/libcantus 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +63 -0
- package/README.md +7 -1
- package/README_ja.md +17 -11
- package/dist/analyze/index.cjs +31 -7
- package/dist/analyze/index.cjs.map +1 -1
- package/dist/analyze/index.d.cts +161 -13
- package/dist/analyze/index.d.ts +161 -13
- package/dist/analyze/index.js +37 -13
- package/dist/{chunk-NB25P3EH.js → chunk-2G5MCGYU.js} +33 -11
- package/dist/chunk-2G5MCGYU.js.map +1 -0
- package/dist/{chunk-NM7UAMC3.cjs → chunk-3FDBMIPR.cjs} +64 -64
- package/dist/chunk-3FDBMIPR.cjs.map +1 -0
- package/dist/{chunk-HPVSH7SF.cjs → chunk-3MDOEFIQ.cjs} +618 -954
- package/dist/chunk-3MDOEFIQ.cjs.map +1 -0
- package/dist/{chunk-FBH75DAY.js → chunk-5MWRBYAT.js} +560 -159
- package/dist/chunk-5MWRBYAT.js.map +1 -0
- package/dist/{chunk-J7FHVZII.cjs → chunk-6TTBEON3.cjs} +3074 -740
- package/dist/chunk-6TTBEON3.cjs.map +1 -0
- package/dist/{chunk-UMWZ4ZET.js → chunk-7NQ6AL3H.js} +4 -4
- package/dist/chunk-7NQ6AL3H.js.map +1 -0
- package/dist/{chunk-HWHGOVO6.cjs → chunk-E3QO3UET.cjs} +31 -23
- package/dist/chunk-E3QO3UET.cjs.map +1 -0
- package/dist/{chunk-H2KJHBW4.js → chunk-FJFULJZE.js} +2375 -191
- package/dist/chunk-FJFULJZE.js.map +1 -0
- package/dist/{chunk-Q6LFSAKV.js → chunk-FK3DGAIZ.js} +2657 -323
- package/dist/chunk-FK3DGAIZ.js.map +1 -0
- package/dist/chunk-GEDTJHAC.cjs.map +1 -1
- package/dist/{chunk-RFIBF2RR.js → chunk-H7FVMBUC.js} +138 -65
- package/dist/chunk-H7FVMBUC.js.map +1 -0
- package/dist/{chunk-DSMJRXCZ.cjs → chunk-HYSVSFNI.cjs} +931 -530
- package/dist/chunk-HYSVSFNI.cjs.map +1 -0
- package/dist/{chunk-35NBV2FT.cjs → chunk-KMYGRFZ6.cjs} +47 -24
- package/dist/chunk-KMYGRFZ6.cjs.map +1 -0
- package/dist/chunk-LQZQDBCD.cjs +5513 -0
- package/dist/chunk-LQZQDBCD.cjs.map +1 -0
- package/dist/{chunk-PM4XJE2Y.cjs → chunk-P3CPXAJ5.cjs} +76 -54
- package/dist/chunk-P3CPXAJ5.cjs.map +1 -0
- package/dist/{chunk-S5BKZZGM.cjs → chunk-S3QELJUE.cjs} +72 -56
- package/dist/chunk-S3QELJUE.cjs.map +1 -0
- package/dist/{chunk-PUKJP2Z5.js → chunk-TXFWSU5D.js} +31 -8
- package/dist/chunk-TXFWSU5D.js.map +1 -0
- package/dist/{chunk-76ZBTRG2.cjs → chunk-U4EQTDGN.cjs} +258 -218
- package/dist/chunk-U4EQTDGN.cjs.map +1 -0
- package/dist/chunk-UGLFDG7L.cjs.map +1 -1
- package/dist/{chunk-HYJJ2V2I.js → chunk-UTE5A36R.js} +483 -819
- package/dist/chunk-UTE5A36R.js.map +1 -0
- package/dist/{chunk-NFJ4P6ZZ.js → chunk-UZKQISRF.js} +17 -9
- package/dist/chunk-UZKQISRF.js.map +1 -0
- package/dist/{chunk-7KG3RTYS.js → chunk-VL5NXVCN.js} +281 -155
- package/dist/chunk-VL5NXVCN.js.map +1 -0
- package/dist/{chunk-CGBADIO5.cjs → chunk-WOMCXN2W.cjs} +328 -202
- package/dist/chunk-WOMCXN2W.cjs.map +1 -0
- package/dist/{chunk-3R3QVKY5.cjs → chunk-YDGMWH43.cjs} +397 -324
- package/dist/chunk-YDGMWH43.cjs.map +1 -0
- package/dist/{chunk-AGOVW7U6.js → chunk-YYVXRV3V.js} +72 -56
- package/dist/chunk-YYVXRV3V.js.map +1 -0
- package/dist/{chunk-M5RYMAFI.js → chunk-ZLNSH4UL.js} +71 -31
- package/dist/chunk-ZLNSH4UL.js.map +1 -0
- package/dist/{coerce-DRERzdve.d.cts → coerce-CUhHc3Tu.d.ts} +16 -8
- package/dist/{coerce-DP0vYu-x.d.ts → coerce-Ytt2Eiq9.d.cts} +16 -8
- package/dist/core/index.cjs +5 -5
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +9 -8
- package/dist/core/index.d.ts +9 -8
- package/dist/core/index.js +4 -4
- package/dist/generate/index.cjs +20 -8
- package/dist/generate/index.cjs.map +1 -1
- package/dist/generate/index.d.cts +105 -17
- package/dist/generate/index.d.ts +105 -17
- package/dist/generate/index.js +19 -7
- package/dist/{index-CL4b4gUQ.d.ts → index-5VJgKz_Q.d.cts} +6 -2
- package/dist/{index-B9QLziDe.d.cts → index-BLuDesVG.d.ts} +20 -13
- package/dist/{index-BHIUyjhZ.d.ts → index-BV6APVa6.d.cts} +20 -13
- package/dist/{index-BMweUlm5.d.cts → index-Bf0Sv8a9.d.ts} +6 -2
- package/dist/{index-Dw2DP7vm.d.ts → index-BkT21EMv.d.cts} +3 -2
- package/dist/{index-BL5N2Oyz.d.cts → index-C7KCaTRz.d.ts} +3 -2
- package/dist/{index-Cy15oTvh.d.ts → index-C9MYbuKS.d.cts} +7 -3
- package/dist/{index-Cy15oTvh.d.cts → index-C9MYbuKS.d.ts} +7 -3
- package/dist/{index-BNSM-DSk.d.cts → index-DVInzCDS.d.cts} +533 -28
- package/dist/{index-9eoQs2C1.d.ts → index-Dg-SAfhz.d.ts} +6 -4
- package/dist/{index-BJgP97N1.d.ts → index-jgeug9EA.d.ts} +533 -28
- package/dist/{index-cHvbYgJI.d.cts → index-pQihL4z7.d.cts} +6 -4
- package/dist/index.cjs +49 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +55 -19
- package/dist/{masks-Cc7-MzzY.d.ts → masks-BnzXnBj0.d.cts} +3 -2
- package/dist/{masks-pADfTOiD.d.cts → masks-tycmkrgs.d.ts} +3 -2
- package/dist/model/index.cjs +12 -12
- package/dist/model/index.cjs.map +1 -1
- package/dist/model/index.d.cts +259 -48
- package/dist/model/index.d.ts +259 -48
- package/dist/model/index.js +11 -11
- package/dist/{positional-DJgs6ltD.d.ts → positional-CscpxtlE.d.cts} +3 -2
- package/dist/{positional-DMZer-FM.d.cts → positional-DLnfUgqG.d.ts} +3 -2
- package/dist/{index-BRMbPkHE.d.ts → profile-B4WqcM4H.d.ts} +85 -610
- package/dist/{index-DGCNKAUr.d.cts → profile-BJd1XkPB.d.cts} +85 -610
- package/dist/theory/index.cjs +5 -5
- package/dist/theory/index.cjs.map +1 -1
- package/dist/theory/index.d.cts +18 -14
- package/dist/theory/index.d.ts +18 -14
- package/dist/theory/index.js +4 -4
- package/dist/{index-CJBBiAmU.d.ts → types-7mGFwvMm.d.ts} +1210 -31
- package/dist/{index-BBWNZS0f.d.cts → types-_ofpb2be.d.cts} +1210 -31
- package/package.json +13 -13
- package/dist/chunk-35NBV2FT.cjs.map +0 -1
- package/dist/chunk-3R3QVKY5.cjs.map +0 -1
- package/dist/chunk-76ZBTRG2.cjs.map +0 -1
- package/dist/chunk-7KG3RTYS.js.map +0 -1
- package/dist/chunk-AGOVW7U6.js.map +0 -1
- package/dist/chunk-CGBADIO5.cjs.map +0 -1
- package/dist/chunk-DSMJRXCZ.cjs.map +0 -1
- package/dist/chunk-FBH75DAY.js.map +0 -1
- package/dist/chunk-H2KJHBW4.js.map +0 -1
- package/dist/chunk-HPVSH7SF.cjs.map +0 -1
- package/dist/chunk-HWHGOVO6.cjs.map +0 -1
- package/dist/chunk-HYJJ2V2I.js.map +0 -1
- package/dist/chunk-J7FHVZII.cjs.map +0 -1
- package/dist/chunk-M5RYMAFI.js.map +0 -1
- package/dist/chunk-NB25P3EH.js.map +0 -1
- package/dist/chunk-NFJ4P6ZZ.js.map +0 -1
- package/dist/chunk-NM7UAMC3.cjs.map +0 -1
- package/dist/chunk-PM4XJE2Y.cjs.map +0 -1
- package/dist/chunk-PUKJP2Z5.js.map +0 -1
- package/dist/chunk-Q6LFSAKV.js.map +0 -1
- package/dist/chunk-RFIBF2RR.js.map +0 -1
- package/dist/chunk-S5BKZZGM.cjs.map +0 -1
- package/dist/chunk-SGLEQVJH.cjs +0 -3329
- package/dist/chunk-SGLEQVJH.cjs.map +0 -1
- package/dist/chunk-UMWZ4ZET.js.map +0 -1
package/NOTICE
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
libcantus
|
|
2
|
+
Copyright the libcantus authors
|
|
3
|
+
|
|
4
|
+
This product includes software developed as part of the libcantus project,
|
|
5
|
+
licensed under the Apache License, Version 2.0. See LICENSE.
|
|
6
|
+
|
|
7
|
+
--------------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
Third-party assets
|
|
10
|
+
|
|
11
|
+
The notated figures under docs/images embed glyph outlines (clefs, noteheads,
|
|
12
|
+
accidentals and the brace) taken from the Bravura music font:
|
|
13
|
+
|
|
14
|
+
Bravura
|
|
15
|
+
Copyright (c) 2015 Steinberg Media Technologies GmbH
|
|
16
|
+
Licensed under the SIL Open Font License, Version 1.1
|
|
17
|
+
https://github.com/steinbergmedia/bravura
|
|
18
|
+
|
|
19
|
+
The outlines are embedded as SVG paths so that the figures render without
|
|
20
|
+
loading a font. Bravura itself is not redistributed, and no part of this
|
|
21
|
+
project is licensed under the SIL Open Font License.
|
|
22
|
+
|
|
23
|
+
--------------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
Math.log2, Math.exp and Math.pow (src/js/ieee754.cpp)
|
|
26
|
+
|
|
27
|
+
src/js/ieee754.cpp is ported from V8's src/base/ieee754.cc (tag 12.4.254.21),
|
|
28
|
+
which is adapted from fdlibm and FreeBSD msun:
|
|
29
|
+
|
|
30
|
+
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
31
|
+
|
|
32
|
+
Developed at SunSoft, a Sun Microsystems, Inc. business.
|
|
33
|
+
Permission to use, copy, modify, and distribute this
|
|
34
|
+
software is freely granted, provided that this notice
|
|
35
|
+
is preserved.
|
|
36
|
+
|
|
37
|
+
Copyright 2016 the V8 project authors. All rights reserved.
|
|
38
|
+
|
|
39
|
+
Redistribution and use in source and binary forms, with or without
|
|
40
|
+
modification, are permitted provided that the following conditions are
|
|
41
|
+
met:
|
|
42
|
+
|
|
43
|
+
* Redistributions of source code must retain the above copyright
|
|
44
|
+
notice, this list of conditions and the following disclaimer.
|
|
45
|
+
* Redistributions in binary form must reproduce the above
|
|
46
|
+
copyright notice, this list of conditions and the following
|
|
47
|
+
disclaimer in the documentation and/or other materials provided
|
|
48
|
+
with the distribution.
|
|
49
|
+
* Neither the name of Google Inc. nor the names of its
|
|
50
|
+
contributors may be used to endorse or promote products derived
|
|
51
|
+
from this software without specific prior written permission.
|
|
52
|
+
|
|
53
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
54
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
55
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
56
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
57
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
58
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
59
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
60
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
61
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
62
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
63
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Pure-TypeScript music theory for MIDI note events. Recover the harmony from note
|
|
|
10
10
|
[](https://nodejs.org/)
|
|
11
11
|
[](https://libraz.github.io/libcantus/)
|
|
12
12
|
|
|
13
|
-

|
|
13
|
+

|
|
14
14
|
|
|
15
15
|
The library sits between software that already holds notes or chord symbols — a DAW project, a MIDI parser, a practice tool — and what those notes mean harmonically. Note events go in, the harmony comes out, and the generators write against the harmony that was just read.
|
|
16
16
|
|
|
@@ -35,6 +35,10 @@ Composer.of({ key: chords.key, bpm: 120, seed: 1 }).bass(chords, { style: 'walki
|
|
|
35
35
|
|
|
36
36
|
Chord boundaries are searched for rather than assumed, and so is the key, so a piece that modulates is not read against the key it started in. Answers carry their evidence: a chord analysis, a cadence and a Roman numeral each come with a `rationale` and the readings they turned down, and where the input cannot settle a question the field comes back `null` rather than a plausible guess.
|
|
37
37
|
|
|
38
|
+
Another piece is read the same way and measured against the first dimension by dimension — form, harmony, motif derivation, rhythm — never folded into one score: `analyzeReference` compresses a piece into a portable profile, and `compareReferences` reads two of them against each other.
|
|
39
|
+
|
|
40
|
+
That same profile doubles as a target for new material: `deriveCompositionPlan` turns it into a `CompositionPlan` — form, harmony and a motif derivation forest stated as instructions a generator can follow exactly — and `generateMelody` writes a melody to it, with `evaluateComposition` reading the result back against the plan. See [Generating from a reference](https://github.com/libraz/libcantus/blob/main/docs/en/generation.md#generating-from-a-reference).
|
|
41
|
+
|
|
38
42
|
## Use cases
|
|
39
43
|
|
|
40
44
|
| Use case | What it does | Worked guide |
|
|
@@ -57,6 +61,8 @@ yarn add @libraz/libcantus
|
|
|
57
61
|
|
|
58
62
|
The package root exports the whole API. `@libraz/libcantus/core`, `/theory`, `/analyze`, `/generate` and `/model` are narrower import boundaries onto the same symbols, and every path ships an ESM and a CommonJS build.
|
|
59
63
|
|
|
64
|
+
This package is the TypeScript reference implementation, synchronous and dependency-free. The same API is also available from a C++ core through WebAssembly, Python and a command-line tool; see [the repository](https://github.com/libraz/libcantus) and [Packages](https://github.com/libraz/libcantus/blob/main/docs/en/packages.md).
|
|
65
|
+
|
|
60
66
|
## Documentation
|
|
61
67
|
|
|
62
68
|
New to music theory? [The primer](https://github.com/libraz/libcantus/blob/main/docs/en/primer/index.md) teaches the concepts this API is built on — pitch and intervals, scales and keys, chords, harmony, voices, rhythm and meter — for a reader who writes TypeScript rather than scores.
|
package/README_ja.md
CHANGED
|
@@ -10,7 +10,7 @@ MIDI ノートイベントのための、TypeScript 製の音楽理論ライブ
|
|
|
10
10
|
[](https://nodejs.org/)
|
|
11
11
|
[](https://libraz.github.io/libcantus/)
|
|
12
12
|
|
|
13
|
-

|
|
13
|
+

|
|
14
14
|
|
|
15
15
|
このライブラリは、すでにノートやコード記号を持っているソフトウェア(DAW のプロジェクト、MIDI パーサー、練習支援ツールなど)と、その音が和声的に何を意味するかとの間を埋めます。ノートイベントを渡すと和声が求まり、ジェネレーターはいま読み取ったその和声に沿ってパートを書きます。
|
|
16
16
|
|
|
@@ -35,17 +35,21 @@ Composer.of({ key: chords.key, bpm: 120, seed: 1 }).bass(chords, { style: 'walki
|
|
|
35
35
|
|
|
36
36
|
コードの境界は決め打ちせずに探索し、キーも同様に探します。転調する曲を、冒頭のキーのまま読み続けることはありません。答えには根拠が伴います。コード分析・終止・ローマ数字はいずれも `rationale` と、退けた候補を併せて返し、入力だけでは決まらない項目は、もっともらしい推測ではなく `null` を返します。
|
|
37
37
|
|
|
38
|
+
もう1曲も同じように読み取り、フォーム・和声・モチーフの派生・リズムを次元ごとに比較できます。単一のスコアにまとめることはありません。`analyzeReference` が曲を持ち運び可能なプロファイルに圧縮し、`compareReferences` がその2つを突き合わせます。
|
|
39
|
+
|
|
40
|
+
そのプロファイルは、新しい素材を書くための目標にもなります。`deriveCompositionPlan` はプロファイルを `CompositionPlan` に変換します。フォーム・和声・モチーフの派生の森を、ジェネレータがそのまま辿れる指示として持つ値です。`generateMelody` はその計画に沿って旋律を書き、`evaluateComposition` は結果を計画に照らして読み返します。[リファレンスからの生成](https://github.com/libraz/libcantus/blob/main/docs/ja/generation.md#リファレンスからの生成)を参照してください。
|
|
41
|
+
|
|
38
42
|
## ユースケース
|
|
39
43
|
|
|
40
44
|
| ユースケース | 内容 | 実例のガイド |
|
|
41
45
|
|---|---|---|
|
|
42
|
-
| DAW のアシスタント | トラックから和声を読み取り、それに沿ってベースラインを書く。 | [DAW ワークフロー](docs/ja/use-cases/daw-workflow.md) |
|
|
43
|
-
| 楽曲アナライザー | 1 つのスコアから調区間、終止形、和声的な還元、フレーズ、セクション、モチーフを得る。 | [楽曲の解析](docs/ja/use-cases/piece-analysis.md) |
|
|
44
|
-
| 転調レポート | 転調を、軸和音・確信度・調同士の関係とともに提示する。 | [転調レポート](docs/ja/use-cases/modulation-report.md) |
|
|
45
|
-
| 和声課題のチェッカー | 声部書法と種目対位法の違反を、違反した声部と破った規則つきで報告する。 | [和声課題のチェック](docs/ja/use-cases/harmony-exercise-checker.md) |
|
|
46
|
-
| 自動生成アレンジ | シードを固定した 1 つのコンポーザーがコード進行・各パート・ドラムを書き、演奏可能性を確認する。 | [生成によるアレンジ](docs/ja/use-cases/generative-arrangement.md) |
|
|
47
|
-
| コード譜の取り込み | 打ち込んだコード記号をタイムライン、ヴォイシング、ベースラインに変換する。 | [コード譜の取り込み](docs/ja/use-cases/chord-chart-import.md) |
|
|
48
|
-
| パート譜の準備 | パートを楽器に合わせ、その奏者が読む音高で書き出す。 | [パート譜の準備](docs/ja/use-cases/part-preparation.md) |
|
|
46
|
+
| DAW のアシスタント | トラックから和声を読み取り、それに沿ってベースラインを書く。 | [DAW ワークフロー](https://github.com/libraz/libcantus/blob/main/docs/ja/use-cases/daw-workflow.md) |
|
|
47
|
+
| 楽曲アナライザー | 1 つのスコアから調区間、終止形、和声的な還元、フレーズ、セクション、モチーフを得る。 | [楽曲の解析](https://github.com/libraz/libcantus/blob/main/docs/ja/use-cases/piece-analysis.md) |
|
|
48
|
+
| 転調レポート | 転調を、軸和音・確信度・調同士の関係とともに提示する。 | [転調レポート](https://github.com/libraz/libcantus/blob/main/docs/ja/use-cases/modulation-report.md) |
|
|
49
|
+
| 和声課題のチェッカー | 声部書法と種目対位法の違反を、違反した声部と破った規則つきで報告する。 | [和声課題のチェック](https://github.com/libraz/libcantus/blob/main/docs/ja/use-cases/harmony-exercise-checker.md) |
|
|
50
|
+
| 自動生成アレンジ | シードを固定した 1 つのコンポーザーがコード進行・各パート・ドラムを書き、演奏可能性を確認する。 | [生成によるアレンジ](https://github.com/libraz/libcantus/blob/main/docs/ja/use-cases/generative-arrangement.md) |
|
|
51
|
+
| コード譜の取り込み | 打ち込んだコード記号をタイムライン、ヴォイシング、ベースラインに変換する。 | [コード譜の取り込み](https://github.com/libraz/libcantus/blob/main/docs/ja/use-cases/chord-chart-import.md) |
|
|
52
|
+
| パート譜の準備 | パートを楽器に合わせ、その奏者が読む音高で書き出す。 | [パート譜の準備](https://github.com/libraz/libcantus/blob/main/docs/ja/use-cases/part-preparation.md) |
|
|
49
53
|
|
|
50
54
|
## インストール
|
|
51
55
|
|
|
@@ -57,11 +61,13 @@ yarn add @libraz/libcantus
|
|
|
57
61
|
|
|
58
62
|
パッケージのルートから API 全体を公開しています。`@libraz/libcantus/core`、`/theory`、`/analyze`、`/generate`、`/model` は同じシンボル群に対する、より狭い読み込み境界です。いずれのパスも ESM と CommonJS の両方のビルドを同梱しています。
|
|
59
63
|
|
|
64
|
+
このパッケージは TypeScript によるリファレンス実装で、同期 API であり、依存パッケージはありません。同じ API は C++ コアを使う WebAssembly、Python、コマンドラインツールからも使えます。詳しくは[リポジトリ](https://github.com/libraz/libcantus)と[パッケージ構成](https://github.com/libraz/libcantus/blob/main/docs/ja/packages.md)を参照してください。
|
|
65
|
+
|
|
60
66
|
## ドキュメント
|
|
61
67
|
|
|
62
|
-
音楽理論にはじめて触れる場合は、[入門ガイド](docs/ja/primer/index.md)から始めてください。この API が土台にしている考え方 — 音高と音程、音階と調、和音、和声、声部、リズムと拍子 — を、楽譜ではなく TypeScript を書く読者に向けて説明しています。
|
|
68
|
+
音楽理論にはじめて触れる場合は、[入門ガイド](https://github.com/libraz/libcantus/blob/main/docs/ja/primer/index.md)から始めてください。この API が土台にしている考え方 — 音高と音程、音階と調、和音、和声、声部、リズムと拍子 — を、楽譜ではなく TypeScript を書く読者に向けて説明しています。
|
|
63
69
|
|
|
64
|
-
そうでなければ、[はじめに](docs/ja/introduction.md)と[使いはじめる](docs/ja/getting-started.md)から読んでください。各分野のガイドとリファレンスはそこから辿れます。ガイド中の `ts` の例はすべてテストスイートで実行され、行末コメントがリテラルを名指していれば(em ダッシュに続けて理由が書かれていてもかまいません)実際の戻り値と照合されます。
|
|
70
|
+
そうでなければ、[はじめに](https://github.com/libraz/libcantus/blob/main/docs/ja/introduction.md)と[使いはじめる](https://github.com/libraz/libcantus/blob/main/docs/ja/getting-started.md)から読んでください。各分野のガイドとリファレンスはそこから辿れます。ガイド中の `ts` の例はすべてテストスイートで実行され、行末コメントがリテラルを名指していれば(em ダッシュに続けて理由が書かれていてもかまいません)実際の戻り値と照合されます。
|
|
65
71
|
|
|
66
72
|
## できないこと
|
|
67
73
|
|
|
@@ -70,7 +76,7 @@ yarn add @libraz/libcantus
|
|
|
70
76
|
- **旋法体系そのものは扱いません。** `WORLD_SCALES` が記録するのは、その伝統が名前を与えている音の素材 — ターット、マカームの音組織、日本の五音音階 — であって、その上に築かれた語法ではありません。
|
|
71
77
|
- **コーパスは同梱しません。** 統計を取るためのデータは含みません。
|
|
72
78
|
|
|
73
|
-
残りは[疑問と制限](docs/ja/faq.md)にまとめています。機能和声の読みが適用できない場合や、エンジンが推測しないことについてもそこで扱います。
|
|
79
|
+
残りは[疑問と制限](https://github.com/libraz/libcantus/blob/main/docs/ja/faq.md)にまとめています。機能和声の読みが適用できない場合や、エンジンが推測しないことについてもそこで扱います。
|
|
74
80
|
|
|
75
81
|
## ライセンス
|
|
76
82
|
|
package/dist/analyze/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkE3QO3UETcjs = require('../chunk-E3QO3UET.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -13,12 +13,12 @@ var _chunkHWHGOVO6cjs = require('../chunk-HWHGOVO6.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
var _chunk3MDOEFIQcjs = require('../chunk-3MDOEFIQ.cjs');
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
|
|
21
|
-
var _chunkHPVSH7SFcjs = require('../chunk-HPVSH7SF.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -52,12 +52,8 @@ var _chunkHPVSH7SFcjs = require('../chunk-HPVSH7SF.cjs');
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
var _chunkSGLEQVJHcjs = require('../chunk-SGLEQVJH.cjs');
|
|
56
|
-
require('../chunk-35NBV2FT.cjs');
|
|
57
55
|
|
|
58
56
|
|
|
59
|
-
var _chunk3R3QVKY5cjs = require('../chunk-3R3QVKY5.cjs');
|
|
60
|
-
require('../chunk-S5BKZZGM.cjs');
|
|
61
57
|
|
|
62
58
|
|
|
63
59
|
|
|
@@ -68,8 +64,12 @@ require('../chunk-S5BKZZGM.cjs');
|
|
|
68
64
|
|
|
69
65
|
|
|
70
66
|
|
|
67
|
+
var _chunkLQZQDBCDcjs = require('../chunk-LQZQDBCD.cjs');
|
|
68
|
+
require('../chunk-KMYGRFZ6.cjs');
|
|
71
69
|
|
|
72
70
|
|
|
71
|
+
var _chunkYDGMWH43cjs = require('../chunk-YDGMWH43.cjs');
|
|
72
|
+
require('../chunk-S3QELJUE.cjs');
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
|
|
@@ -109,5 +109,29 @@ require('../chunk-S5BKZZGM.cjs');
|
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
exports.CADENCE_TYPES = _chunkLQZQDBCDcjs.CADENCE_TYPES; exports.HARMONIC_FUNCTIONS = _chunkLQZQDBCDcjs.HARMONIC_FUNCTIONS; exports.MELODIC_CONTOUR_SHAPES = _chunkLQZQDBCDcjs.MELODIC_CONTOUR_SHAPES; exports.MODAL_SCALE_NAMES = _chunkLQZQDBCDcjs.MODAL_SCALE_NAMES; exports.MOTIF_RELATION_KINDS = _chunkLQZQDBCDcjs.MOTIF_RELATION_KINDS; exports.NoteSafety = _chunkYDGMWH43cjs.NoteSafety; exports.REDUCTION_LEVELS = _chunkLQZQDBCDcjs.REDUCTION_LEVELS; exports.REFERENCE_PROFILE_VERSION = _chunkLQZQDBCDcjs.REFERENCE_PROFILE_VERSION; exports.RHYTHM_IOI_BINS = _chunkLQZQDBCDcjs.RHYTHM_IOI_BINS; exports.analyzeArrangement = _chunk3MDOEFIQcjs.analyzeArrangement; exports.analyzeChord = _chunkLQZQDBCDcjs.analyzeChord; exports.analyzePolyphony = _chunk3MDOEFIQcjs.analyzePolyphony; exports.analyzeReference = _chunk3MDOEFIQcjs.analyzeReference; exports.analyzeRhythm = _chunkLQZQDBCDcjs.analyzeRhythm; exports.analyzeVoice = _chunkLQZQDBCDcjs.analyzeVoice; exports.assertChordTimeline = _chunkLQZQDBCDcjs.assertChordTimeline; exports.assertReferenceProfile = _chunkLQZQDBCDcjs.assertReferenceProfile; exports.augmentedSixthChord = _chunkLQZQDBCDcjs.augmentedSixthChord; exports.augmentedSixthFromPitchClasses = _chunkLQZQDBCDcjs.augmentedSixthFromPitchClasses; exports.augmentedSixthKind = _chunkLQZQDBCDcjs.augmentedSixthKind; exports.borrowedSource = _chunkLQZQDBCDcjs.borrowedSource; exports.chordTimelineFromChords = _chunkLQZQDBCDcjs.chordTimelineFromChords; exports.chordTimelineFromNotes = _chunkLQZQDBCDcjs.chordTimelineFromNotes; exports.chordToRoman = _chunkLQZQDBCDcjs.chordToRoman; exports.compareMelodies = _chunkLQZQDBCDcjs.compareMelodies; exports.compareReferences = _chunk3MDOEFIQcjs.compareReferences; exports.createArrangementSession = _chunk3MDOEFIQcjs.createArrangementSession; exports.detectCadence = _chunkLQZQDBCDcjs.detectCadence; exports.detectCadences = _chunkLQZQDBCDcjs.detectCadences; exports.detectChord = _chunkLQZQDBCDcjs.detectChord; exports.detectChordBest = _chunkLQZQDBCDcjs.detectChordBest; exports.detectKey = _chunkLQZQDBCDcjs.detectKey; exports.detectKeyBest = _chunkLQZQDBCDcjs.detectKeyBest; exports.detectKeyFromNotes = _chunkLQZQDBCDcjs.detectKeyFromNotes; exports.detectModulations = _chunkLQZQDBCDcjs.detectModulations; exports.explainRoman = _chunkLQZQDBCDcjs.explainRoman; exports.extractMotifs = _chunkLQZQDBCDcjs.extractMotifs; exports.functionOf = _chunkLQZQDBCDcjs.functionOf; exports.hypermeter = _chunk3MDOEFIQcjs.hypermeter; exports.isBorrowedChord = _chunkLQZQDBCDcjs.isBorrowedChord; exports.isDiatonic = _chunkLQZQDBCDcjs.isDiatonic; exports.isMinorKey = _chunkLQZQDBCDcjs.isMinorKey; exports.keyTimelineFromNotes = _chunkLQZQDBCDcjs.keyTimelineFromNotes; exports.melodicContour = _chunkLQZQDBCDcjs.melodicContour; exports.melodicSimilarity = _chunkLQZQDBCDcjs.melodicSimilarity; exports.motifFromNotes = _chunkLQZQDBCDcjs.motifFromNotes; exports.motifGraph = _chunkLQZQDBCDcjs.motifGraph; exports.phrasesFromTimeline = _chunk3MDOEFIQcjs.phrasesFromTimeline; exports.pivotChords = _chunkLQZQDBCDcjs.pivotChords; exports.prevailingKeyOf = _chunkLQZQDBCDcjs.prevailingKeyOf; exports.reduceProgression = _chunkLQZQDBCDcjs.reduceProgression; exports.relateMotifs = _chunkLQZQDBCDcjs.relateMotifs; exports.romanToChord = _chunkLQZQDBCDcjs.romanToChord; exports.secondaryDominant = _chunkLQZQDBCDcjs.secondaryDominant; exports.secondaryDominantOf = _chunkLQZQDBCDcjs.secondaryDominantOf; exports.sectionsFromNotes = _chunk3MDOEFIQcjs.sectionsFromNotes; exports.spellAugmentedSixth = _chunkLQZQDBCDcjs.spellAugmentedSixth; exports.spellLine = _chunkE3QO3UETcjs.spellLine; exports.structuralCadences = _chunk3MDOEFIQcjs.structuralCadences; exports.tensionCurve = _chunk3MDOEFIQcjs.tensionCurve; exports.tensionCurveFrom = _chunk3MDOEFIQcjs.tensionCurveFrom; exports.toVoiceNotes = _chunkLQZQDBCDcjs.toVoiceNotes;
|
|
113
137
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/libcantus/libcantus/dist/analyze/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/libcantus/libcantus/ts/dist/analyze/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,ixHAAC","file":"/home/runner/work/libcantus/libcantus/ts/dist/analyze/index.cjs"}
|
package/dist/analyze/index.d.cts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { i as NoteLike, h as NoteEvent, g as Note } from '../index-
|
|
2
|
-
export { a as Articulation, I as IntervalData, c as IntervalQualityLabel, e as KeyScale, S as SpelledInterval } from '../index-
|
|
3
|
-
export { M as MeterChange, b as MeterLike, c as MeterMap, T as TimeSignature } from '../index-
|
|
4
|
-
import { r as SpelledKeyLike } from '../coerce-
|
|
5
|
-
export { b as ChordData, c as ChordLike, d as ChordQuality, e as ChordSegment, g as ChordSpan, i as ChordToneRole, K as KeyLike, j as KeyRelation, k as KeyVariant, N as NoteSafety, l as PitchSpelling, n as ResolvedKey, o as SafetyProfile, s as SpelledKeyScale, V as VoiceSnapshot } from '../coerce-
|
|
6
|
-
export { r as ScaleName } from '../masks-
|
|
7
|
-
import {
|
|
8
|
-
export { A as AnalyzeChordOptions, a as AnalyzedNote, B as BorrowedSource, C as CadenceHit,
|
|
9
|
-
|
|
10
|
-
export { A as ArrangementAnalysis, a as ArrangementOptions, b as ArrangementSession, c as ArrangementTrack, d as AugmentedSixthKind, C as ChordMatch, e as Conflict, f as ConflictPartner, g as ContourDirection, D as DetectChordOptions, h as DetectKeyOptions, E as ExtractMotifsOptions, F as FormSection, i as FormSectionOptions, H as Hypermeter, j as HypermeterOptions, K as KeyMatch, M as MODAL_SCALE_NAMES, k as MelodicContour, l as MelodicContourShape, n as ModalCandidate, o as ModalScaleName, p as MotifData, q as MotifOccurrence, r as MotifRelation, s as MotifRelationKind, P as Phrase, t as PhraseOptions, u as PhraseSignal, R as ReduceProgressionOptions, v as ReducedChord, w as ReductionBasis, x as ReductionLevel, S as StructuralCadence, T as TensionPoint, y as TrackAnalysis, z as TrackEdit, B as TrackRole, G as analyzeArrangement, I as analyzePolyphony, J as augmentedSixthChord, L as augmentedSixthFromPitchClasses, N as augmentedSixthKind, O as createArrangementSession, Q as detectChord, U as detectChordBest, V as detectKey, W as detectKeyBest, X as detectKeyFromNotes, Y as extractMotifs, Z as hypermeter, _ as melodicContour, $ as motifFromNotes, a0 as phrasesFromTimeline, a1 as reduceProgression, a2 as relateMotifs, a3 as sectionsFromNotes, a4 as spellAugmentedSixth, a5 as structuralCadences, a6 as tensionCurve, a7 as tensionCurveFrom } from '../index-DGCNKAUr.cjs';
|
|
1
|
+
import { i as NoteLike, h as NoteEvent, g as Note } from '../index-C9MYbuKS.cjs';
|
|
2
|
+
export { a as Articulation, I as IntervalData, c as IntervalQualityLabel, e as KeyScale, S as SpelledInterval } from '../index-C9MYbuKS.cjs';
|
|
3
|
+
export { M as MeterChange, b as MeterLike, c as MeterMap, T as TimeSignature } from '../index-5VJgKz_Q.cjs';
|
|
4
|
+
import { r as SpelledKeyLike } from '../coerce-Ytt2Eiq9.cjs';
|
|
5
|
+
export { b as ChordData, c as ChordLike, d as ChordQuality, e as ChordSegment, g as ChordSpan, i as ChordToneRole, K as KeyLike, j as KeyRelation, k as KeyVariant, N as NoteSafety, l as PitchSpelling, n as ResolvedKey, o as SafetyProfile, s as SpelledKeyScale, V as VoiceSnapshot } from '../coerce-Ytt2Eiq9.cjs';
|
|
6
|
+
export { r as ScaleName } from '../masks-BnzXnBj0.cjs';
|
|
7
|
+
import { w as MelodicPhrase, a5 as ReferenceProfile, h as ChordTimeline } from '../types-_ofpb2be.cjs';
|
|
8
|
+
export { A as AnalyzeChordOptions, a as AnalyzedNote, B as BarPositionProfile, b as BorrowedSource, C as CADENCE_TYPES, c as CadenceHit, d as CadenceResult, e as CadenceType, f as ChordAnalysis, g as ChordSegmentation, i as ChordTimelineOptions, j as ChordTimelineResult, k as ChordToRomanOptions, l as ContourDirection, D as DetectCadenceOptions, E as ExplainRomanOptions, m as ExtractMotifsOptions, F as FormSection, n as FormSectionOptions, H as HARMONIC_FUNCTIONS, o as HarmonicFunction, I as IdentifiedVoiceNote, K as KeyContext, p as KeyProfileName, q as KeyProfilePair, r as KeyRegion, s as KeyTimelineOptions, M as MELODIC_CONTOUR_SHAPES, t as MOTIF_RELATION_KINDS, u as MelodicContour, v as MelodicContourShape, x as MotifData, y as MotifGraph, z as MotifGraphEdge, G as MotifGraphNode, J as MotifGraphOptions, L as MotifOccurrence, N as MotifRelation, O as MotifRelationKind, P as MotifRelationSummary, Q as PivotChord, R as REDUCTION_LEVELS, S as REFERENCE_PROFILE_VERSION, T as RHYTHM_IOI_BINS, U as ReduceProgressionOptions, V as ReducedChord, W as ReductionBasis, X as ReductionLevel, Y as ReferenceCadence, Z as ReferenceChord, _ as ReferenceForm, $ as ReferenceHarmony, a0 as ReferenceKeyRegion, a1 as ReferenceMelody, a2 as ReferenceMotif, a3 as ReferencePhrase, a4 as ReferencePhraseMelody, a6 as RejectedCandidate, a7 as RhythmAnalysis, a8 as RhythmAnalysisOptions, a9 as RomanExplanation, aa as SuspensionFigure, ab as TheoryLabel, ac as VoiceNote, ad as analyzeChord, ae as analyzeRhythm, af as analyzeVoice, ag as assertChordTimeline, ah as borrowedSource, ai as chordTimelineFromChords, aj as chordTimelineFromNotes, ak as chordToRoman, al as detectCadence, am as detectCadences, an as detectModulations, ao as explainRoman, ap as extractMotifs, aq as functionOf, ar as isBorrowedChord, as as isDiatonic, at as isMinorKey, au as keyTimelineFromNotes, av as melodicContour, aw as motifFromNotes, ax as motifGraph, ay as pivotChords, az as prevailingKeyOf, aA as reduceProgression, aB as relateMotifs, aC as romanToChord, aD as secondaryDominant, aE as secondaryDominantOf, aF as sectionsFromNotes, aG as toVoiceNotes } from '../types-_ofpb2be.cjs';
|
|
9
|
+
export { A as ArrangementAnalysis, a as ArrangementOptions, b as ArrangementSession, c as ArrangementTrack, d as AugmentedSixthKind, C as ChordMatch, e as Conflict, f as ConflictPartner, D as DetectChordOptions, g as DetectKeyOptions, H as Hypermeter, h as HypermeterOptions, K as KeyMatch, M as MODAL_SCALE_NAMES, i as ModalCandidate, j as ModalScaleName, P as Phrase, k as PhraseOptions, l as PhraseSignal, R as ReferenceProfileOptions, S as StructuralCadence, T as TensionPoint, m as TrackAnalysis, n as TrackEdit, o as TrackRole, p as analyzeArrangement, q as analyzePolyphony, r as analyzeReference, s as augmentedSixthChord, t as augmentedSixthFromPitchClasses, u as augmentedSixthKind, v as createArrangementSession, w as detectChord, x as detectChordBest, y as detectKey, z as detectKeyBest, B as detectKeyFromNotes, E as hypermeter, F as phrasesFromTimeline, G as spellAugmentedSixth, I as structuralCadences, J as tensionCurve, L as tensionCurveFrom } from '../profile-BJd1XkPB.cjs';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* How alike two phrases are, when they stand in no named relation.
|
|
@@ -95,6 +94,153 @@ declare function compareMelodies(a: MelodicPhrase, b: MelodicPhrase): MelodicCom
|
|
|
95
94
|
*/
|
|
96
95
|
declare function melodicSimilarity(a: MelodicPhrase, b: MelodicPhrase): number;
|
|
97
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Comparing two {@link ReferenceProfile}s dimension by dimension.
|
|
99
|
+
*
|
|
100
|
+
* The answer is never folded into one number: each field names the aspect it
|
|
101
|
+
* measures, so "a different song built the same way" reads as high structural
|
|
102
|
+
* fields beside a low surface one. Only `melody.surfaceSimilarity` reads the
|
|
103
|
+
* motifs' intervals; every other field is invariant under transposition, tempo
|
|
104
|
+
* and a change of motif intervals.
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Options for {@link compareReferences}.
|
|
109
|
+
*
|
|
110
|
+
* @category Arrangement & Analysis
|
|
111
|
+
*/
|
|
112
|
+
type ReferenceComparisonOptions = {
|
|
113
|
+
/**
|
|
114
|
+
* Upper bound on the cells of the progression alignment.
|
|
115
|
+
*
|
|
116
|
+
* @defaultValue {@link DEFAULT_GENERATION_BUDGET}
|
|
117
|
+
*/
|
|
118
|
+
budget?: number;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* How alike two profiled pieces are, one field per aspect.
|
|
122
|
+
*
|
|
123
|
+
* Every value is in [0, 1] and symmetric in the two profiles. A value is
|
|
124
|
+
* `null` when neither profile has anything to measure it on, and 0 when only
|
|
125
|
+
* one does.
|
|
126
|
+
*
|
|
127
|
+
* @category Arrangement & Analysis
|
|
128
|
+
*/
|
|
129
|
+
type ReferenceComparison = {
|
|
130
|
+
/** Formal layout. */
|
|
131
|
+
form: {
|
|
132
|
+
/** Likeness of the section-label sequences. */
|
|
133
|
+
sectionSequenceSimilarity: number | null;
|
|
134
|
+
/** Likeness of the phrase-length sequences. */
|
|
135
|
+
phraseLengthSimilarity: number | null;
|
|
136
|
+
};
|
|
137
|
+
/** Harmony. */
|
|
138
|
+
harmony: {
|
|
139
|
+
/** Likeness of the structural Roman-numeral progressions. */
|
|
140
|
+
progressionSimilarity: number | null;
|
|
141
|
+
/** Likeness of how long each harmonic function is held. */
|
|
142
|
+
functionSimilarity: number | null;
|
|
143
|
+
/** Likeness of the phrase-by-phrase cadence sequences. */
|
|
144
|
+
cadenceSimilarity: number | null;
|
|
145
|
+
/** Likeness of the key plans, read relative to each piece's first key. */
|
|
146
|
+
keyPlanSimilarity: number | null;
|
|
147
|
+
/** Likeness of where in the bar the chords change. */
|
|
148
|
+
harmonicRhythmOnsetSimilarity: number | null;
|
|
149
|
+
/** Likeness of how often the chords change. */
|
|
150
|
+
harmonicRhythmDensitySimilarity: number | null;
|
|
151
|
+
};
|
|
152
|
+
/** Melody. */
|
|
153
|
+
melody: {
|
|
154
|
+
/** Likeness of the motifs' interval content: the one field that reads the surface. */
|
|
155
|
+
surfaceSimilarity: number | null;
|
|
156
|
+
/** Likeness of how the motifs derive from one another. */
|
|
157
|
+
motifStructureSimilarity: number | null;
|
|
158
|
+
/** Likeness of the phrases' melodic outlines, each scaled by its own range. */
|
|
159
|
+
contourSimilarity: number | null;
|
|
160
|
+
/** Likeness of the phrases' registers, each relative to its piece's melodic mean. */
|
|
161
|
+
registerSimilarity: number | null;
|
|
162
|
+
};
|
|
163
|
+
/** Melodic rhythm. */
|
|
164
|
+
rhythm: {
|
|
165
|
+
/** Likeness of where in the bar the melody's onsets fall. */
|
|
166
|
+
onsetSimilarity: number | null;
|
|
167
|
+
/** Likeness of the melodies' onsets per bar. */
|
|
168
|
+
densitySimilarity: number | null;
|
|
169
|
+
/** Likeness of the melodies' inter-onset-interval distributions. */
|
|
170
|
+
durationSimilarity: number | null;
|
|
171
|
+
/** Likeness of the melodies' syncopation. */
|
|
172
|
+
syncopationSimilarity: number | null;
|
|
173
|
+
};
|
|
174
|
+
/** The two most and the two least alike fields, by name. */
|
|
175
|
+
rationale: string;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Compare two profiled pieces aspect by aspect: form, harmony, melody and
|
|
179
|
+
* melodic rhythm.
|
|
180
|
+
*
|
|
181
|
+
* Sequences — sections, phrase lengths, cadences, key plans, structural
|
|
182
|
+
* chords, phrase contours and registers — are aligned by a graded edit
|
|
183
|
+
* distance; distributions — harmonic function, onset placement, inter-onset
|
|
184
|
+
* intervals, motif derivations — by histogram intersection. The surface field
|
|
185
|
+
* compares the motifs' interval cells, so a transposition of the same piece
|
|
186
|
+
* reads 1 on every field. No aggregate is returned: which aspects agree is the
|
|
187
|
+
* answer.
|
|
188
|
+
*
|
|
189
|
+
* @param a The first profile.
|
|
190
|
+
* @param b The second profile.
|
|
191
|
+
* @param opts The work budget.
|
|
192
|
+
* @returns One likeness per aspect, and a rationale naming the extremes.
|
|
193
|
+
* @throws {InvalidInputError} If either profile or the options cannot be read.
|
|
194
|
+
* @throws {BudgetExceededError} If the progression alignment would exceed the budget.
|
|
195
|
+
* @category Arrangement & Analysis
|
|
196
|
+
*/
|
|
197
|
+
declare function compareReferences(a: ReferenceProfile, b: ReferenceProfile, opts?: ReferenceComparisonOptions): ReferenceComparison;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Boundary validation for {@link ReferenceProfile}: a caller can hand this a
|
|
201
|
+
* value restored from JSON, a config file, or a plugin host, and every field
|
|
202
|
+
* is checked before anything downstream reads it. A violation names the path
|
|
203
|
+
* to the offending field, so a malformed document is diagnosed at the field
|
|
204
|
+
* that is wrong rather than wherever the first bad read happens to land.
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Reject a value that is not a {@link ReferenceProfile}.
|
|
209
|
+
*
|
|
210
|
+
* A profile is the shape a caller's stored JSON, a config file, or a plugin
|
|
211
|
+
* host most plausibly hands back malformed: a missing field, a distribution
|
|
212
|
+
* that no longer sums to 1, an index a later edit left dangling, a numeral no
|
|
213
|
+
* reader can parse. Every field is checked before {@link compareReferences} or
|
|
214
|
+
* a caller's own code reads it, and a violation names the path to the field
|
|
215
|
+
* that is wrong.
|
|
216
|
+
*
|
|
217
|
+
* @param value The value to check.
|
|
218
|
+
* @param name What the value is, for the error message.
|
|
219
|
+
* @returns The same profile.
|
|
220
|
+
* @throws {InvalidInputError} If the value is not a valid reference profile.
|
|
221
|
+
* @example
|
|
222
|
+
* ```ts
|
|
223
|
+
* import { assertReferenceProfile } from '@libraz/libcantus';
|
|
224
|
+
* const emptyRhythm = {
|
|
225
|
+
* startBeat: 0, endBeat: 0, bars: 0, onsets: 0, onsetDensity: 0,
|
|
226
|
+
* barOnsets: [], onsetLevels: [0, 0, 0, 0, 0, 0], barPositions: [],
|
|
227
|
+
* interOnsetShares: new Array(17).fill(0), restRatio: 0, syncopation: 0,
|
|
228
|
+
* offGridRatio: 0, rationale: 'nothing sounds',
|
|
229
|
+
* };
|
|
230
|
+
* const profile = {
|
|
231
|
+
* profileVersion: 1,
|
|
232
|
+
* span: { startBeat: 0, endBeat: 0, bars: 0 },
|
|
233
|
+
* meters: [{ startBeat: 0, ts: { numerator: 4, denominator: 4 } }],
|
|
234
|
+
* form: { hypermeter: { groupBars: 1, confidence: 0 }, sections: [], phrases: [] },
|
|
235
|
+
* harmony: { keys: [], chords: [], rhythm: emptyRhythm },
|
|
236
|
+
* melody: { register: null, shape: null, motifs: [], graph: { nodes: [], edges: [] }, rhythm: emptyRhythm },
|
|
237
|
+
* };
|
|
238
|
+
* assertReferenceProfile(profile); // the profile, unchanged
|
|
239
|
+
* ```
|
|
240
|
+
* @category Arrangement & Analysis
|
|
241
|
+
*/
|
|
242
|
+
declare function assertReferenceProfile(value: unknown, name?: string): ReferenceProfile;
|
|
243
|
+
|
|
98
244
|
/**
|
|
99
245
|
* Line spelling: name every note of a melodic line in one pass.
|
|
100
246
|
*
|
|
@@ -144,8 +290,9 @@ type SpellLineOptions = {
|
|
|
144
290
|
* 1. A note the sounding chord names takes that chord's spelling of it, even
|
|
145
291
|
* when the key spells the pitch otherwise — the seventh of a Db7 reads Cb in
|
|
146
292
|
* C major, not B.
|
|
147
|
-
* 2. Anything else the key
|
|
148
|
-
*
|
|
293
|
+
* 2. Anything else the key spells as its own — a scale tone, or the raised
|
|
294
|
+
* sixth and seventh of a minor key — keeps its key spelling, so the leading
|
|
295
|
+
* tone of A minor reads G# even where the line falls through it.
|
|
149
296
|
* 3. A chromatic note is spelled so the written intervals around it match the
|
|
150
297
|
* sounding ones, and then so a rising step carries a sharp and a falling
|
|
151
298
|
* step a flat.
|
|
@@ -190,4 +337,5 @@ type SpellLineOptions = {
|
|
|
190
337
|
*/
|
|
191
338
|
declare function spellLine(notes: readonly NoteEvent[], timeline: ChordTimeline | null, key: SpelledKeyLike, opts?: SpellLineOptions): Note[];
|
|
192
339
|
|
|
193
|
-
export { ChordTimeline,
|
|
340
|
+
export { ChordTimeline, MelodicPhrase, Note as NoteData, NoteEvent, NoteLike, ReferenceProfile, SpelledKeyLike, assertReferenceProfile, compareMelodies, compareReferences, melodicSimilarity, spellLine };
|
|
341
|
+
export type { MelodicComparison, ReferenceComparison, ReferenceComparisonOptions, SpellLineOptions };
|