bellows-voice 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/THIRD_PARTY_NOTICES.md +13 -13
- package/dist/chunk-OIFBP6WA.js +3 -0
- package/dist/chunk-OIFBP6WA.js.map +7 -0
- package/dist/chunk-XR5GDH27.js +6 -0
- package/dist/chunk-XR5GDH27.js.map +7 -0
- package/dist/dict/cmudict-data.gen.d.ts +3 -2
- package/dist/dict/cmudict-data.gen.d.ts.map +1 -1
- package/dist/dict/cmudict.d.ts +6 -1
- package/dist/dict/cmudict.d.ts.map +1 -1
- package/dist/dict.js +41 -104
- package/dist/dict.js.map +2 -2
- package/dist/dsp/junction-airway.d.ts +13 -3
- package/dist/dsp/junction-airway.d.ts.map +1 -1
- package/dist/dsp/side-branch.d.ts +9 -5
- package/dist/dsp/side-branch.d.ts.map +1 -1
- package/dist/engine.js +1 -1
- package/dist/engine.js.map +3 -3
- package/dist/engines/vocal-beat-scores.d.ts.map +1 -1
- package/dist/engines/vocal-planner.d.ts +0 -1
- package/dist/engines/vocal-planner.d.ts.map +1 -1
- package/dist/engines/vocal-settings.d.ts +2 -0
- package/dist/engines/vocal-settings.d.ts.map +1 -1
- package/dist/engines/vocal.d.ts.map +1 -1
- package/dist/explain.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/lyrics/accents.d.ts +1 -1
- package/dist/lyrics/accents.d.ts.map +1 -1
- package/dist/lyrics/beat.d.ts.map +1 -1
- package/dist/lyrics/english.d.ts +5 -0
- package/dist/lyrics/english.d.ts.map +1 -1
- package/dist/lyrics/numbers.d.ts +9 -3
- package/dist/lyrics/numbers.d.ts.map +1 -1
- package/dist/lyrics/pronounce.d.ts +2 -0
- package/dist/lyrics/pronounce.d.ts.map +1 -1
- package/dist/lyrics/read.d.ts +1 -1
- package/dist/lyrics/speech.d.ts.map +1 -1
- package/dist/singer.d.ts +11 -6
- package/dist/singer.d.ts.map +1 -1
- package/dist/text.js +1 -1
- package/dist/view.js +1 -1
- package/dist/view.js.map +1 -1
- package/dist/worklet-code.gen.d.ts.map +1 -1
- package/dist/worklet.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4PNDIKDG.js +0 -3
- package/dist/chunk-4PNDIKDG.js.map +0 -7
- package/dist/chunk-5JCPPIX7.js +0 -6
- package/dist/chunk-5JCPPIX7.js.map +0 -7
- package/dist/chunk-BUKRW4C6.js +0 -3
- package/dist/chunk-BUKRW4C6.js.map +0 -7
- package/dist/chunk-E5BOE5OO.js +0 -6
- package/dist/chunk-E5BOE5OO.js.map +0 -7
- package/dist/chunk-FCBNIGIO.js +0 -3
- package/dist/chunk-FCBNIGIO.js.map +0 -7
- package/dist/chunk-J4ODV4QR.js +0 -6
- package/dist/chunk-J4ODV4QR.js.map +0 -7
- package/dist/chunk-MCZRKZS7.js +0 -3
- package/dist/chunk-MCZRKZS7.js.map +0 -7
- package/dist/chunk-MW7UO3SL.js +0 -6
- package/dist/chunk-MW7UO3SL.js.map +0 -7
- package/dist/chunk-OIBHJK7R.js +0 -6
- package/dist/chunk-OIBHJK7R.js.map +0 -7
- package/dist/chunk-RXULDSHA.js +0 -6
- package/dist/chunk-RXULDSHA.js.map +0 -7
- package/dist/chunk-RZMXXTHL.js +0 -3
- package/dist/chunk-RZMXXTHL.js.map +0 -7
- package/dist/chunk-WA623NKS.js +0 -6
- package/dist/chunk-WA623NKS.js.map +0 -7
- package/dist/chunk-WBPNYYUW.js +0 -3
- package/dist/chunk-WBPNYYUW.js.map +0 -7
- package/dist/chunk-ZIDRAL5Z.js +0 -3
- package/dist/chunk-ZIDRAL5Z.js.map +0 -7
package/dist/lyrics/accents.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export interface Accent {
|
|
|
54
54
|
region?: string;
|
|
55
55
|
/** Says r after a vowel ("car", "card"). A non-rhotic accent still links it before a vowel ("far away"). */
|
|
56
56
|
rhotic: boolean;
|
|
57
|
-
/** Each lexical set's realization, IPA. A set left out keeps General American's
|
|
57
|
+
/** Each lexical set's realization, IPA. A set left out keeps the reader's vowel (General American's before r only where named). */
|
|
58
58
|
sets: Partial<Record<LexicalSet, string>>;
|
|
59
59
|
/**
|
|
60
60
|
* Share of a diphthong's time held on its first vowel, 0 to 1. Left out, General American's 0.8
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accents.d.ts","sourceRoot":"","sources":["../../src/lyrics/accents.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAW,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGjD,8DAA8D;AAC9D,MAAM,MAAM,KAAK;AACf,6DAA6D;AAC3D,MAAM;AACR,0BAA0B;GACxB,UAAU;AACZ,sFAAsF;GACpF,cAAc;AAChB,sGAAsG;GACpG,SAAS,CAAC;AACd,yBAAyB;AACzB,MAAM,MAAM,KAAK;AACf,gFAAgF;AAC9E,WAAW;AACb,sCAAsC;GACpC,OAAO;AACT,6DAA6D;GAC3D,MAAM;AACR,iGAAiG;GAC/F,WAAW,CAAC;AAChB,0CAA0C;AAC1C,MAAM,MAAM,MAAM,GACd,WAAW;AACb,sFAAsF;GACpF,MAAM;AACR,kGAAkG;GAChG,OAAO;AACT,+FAA+F;GAC7F,UAAU,CAAC;AACf,0CAA0C;AAC1C,MAAM,MAAM,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC;AAE1C,4FAA4F;AAC5F,MAAM,WAAW,OAAO;IACtB,sHAAsH;IACtH,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA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EF,sGAAsG;AACtG,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAMzE;AAED,+DAA+D;AAC/D,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,2DAA2D;IAC3D,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAID,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAaxD;AAID;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAYnH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beat.d.ts","sourceRoot":"","sources":["../../src/lyrics/beat.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,QAAQ;IACvB,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC;AAE9C,4DAA4D;AAC5D,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,iGAAiG;AACjG,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"beat.d.ts","sourceRoot":"","sources":["../../src/lyrics/beat.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,QAAQ;IACvB,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,wEA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,CA0BvF"}
|
package/dist/lyrics/english.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export interface EnglishOptions {
|
|
|
9
9
|
*/
|
|
10
10
|
reduce?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* A word the reader's own tables say (homographs, function words, irregular and number words). The
|
|
14
|
+
* dictionary leaves these out (scripts/gen-dict.mjs), so a sung "fire" or "hour" keeps one syllable.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isHandWord(word: string): boolean;
|
|
12
17
|
/**
|
|
13
18
|
* One English word to segments with lexical stress. Letters are lower-cased and apostrophes
|
|
14
19
|
* at either end dropped ("'tis", "dancin'"). A hyphenated word the dictionary lacks is read part
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"english.d.ts","sourceRoot":"","sources":["../../src/lyrics/english.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAY,MAAM,SAAS,CAAC;AAOlF,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"english.d.ts","sourceRoot":"","sources":["../../src/lyrics/english.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAY,MAAM,SAAS,CAAC;AAOlF,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAuGD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAWD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,EAAE,CAenF;AAsBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,cAAmB,GAAG,QAAQ,CAMnE"}
|
package/dist/lyrics/numbers.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
/** A whole number in words
|
|
1
|
+
/** A whole number in words ("twelve thousand three hundred"); past the safe integers, digit by digit. */
|
|
2
2
|
export declare function cardinal(n: number): string;
|
|
3
3
|
/** An ordinal in words ("twenty-first"). */
|
|
4
4
|
export declare function ordinal(n: number): string;
|
|
5
5
|
/** A year as it is read: 1984 nineteen eighty-four, 1900 nineteen hundred, 2005 two thousand five, 2026 twenty twenty-six. */
|
|
6
6
|
export declare function year(n: number): string;
|
|
7
|
-
/** A word in capitals as its letters, IPA between slashes, the last letter stressed ("/ti.ˈvi/"). */
|
|
8
|
-
export declare function letters(word: string): string;
|
|
7
|
+
/** A word in capitals as its letters, IPA between slashes, the last letter stressed ("/ti.ˈvi/"); `plural` 'z' for "TVs". */
|
|
8
|
+
export declare function letters(word: string, plural?: '' | 'z'): string;
|
|
9
|
+
/**
|
|
10
|
+
* IPA between slashes, by the reader's rule (read.ts, delimitedWordEnd): the opening slash not right
|
|
11
|
+
* after a letter or digit nor before a space, the closing one not right after a space. So the slash
|
|
12
|
+
* of "and/or" is not IPA.
|
|
13
|
+
*/
|
|
14
|
+
export declare const IPA_SPAN: string;
|
|
9
15
|
/** Numbers, symbols and initialisms in `text` as words, IPA between slashes untouched. */
|
|
10
16
|
export declare function spellOut(text: string): string;
|
|
11
17
|
//# sourceMappingURL=numbers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/lyrics/numbers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/lyrics/numbers.ts"],"names":[],"mappings":"AA+BA,yGAAyG;AACzG,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAa1C;AAED,4CAA4C;AAC5C,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAOzC;AAED,8HAA8H;AAC9H,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAOtC;AAgBD,6HAA6H;AAC7H,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,EAAE,GAAG,GAAQ,GAAG,MAAM,CAOnE;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,QAAkE,CAAC;AAGxF,0FAA0F;AAC1F,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7C"}
|
|
@@ -7,6 +7,8 @@ export interface PronounceOptions {
|
|
|
7
7
|
accent?: Accent | string;
|
|
8
8
|
/** The accent's t and l rules, default true. */
|
|
9
9
|
allophones?: boolean;
|
|
10
|
+
/** Numbers, symbols and initialisms as words ("21st", "$5", "TV"), default true. */
|
|
11
|
+
numbers?: boolean;
|
|
10
12
|
}
|
|
11
13
|
export interface PronouncedWord {
|
|
12
14
|
/** The word's spelling as the lyric split it ("twin-kle"). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pronounce.d.ts","sourceRoot":"","sources":["../../src/lyrics/pronounce.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGxC,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,gDAAgD;IAChD,UAAU,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"pronounce.d.ts","sourceRoot":"","sources":["../../src/lyrics/pronounce.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGxC,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,gDAAgD;IAChD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oFAAoF;IACpF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,sFAAsF;IACtF,IAAI,EAAE,CAAC,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,aAAa,CAmBlF;AAED,+CAA+C;AAC/C,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,MAAM,CAEvE"}
|
package/dist/lyrics/read.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function readLyrics(text: string, frontEnds: readonly FrontEnd[])
|
|
|
13
13
|
* how CHIMERA's own sung syllables come out and how classical diction sings; IPA is sung as
|
|
14
14
|
* written either way. `accent` (an id from ACCENTS or an Accent) re-voices the English words'
|
|
15
15
|
* vowels and r, th and h first (accents.ts), and picks the t and l rules; General American, the
|
|
16
|
-
* default,
|
|
16
|
+
* default, changes only the vowels before r (accents.ts, NORTH_AMERICAN_PRE_R).
|
|
17
17
|
*/
|
|
18
18
|
export declare function lyricsToSyllables(text: string, opts?: {
|
|
19
19
|
dictionary?: PronouncingDictionary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech.d.ts","sourceRoot":"","sources":["../../src/lyrics/speech.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"speech.d.ts","sourceRoot":"","sources":["../../src/lyrics/speech.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoFzC,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;CACrC;AAED,qGAAqG;AACrG,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,yHAAyH;AACzH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,wDAAwD;IACxD,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,SAAS,QAAQ,EAAE,EAC9B,IAAI,GAAE,aAAkB,EACxB,SAAS,GAAE,SAAS,OAAO,EAAO,GACjC,UAAU,CAuEZ"}
|
package/dist/singer.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface SingOptions {
|
|
|
32
32
|
allophones?: boolean;
|
|
33
33
|
/** Accent for this line, over the singer's: an id from ACCENTS ('southern-british', ...) or an Accent. */
|
|
34
34
|
accent?: Accent | string;
|
|
35
|
+
/** Numbers, symbols and initialisms as words ("21st", "$5", "TV"), default true. */
|
|
36
|
+
numbers?: boolean;
|
|
35
37
|
}
|
|
36
38
|
export interface SpeakOptions {
|
|
37
39
|
/** Context time the first syllable's vowel lands. Left out, as soon as the opening consonants can sound. */
|
|
@@ -47,13 +49,10 @@ export interface SpeakOptions {
|
|
|
47
49
|
allophones?: boolean;
|
|
48
50
|
/** Breaths in: 'between' phrases (default), 'all' (before the first too), or 'none'. */
|
|
49
51
|
breath?: 'between' | 'all' | 'none';
|
|
52
|
+
/** Numbers, symbols and initialisms as words ("$5.50", "10:30", "TV"), default true. */
|
|
53
|
+
numbers?: boolean;
|
|
50
54
|
}
|
|
51
|
-
/**
|
|
52
|
-
* What sing() planned and posted. `phrases` are the plan, each vowel on its beat. `leadIn` is the
|
|
53
|
-
* longest any phrase starts before its own first beat, which can be more than the plan's own
|
|
54
|
-
* lead-in: a phrase that opens on an aspirated p, t or k releases it early, so its vowel is voiced
|
|
55
|
-
* on the beat. Live, call at least that far ahead of the first beat.
|
|
56
|
-
*/
|
|
55
|
+
/** beatbox()'s options: the pattern's timing (bpm, swing, repeat), when, the hum's pitch and the breath. */
|
|
57
56
|
export interface BeatboxOptions extends BeatTiming {
|
|
58
57
|
/** Context time of the first step's hit. Left out, as soon as the line's lead-in can sound. */
|
|
59
58
|
at?: number;
|
|
@@ -62,6 +61,12 @@ export interface BeatboxOptions extends BeatTiming {
|
|
|
62
61
|
/** Velocity 0..1: the breath behind every sound. Default 0.8. */
|
|
63
62
|
vel?: number;
|
|
64
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* What sing() planned and posted. `phrases` are the plan, each vowel on its beat. `leadIn` is the
|
|
66
|
+
* longest any phrase starts before its own first beat, which can be more than the plan's own
|
|
67
|
+
* lead-in: a phrase that opens on an aspirated p, t or k releases it early, so its vowel is voiced
|
|
68
|
+
* on the beat. Live, call at least that far ahead of the first beat.
|
|
69
|
+
*/
|
|
65
70
|
export interface SingResult extends SungPlan {
|
|
66
71
|
/** IPA the vocal engine has no phoneme for, each once; those spans keep the sound before them. */
|
|
67
72
|
unknown: string[];
|
package/dist/singer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singer.d.ts","sourceRoot":"","sources":["../src/singer.ts"],"names":[],"mappings":"AAUA,OAAO,EAA0B,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAoB,KAAK,WAAW,EAAiB,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/M,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"singer.d.ts","sourceRoot":"","sources":["../src/singer.ts"],"names":[],"mappings":"AAUA,OAAO,EAA0B,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAoB,KAAK,WAAW,EAAiB,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/M,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAGhF,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAA0B,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAK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AC,CAAC,EAAE,OAAO,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,WAAgB,EAAE,IAAI,GAAE,aAAkB,GAAG,MAAM,CAE9H"}
|
package/dist/text.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! bellows-voice | MIT, Copyright (c) 2026 Moheeb Zara | includes code from CHIMERA, https://github.com/jamesondh/chimera-vocal-synth, Copyright (c) 2026 Jameson Hodge, MIT License | notices in THIRD_PARTY_NOTICES.md */
|
|
2
|
-
import{$ as
|
|
2
|
+
import{$ as aa,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,V as U,W as V,X as W,Y as X,Z as _,_ as $,a,aa as ba,b,ba as ca,c,ca as da,d,da as ea,e,ea as ia,f,fa as ja,g,ga as ka,h,ha as la,i,ia as ma,j,ja as na,k,ka as oa,l,la as pa,m,ma as qa,n,na as ra,o,oa as sa,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-XR5GDH27.js";import{g as Y,k as Z,u as fa,v as ga,x as ha}from"./chunk-OIFBP6WA.js";export{N as ACCENTS,M as ACCENT_REGIONS,k as AUSTRALIAN,ca as BEAT_LEAD_IN,ba as BEAT_PRESETS,F as BOSTON,D as BRUMMIE,q as CALIFORNIAN,p as CANADIAN,g as DEFAULT_PROSODY,H as FILIPINO,h as GENERAL_AMERICAN,t as GEORDIE,I as GHANAIAN,z as INDIAN,G as INLAND_NORTH,m as IRISH,y as JAMAICAN,J as KENYAN,c as LEXICAL_SETS,j as LONDON,_ as MAX_BEAT_STEPS,r as NEW_YORK,l as NEW_ZEALAND,x as NIGERIAN,s as NORTHERN_ENGLISH,v as NORTHERN_IRISH,B as RECEIVED_PRONUNCIATION,L as RUSSIAN,n as SCOTTISH,C as SCOUSE,ha as SHAPE_PRESETS,A as SINGAPOREAN,i as SOUTHERN_BRITISH,o as SOUTHERN_US,w as SOUTH_AFRICAN,ja as SPEECH_HZ_BY_BODY,K as TRINIDADIAN,Y as VOCAL_BEATS,la as VOICE_PRESETS,fa as VOICE_SETTINGS,u as WELSH,E as WEST_COUNTRY,P as applyAccent,b as arpabetToSegments,ea as beatLine,da as beatStepSeconds,Q as cardinal,sa as describeShape,qa as describeSound,e as englishFrontEnd,aa as formatBeat,f as ipaFrontEnd,T as letters,W as lyricsToSyllables,ra as nearestVowel,R as ordinal,$ as parseBeat,na as parseCmudict,ia as planSung,oa as pronounce,V as readLyrics,O as resolveAccent,ka as speechHzForBody,X as speechPlan,U as spellOut,d as tagLexicalSets,pa as toIPA,a as tokenizeIpa,Z as vocalBeatIndex,ma as voicePreset,ga as voiceSetting,S as year};
|
|
3
3
|
//# sourceMappingURL=text.js.map
|
package/dist/view.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! bellows-voice | MIT, Copyright (c) 2026 Moheeb Zara | includes code from CHIMERA, https://github.com/jamesondh/chimera-vocal-synth, Copyright (c) 2026 Jameson Hodge, MIT License | notices in THIRD_PARTY_NOTICES.md */
|
|
2
|
-
import{a as K,b as G,c as V,d as at,e as O,f as it,h as Z,i as U,j as tt}from"./chunk-N3L4LRD7.js";import{b as Q,d as ot,m as $,o as L,w as st}from"./chunk-MCZRKZS7.js";function q(e){let t=(...b)=>{let M=[];for(let l of b)for(let m=l.from;m<l.n;m++)M.push(l.xs[m],l.ys[m]);return M},n=(b,M=0)=>({xs:b.xs,ys:b.ys,n:b.n,from:M}),s=e.k,r={xs:e.floorX,ys:e.floorY,n:3,from:1},o=t(n(e.root),n(e.arcPts,1),n(e.blade,1),n(e.under,1),r),u=(b,M,l,m,F,I,C,j,k)=>{let N=[];for(let _=1;_<=k;_++){let x=_/k,P=1-x;N.push(P*P*P*b+3*P*P*x*l+3*P*x*x*F+x*x*x*C,P*P*P*M+3*P*P*x*m+3*P*x*x*I+x*x*x*j)}return N},i=(b,M)=>(e.j(b,M),[e.r[0],e.r[1]]),c=[e.dUlx,e.dUly],a=[e.dLlx,e.dLly],[y,f]=i(8.1,6.3),[d,p]=i(7.6,5.6),h=t(n(e.upperLipIn)).concat(u(c[0],c[1],c[0]+.25*s,c[1]+.35*s,e.pX(8.3),e.pY(9.6),e.pX(7.9),e.pY(10.4),6)),w=t(n(e.lowerLipIn)).concat(u(a[0],a[1],a[0]+.3*s,a[1]-.4*s,y,f,d,p,6)),g=[];for(let[b,M]of[[7.25,6.75],[7.4,5.4],[6.4,4.6],[3.5,4.4],[1.2,5.2],[-.6,7.4],[-1.9,9.6]])g.push(...i(b,M));let v=[];for(let[b,M]of[[6.15,9.36],[6.78,8.7],[7.12,7.95],[7.38,8.7],[7.4,9.3]])v.push(e.pX(b),e.pY(M));let T=[];for(let b=0;b<4;b++)T.push(e.lowTeethX[b],e.lowTeethY[b]);T.push(...i(6.8,6),...i(6.4,6.2),e.lowTeethX[0],e.lowTeethY[0]);let R=t(n(e.velNasal));for(let b=e.velOral.n-1;b>=0;b--)R.push(e.velOral.xs[b],e.velOral.ys[b]);let A=e.dEpi;return{k:s,tongue:o,upperLip:h,lowerLip:w,jawBone:g,upperTeeth:v,lowerTeeth:T,velum:R,epiglottis:[A[0],A[1],A[2],A[3],A[4],A[5]],palate:t(n(e.palate)),pharynxWall:t(n(e.pharWall)),outer:t(n(e.outer)),inner:t(n(e.inner)),glottisY:e.dGlotY,tongueCenter:[e.dBX,e.dBY],tongueRadius:e.dRR,jawCos:e.cosPhi,jawSin:e.sinPhi,condyle:[e.condX,e.condY],pharynxScale:e.phScale}}var S=24,J=35e3,et=.00114,ut=220,_t=[L.jaw,L.tbX,L.tbY,L.root,L.lipAp,L.lipProt];function At(e,t){let n=new Float64Array(S),s=new Float64Array(S),r=new Float64Array(S),o=new Float64Array(S);e.evaluate(t),e.resampleInto(n,s,r,o,S,S);let u=[],i=[];for(let c=0;c<S;c++)u.push(Math.max(n[c],.05)),i.push(e.phLen/S);for(let c=0;c<S;c++)u.push(Math.max(s[c],.05)),i.push(e.orLen/S);return{areas:u,lengths:i}}function Mt(e,t,n=4500){let s=[],r=0,o=0,u=5;for(let i=50;i<=n;i+=u){let c=2*Math.PI*i,a=1,y=0,f=0,d=0,p=0,h=0,w=1,g=0;for(let m=0;m<e.length;m++){let I=c/J*t[m],C=et*J/e[m],j=Math.cos(I),k=Math.sin(I),N=.003*I,_=j,x=-N*k,P=N*C*j,B=C*k,D=N*j/C,H=k/C,W=j,z=-N*k,ht=a*_-y*x+f*D-d*H,bt=a*x+y*_+f*H+d*D,ft=a*P-y*B+f*W-d*z,yt=a*B+y*P+f*z+d*W,gt=p*_-h*x+w*D-g*H,wt=p*x+h*_+w*H+g*D,dt=p*P-h*B+w*W-g*z,xt=p*B+h*P+w*z+g*W;a=ht,y=bt,f=ft,d=yt,p=gt,h=wt,w=dt,g=xt}let v=e[e.length-1],T=Math.sqrt(v/Math.PI),R=c*et*.8*T/v,A=et*J/v*.5*(c*T/J)**2,b=p*A-h*R+w,M=p*R+h*A+g,l=1/Math.hypot(b,M);r>o&&r>l&&i>150&&s.push(i-u),o=r,r=l}return s}function lt(e,t){let{areas:n,lengths:s}=At(e,t),r=Mt(n,s);return[Math.sqrt((r[0]??NaN)**2+ut*ut),r[1]??NaN,r[2]??NaN]}var Pt=.45,vt={".":{base:"\u0259",set:{jaw:.4,lipAp:.25,lipProt:.1}},B:{base:"p",set:{jaw:.3,tbY:7.7,larynx:1.55}},t:{base:"t",set:{jaw:.3}},tss:{base:"s"},Pf:{base:"f"},K:{base:"k",set:{jaw:.35,larynx:1.55}},"^K":{base:"k",set:{jaw:.35,tbY:7.4}},"!":{base:"t",set:{dorsum:1}},"P!":{base:"p",set:{jaw:1.6,dorsum:1}},kch:{base:"\u0283"},m:{base:"m"},ch:{base:"\u0283",set:{jaw:.3}},Psh:{base:"\u0283"}},Tt=K;function pt(e,t){let n=Q(t);if(n<0)return;let s=Z[Math.max(0,Math.min(Z.length-1,Math.round(e)))];if(it[n]===void 0)return;let r=s.vowelTargets[n];return Float64Array.from(r.some(o=>o===o)?r:s.consonantTargets[n])}var rt=class{posture=Float64Array.from(O);velocity=new Float64Array(O.length);goal=Float64Array.from(O);vowelGoal=Float64Array.from(O);geometry;bodyIndex=0;current="_";offsets=new Float64Array(O.length);settingValues={};own=new Uint8Array(O.length);constructor(t=0){this.bodyIndex=ct(t),this.geometry=new tt(U[this.bodyIndex])}setSettings(t){this.settingValues={...t},st(t,this.offsets),this.layBody(),this.current!=="_"?this.target(this.current):this.applyOffsets()}get settings(){return{...this.settingValues}}layBody(){let t=U[this.bodyIndex],n=mt(this.settingValues.size,.8,1.25,1),s=mt(this.settingValues.pharynx,.8,1.25,1);this.geometry.setBody(t.scale*n,t.pharynx*s,t.tongueRadius,t.lipWidth)}applyOffsets(){for(let t=0;t<this.goal.length;t++)this.own[t]||(this.goal[t]+=this.offsets[t]);Rt(this.goal)}pose(t,n=!0){for(let[s,r]of Object.entries(t)){let o=K.indexOf(s);o<0||typeof r!="number"||!Number.isFinite(r)||(this.goal[o]=Math.max(G[o],Math.min(V[o],r)),n&&(this.posture[o]=this.goal[o],this.velocity[o]=0))}this.current="pose"}postureByName(){let t={};return K.forEach((n,s)=>t[n]=this.posture[s]),t}formants(){return lt(this.geometry,this.posture)}drawingNow(){let t=this.geometry;return t.evaluate(this.posture),Object.assign(q(t),{tipX:t.tipX,tipY:t.tipY})}setBody(t){let n=ct(t);n!==this.bodyIndex&&(this.bodyIndex=n,this.geometry=new tt(U[n]),this.layBody(),this.current!=="_"&&this.target(this.current))}target(t){if(t.startsWith($))return this.targetBeat(t);if(t==="_"||t==="")return this.goal.set(O),this.vowelGoal.set(O),this.own.fill(0),this.applyOffsets(),this.current="_",!0;let n=pt(this.bodyIndex,t);if(!n)return!1;let s=Q(t),r=Z[this.bodyIndex].vowelTargets[s].some(o=>o===o);for(let o=0;o<n.length;o++){let u=n[o];r?(this.vowelGoal[o]=u===u?u:O[o],this.goal[o]=this.vowelGoal[o],this.own[o]=0):(this.goal[o]=u===u?u:this.vowelGoal[o],this.own[o]=u===u?1:0)}return this.goal[L.velum]=ot[s]?.cls==="nasal"?Pt:this.vowelGoal[L.velum],this.applyOffsets(),this.current=t,!0}targetBeat(t){let n=t.slice($.length);n.length>1&&n.endsWith(">")&&(n=n.slice(0,-1));let s=vt[n];if(!s||!this.target(s.base))return!1;for(let[r,o]of Object.entries(s.set??{}))this.goal[L[r]]=o;return n==="m"&&(this.goal[L.velum]=.9),this.current=t,!0}step(t){if(!(t>0))return;let n=Math.min(200,Math.ceil(t/.002)),s=t/n;for(let r=0;r<n;r++)for(let o=0;o<this.posture.length;o++){let u=2*Math.PI*at[o],i=u*u*(this.goal[o]-this.posture[o])-2*u*this.velocity[o];this.velocity[o]+=i*s,this.posture[o]+=this.velocity[o]*s,this.posture[o]<G[o]&&(this.posture[o]=G[o]),this.posture[o]>V[o]&&(this.posture[o]=V[o])}}settle(){this.posture.set(this.goal),this.velocity.fill(0)}shape(){let t=this.geometry;t.evaluate(this.posture);let n=t.gN,s=new Float32Array(2*n),r=new Float32Array(2*n),o=new Float32Array(n),u=Uint8Array.from(t.gRegion.subarray(0,n));for(let i=0;i<n;i++)s[2*i]=t.gInX[i],s[2*i+1]=t.gInY[i],r[2*i]=t.gOutX[i],r[2*i+1]=t.gOutY[i],o[i]=t.gArea[i];return{lower:s,upper:r,area:o,velumPort:t.velumPort,lipArea:t.lipArea,tipX:t.tipX,tipY:t.tipY,region:u,split:t.splitIndex,constriction:Lt(o),drawing:q(t)}}};function mt(e,t,n,s){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(n,e)):s}function Rt(e){for(let t=0;t<e.length;t++)e[t]=Math.max(G[t],Math.min(V[t],e[t]))}function Lt(e){let t=-1,n=1/0;for(let s=Math.min(4,e.length-1);s<e.length;s++)e[s]<n&&(n=e[s],t=s);return t}function ct(e){return Math.max(0,Math.min(U.length-1,Math.round(Number.isFinite(e)?e:0)))}function E(e,t){if(t==="tongue")return[e.tongueCenter[0],e.tongueCenter[1]];if(t==="tip")return[e.tipX,e.tipY];if(t==="jaw")return[e.lowerTeeth[4],e.lowerTeeth[5]];if(t==="velum")return[e.velum[10],e.velum[11]];if(t==="larynx")return[.5*(e.inner[0]+e.outer[0]),e.glottisY];let n=o=>{let u=0;for(let i=2;i<o.length;i+=2)o[i]>o[u]&&(u=i);return[o[u],o[u+1]]},s=n(e.upperLip),r=n(e.lowerLip);return[.5*(s[0]+r[0])+.15*e.k,.5*(s[1]+r[1])]}function Ot(e){let t=e.drawingNow();return{tongue:E(t,"tongue"),tip:E(t,"tip"),jaw:E(t,"jaw"),lips:E(t,"lips"),velum:E(t,"velum"),larynx:E(t,"larynx")}}function St(e,t,n,s,r){let u={tongue:["tongueFront","tongueHigh"],tip:["tongueFront","tongueHigh"],jaw:["jawSet"],lips:["lipRound","lipOpen"],velum:["nasal"],larynx:["larynxSet"]}[t],i=e.settings,c=f=>f==="nasal"?[0,1]:[-1,1],a=()=>{e.setSettings(i),e.target(r),e.settle();let f=E(e.drawingNow(),t);return Math.hypot(f[0]-n,f[1]-s)},y=(Math.sqrt(5)-1)/2;for(let f=0;f<(u.length>1?3:1);f++)for(let d of u){let[p,h]=c(d),w=A=>(i[d]=A,a()),g=h-y*(h-p),v=p+y*(h-p),T=w(g),R=w(v);for(let A=0;A<18;A++)T<R?(h=v,v=g,R=T,g=h-y*(h-p),T=w(g)):(p=g,g=v,T=R,v=p+y*(h-p),R=w(v));i[d]=Math.round((p+h)/2*100)/100}return e.setSettings(i),e.target(r),e.settle(),i}function Y(e,t){let n=[];if(e.length<2)return e.slice();for(let s=0;s<e.length-1;s++){let r=e[s-1]??e[s],o=e[s],u=e[s+1],i=e[s+2]??u;for(let c=0;c<t;c++){let a=c/t,y=a*a,f=y*a,d=(p,h,w,g)=>.5*(2*h+(-p+w)*a+(2*p-5*h+4*w-g)*y+(-p+3*h-3*w+g)*f);n.push([d(r[0],o[0],u[0],i[0]),d(r[1],o[1],u[1],i[1])])}}return n.push(e[e.length-1]),n}function nt(e,t,n,s=0,r=40){let o=Math.cos(-s),u=Math.sin(-s),i=[];for(let c=0;c<=r;c++){let a=c/r*Math.PI*2,y=Math.cos(a)*t,f=Math.sin(a)*n;i.push([e[0]+y*o-f*u,e[1]+y*u+f*o])}return i}function Ft(e,t,n){let s=Math.min(e[0],t[0]),r=Math.max(e[0],t[0]),o=Math.min(e[1],t[1]),u=Math.max(e[1],t[1]),i=Math.min(n,(r-s)/2,(u-o)/2),c=[],a=(y,f,d)=>{for(let p=0;p<=6;p++){let h=d+p/6*(Math.PI/2);c.push([y+Math.cos(h)*i,f+Math.sin(h)*i])}};return a(r-i,u-i,0),a(s+i,u-i,Math.PI/2),a(s+i,o+i,Math.PI),a(r-i,o+i,3*Math.PI/2),c.push(c[0]),c}function X(e){let t=[];for(let n=0;n+1<e.length;n+=2)t.push([e[n],e[n+1]]);return t}function It(e){let t=e.k,n=e.pharynxScale,s=(l,m)=>[(l>.5?.5+(l-.5)*.86:l)*t,(m<7?7-(7-m)*n:m)*t],r=(l,m)=>[l*t,(m<7?7-(7-m)*n:m)*t],[o,u]=e.condyle,i=(l,m)=>{let[F,I]=s(l,m),C=F-o,j=I-u;return[o+C*e.jawCos-j*e.jawSin,u+C*e.jawSin+j*e.jawCos]},c=e.glottisY-s(0,0)[1],a=[0,e.glottisY],y=l=>-1.2-.025*l,f=X(e.upperLip),d=X(e.lowerLip),p=f.slice(7),h=d.slice(7),w=Y([r(2.3,-4.6),r(2.38,-1.5),r(2.52,.4),r(3,1.7),i(5.3,3),i(7.25,3.35),i(7.95,4.6),i(7.55,5.7)],4),g=Y([p[p.length-1],r(7.05,10.6),r(7.75,10.78),r(8.75,11.05),r(9.25,11.65),r(8.95,12.6),r(8.35,13.9),r(7.7,15),r(7.95,16.1),r(7.9,18.1),r(6.9,20.5)],4),v=Y([r(6.9,20.5),r(3,22.9),r(-2.2,22.7),r(-6.9,19.6),r(-8.7,15.4),r(-8.3,11.9),r(-7.4,8.9),r(-6.8,4.8),r(-6.6,0),r(-6.6,-4.6)],4),T=[];for(let l=0;l<9;l++){let m=-4.4+l*1.75;if(m>10.5)break;let F=y(m)-2.25;T.push(Ft(s(F,m+1.4),s(F+1.6,m),.32*t))}let R=X(e.palate),A=X(e.jawBone).filter(l=>l[0]>.8*t),b=[s(1.6,0)[0],s(0,2.9)[1]+.6*c],M=[];for(let l=0;l<4;l++){let m=a[1]-(.9+l*1)*t;if(m<-4.4)break;M.push([[a[0]+.8*t,m],[a[0]+1.05*t,m-.05],[a[0]+1.05*t,m-.5*t],[a[0]+.82*t,m-.45*t],[a[0]+.8*t,m]])}return{skinLower:[...w,...h.slice().reverse()],skinUpper:[...p,...g.slice(1),...v.slice(1)],skull:Y([r(7,16.2),r(7.3,18.5),r(6,20.7),r(3,22.1),r(-2,22),r(-6.3,19.2),r(-7.9,15.3),r(-7.4,12.6),r(-4.6,12.2),r(-2.2,13.3),r(1,13.7),r(4.1,14.1),r(6.2,14.9)],4),eye:nt(r(6.5,15.4),1.1*t,.95*t),vertebrae:T,nasal:Y([r(.3,11.2),r(1.1,10.25),r(2.7,10.75),r(4.6,10.85),r(6.4,10.65),r(7.6,10.85),r(8.45,11.3),r(8,12.2),r(6.7,13.4),r(4.4,13.9),r(1.8,13.6),r(.2,12.6)],4),turbinates:[[3,11.45,2.1,.32],[3.5,12.45,1.9,.3],[4,13.3,1.45,.22]].map(([l,m,F,I])=>nt(r(l,m),F*t,I*t,-.04)),palNasal:R.map(l=>[l[0],l[1]+.55*t]),jawLower:A,jawUpper:A.map(l=>[l[0],l[1]+.75*t]),hyoid:nt(b,.5*t,.28*t,.3,28),thyroid:[[a[0]+.75*t,a[1]-1.6*t],[a[0]+1.75*t,a[1]-.6*t],[a[0]+1.95*t,a[1]+1.2*t],[a[0]+1.45*t,a[1]+1.9*t],[a[0]+1.15*t,a[1]+1.1*t],[a[0]+1.3*t,a[1]-.4*t],[a[0]+.75*t,a[1]-1.6*t]],trachea:[[[a[0]-.65*t,a[1]],[a[0]-.75*t,-4.8]],[[a[0]+.75*t,a[1]],[a[0]+.95*t,-4.8]]],rings:M,folds:[[[a[0]-.62*t,a[1]+.05],[a[0]-.1,a[1]+.12*t],[a[0]-.62*t,a[1]+.32*t],[a[0]-.62*t,a[1]+.05]],[[a[0]+.72*t,a[1]+.05],[a[0]+.12,a[1]+.12*t],[a[0]+.72*t,a[1]+.32*t],[a[0]+.72*t,a[1]+.05]]],view:{x0:-7.5*t,x1:10.25*t,y0:-4.55,y1:19.9*t}}}export{Tt as ARTICULATOR_NAMES,rt as TractModel,Y as catmullRom,q as geometryDrawing,E as handlePoint,It as headProfile,Ot as mouthHandles,X as pairs,pt as phonemeTargets,St as settingsForHandle};
|
|
2
|
+
import{a as K,b as G,c as V,d as at,e as O,f as it,h as Z,i as U,j as tt}from"./chunk-N3L4LRD7.js";import{b as Q,d as ot,m as $,o as L,w as st}from"./chunk-OIFBP6WA.js";function q(e){let t=(...b)=>{let M=[];for(let l of b)for(let m=l.from;m<l.n;m++)M.push(l.xs[m],l.ys[m]);return M},n=(b,M=0)=>({xs:b.xs,ys:b.ys,n:b.n,from:M}),s=e.k,r={xs:e.floorX,ys:e.floorY,n:3,from:1},o=t(n(e.root),n(e.arcPts,1),n(e.blade,1),n(e.under,1),r),u=(b,M,l,m,F,I,C,j,k)=>{let N=[];for(let _=1;_<=k;_++){let x=_/k,P=1-x;N.push(P*P*P*b+3*P*P*x*l+3*P*x*x*F+x*x*x*C,P*P*P*M+3*P*P*x*m+3*P*x*x*I+x*x*x*j)}return N},i=(b,M)=>(e.j(b,M),[e.r[0],e.r[1]]),c=[e.dUlx,e.dUly],a=[e.dLlx,e.dLly],[y,f]=i(8.1,6.3),[d,p]=i(7.6,5.6),h=t(n(e.upperLipIn)).concat(u(c[0],c[1],c[0]+.25*s,c[1]+.35*s,e.pX(8.3),e.pY(9.6),e.pX(7.9),e.pY(10.4),6)),w=t(n(e.lowerLipIn)).concat(u(a[0],a[1],a[0]+.3*s,a[1]-.4*s,y,f,d,p,6)),g=[];for(let[b,M]of[[7.25,6.75],[7.4,5.4],[6.4,4.6],[3.5,4.4],[1.2,5.2],[-.6,7.4],[-1.9,9.6]])g.push(...i(b,M));let v=[];for(let[b,M]of[[6.15,9.36],[6.78,8.7],[7.12,7.95],[7.38,8.7],[7.4,9.3]])v.push(e.pX(b),e.pY(M));let T=[];for(let b=0;b<4;b++)T.push(e.lowTeethX[b],e.lowTeethY[b]);T.push(...i(6.8,6),...i(6.4,6.2),e.lowTeethX[0],e.lowTeethY[0]);let R=t(n(e.velNasal));for(let b=e.velOral.n-1;b>=0;b--)R.push(e.velOral.xs[b],e.velOral.ys[b]);let A=e.dEpi;return{k:s,tongue:o,upperLip:h,lowerLip:w,jawBone:g,upperTeeth:v,lowerTeeth:T,velum:R,epiglottis:[A[0],A[1],A[2],A[3],A[4],A[5]],palate:t(n(e.palate)),pharynxWall:t(n(e.pharWall)),outer:t(n(e.outer)),inner:t(n(e.inner)),glottisY:e.dGlotY,tongueCenter:[e.dBX,e.dBY],tongueRadius:e.dRR,jawCos:e.cosPhi,jawSin:e.sinPhi,condyle:[e.condX,e.condY],pharynxScale:e.phScale}}var S=24,J=35e3,et=.00114,ut=220,_t=[L.jaw,L.tbX,L.tbY,L.root,L.lipAp,L.lipProt];function At(e,t){let n=new Float64Array(S),s=new Float64Array(S),r=new Float64Array(S),o=new Float64Array(S);e.evaluate(t),e.resampleInto(n,s,r,o,S,S);let u=[],i=[];for(let c=0;c<S;c++)u.push(Math.max(n[c],.05)),i.push(e.phLen/S);for(let c=0;c<S;c++)u.push(Math.max(s[c],.05)),i.push(e.orLen/S);return{areas:u,lengths:i}}function Mt(e,t,n=4500){let s=[],r=0,o=0,u=5;for(let i=50;i<=n;i+=u){let c=2*Math.PI*i,a=1,y=0,f=0,d=0,p=0,h=0,w=1,g=0;for(let m=0;m<e.length;m++){let I=c/J*t[m],C=et*J/e[m],j=Math.cos(I),k=Math.sin(I),N=.003*I,_=j,x=-N*k,P=N*C*j,B=C*k,D=N*j/C,H=k/C,W=j,z=-N*k,ht=a*_-y*x+f*D-d*H,bt=a*x+y*_+f*H+d*D,ft=a*P-y*B+f*W-d*z,yt=a*B+y*P+f*z+d*W,gt=p*_-h*x+w*D-g*H,wt=p*x+h*_+w*H+g*D,dt=p*P-h*B+w*W-g*z,xt=p*B+h*P+w*z+g*W;a=ht,y=bt,f=ft,d=yt,p=gt,h=wt,w=dt,g=xt}let v=e[e.length-1],T=Math.sqrt(v/Math.PI),R=c*et*.8*T/v,A=et*J/v*.5*(c*T/J)**2,b=p*A-h*R+w,M=p*R+h*A+g,l=1/Math.hypot(b,M);r>o&&r>l&&i>150&&s.push(i-u),o=r,r=l}return s}function lt(e,t){let{areas:n,lengths:s}=At(e,t),r=Mt(n,s);return[Math.sqrt((r[0]??NaN)**2+ut*ut),r[1]??NaN,r[2]??NaN]}var Pt=.45,vt={".":{base:"\u0259",set:{jaw:.4,lipAp:.25,lipProt:.1}},B:{base:"p",set:{jaw:.3,tbY:7.7,larynx:1.55}},t:{base:"t",set:{jaw:.3}},tss:{base:"s"},Pf:{base:"f"},K:{base:"k",set:{jaw:.35,larynx:1.55}},"^K":{base:"k",set:{jaw:.35,tbY:7.4}},"!":{base:"t",set:{dorsum:1}},"P!":{base:"p",set:{jaw:1.6,dorsum:1}},kch:{base:"\u0283"},m:{base:"m"},ch:{base:"\u0283",set:{jaw:.3}},Psh:{base:"\u0283"}},Tt=K;function pt(e,t){let n=Q(t);if(n<0)return;let s=Z[Math.max(0,Math.min(Z.length-1,Math.round(e)))];if(it[n]===void 0)return;let r=s.vowelTargets[n];return Float64Array.from(r.some(o=>o===o)?r:s.consonantTargets[n])}var rt=class{posture=Float64Array.from(O);velocity=new Float64Array(O.length);goal=Float64Array.from(O);vowelGoal=Float64Array.from(O);geometry;bodyIndex=0;current="_";offsets=new Float64Array(O.length);settingValues={};own=new Uint8Array(O.length);constructor(t=0){this.bodyIndex=ct(t),this.geometry=new tt(U[this.bodyIndex])}setSettings(t){this.settingValues={...t},st(t,this.offsets),this.layBody(),this.current!=="_"?this.target(this.current):this.applyOffsets()}get settings(){return{...this.settingValues}}layBody(){let t=U[this.bodyIndex],n=mt(this.settingValues.size,.8,1.25,1),s=mt(this.settingValues.pharynx,.8,1.25,1);this.geometry.setBody(t.scale*n,t.pharynx*s,t.tongueRadius,t.lipWidth)}applyOffsets(){for(let t=0;t<this.goal.length;t++)this.own[t]||(this.goal[t]+=this.offsets[t]);Rt(this.goal)}pose(t,n=!0){for(let[s,r]of Object.entries(t)){let o=K.indexOf(s);o<0||typeof r!="number"||!Number.isFinite(r)||(this.goal[o]=Math.max(G[o],Math.min(V[o],r)),n&&(this.posture[o]=this.goal[o],this.velocity[o]=0))}this.current="pose"}postureByName(){let t={};return K.forEach((n,s)=>t[n]=this.posture[s]),t}formants(){return lt(this.geometry,this.posture)}drawingNow(){let t=this.geometry;return t.evaluate(this.posture),Object.assign(q(t),{tipX:t.tipX,tipY:t.tipY})}setBody(t){let n=ct(t);n!==this.bodyIndex&&(this.bodyIndex=n,this.geometry=new tt(U[n]),this.layBody(),this.current!=="_"&&this.target(this.current))}target(t){if(t.startsWith($))return this.targetBeat(t);if(t==="_"||t==="")return this.goal.set(O),this.vowelGoal.set(O),this.own.fill(0),this.applyOffsets(),this.current="_",!0;let n=pt(this.bodyIndex,t);if(!n)return!1;let s=Q(t),r=Z[this.bodyIndex].vowelTargets[s].some(o=>o===o);for(let o=0;o<n.length;o++){let u=n[o];r?(this.vowelGoal[o]=u===u?u:O[o],this.goal[o]=this.vowelGoal[o],this.own[o]=0):(this.goal[o]=u===u?u:this.vowelGoal[o],this.own[o]=u===u?1:0)}return this.goal[L.velum]=ot[s]?.cls==="nasal"?Pt:this.vowelGoal[L.velum],this.applyOffsets(),this.current=t,!0}targetBeat(t){let n=t.slice($.length);n.length>1&&n.endsWith(">")&&(n=n.slice(0,-1));let s=vt[n];if(!s||!this.target(s.base))return!1;for(let[r,o]of Object.entries(s.set??{}))this.goal[L[r]]=o;return n==="m"&&(this.goal[L.velum]=.9),this.current=t,!0}step(t){if(!(t>0))return;let n=Math.min(200,Math.ceil(t/.002)),s=t/n;for(let r=0;r<n;r++)for(let o=0;o<this.posture.length;o++){let u=2*Math.PI*at[o],i=u*u*(this.goal[o]-this.posture[o])-2*u*this.velocity[o];this.velocity[o]+=i*s,this.posture[o]+=this.velocity[o]*s,this.posture[o]<G[o]&&(this.posture[o]=G[o]),this.posture[o]>V[o]&&(this.posture[o]=V[o])}}settle(){this.posture.set(this.goal),this.velocity.fill(0)}shape(){let t=this.geometry;t.evaluate(this.posture);let n=t.gN,s=new Float32Array(2*n),r=new Float32Array(2*n),o=new Float32Array(n),u=Uint8Array.from(t.gRegion.subarray(0,n));for(let i=0;i<n;i++)s[2*i]=t.gInX[i],s[2*i+1]=t.gInY[i],r[2*i]=t.gOutX[i],r[2*i+1]=t.gOutY[i],o[i]=t.gArea[i];return{lower:s,upper:r,area:o,velumPort:t.velumPort,lipArea:t.lipArea,tipX:t.tipX,tipY:t.tipY,region:u,split:t.splitIndex,constriction:Lt(o),drawing:q(t)}}};function mt(e,t,n,s){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(n,e)):s}function Rt(e){for(let t=0;t<e.length;t++)e[t]=Math.max(G[t],Math.min(V[t],e[t]))}function Lt(e){let t=-1,n=1/0;for(let s=Math.min(4,e.length-1);s<e.length;s++)e[s]<n&&(n=e[s],t=s);return t}function ct(e){return Math.max(0,Math.min(U.length-1,Math.round(Number.isFinite(e)?e:0)))}function E(e,t){if(t==="tongue")return[e.tongueCenter[0],e.tongueCenter[1]];if(t==="tip")return[e.tipX,e.tipY];if(t==="jaw")return[e.lowerTeeth[4],e.lowerTeeth[5]];if(t==="velum")return[e.velum[10],e.velum[11]];if(t==="larynx")return[.5*(e.inner[0]+e.outer[0]),e.glottisY];let n=o=>{let u=0;for(let i=2;i<o.length;i+=2)o[i]>o[u]&&(u=i);return[o[u],o[u+1]]},s=n(e.upperLip),r=n(e.lowerLip);return[.5*(s[0]+r[0])+.15*e.k,.5*(s[1]+r[1])]}function Ot(e){let t=e.drawingNow();return{tongue:E(t,"tongue"),tip:E(t,"tip"),jaw:E(t,"jaw"),lips:E(t,"lips"),velum:E(t,"velum"),larynx:E(t,"larynx")}}function St(e,t,n,s,r){let u={tongue:["tongueFront","tongueHigh"],tip:["tongueFront","tongueHigh"],jaw:["jawSet"],lips:["lipRound","lipOpen"],velum:["nasal"],larynx:["larynxSet"]}[t],i=e.settings,c=f=>f==="nasal"?[0,1]:[-1,1],a=()=>{e.setSettings(i),e.target(r),e.settle();let f=E(e.drawingNow(),t);return Math.hypot(f[0]-n,f[1]-s)},y=(Math.sqrt(5)-1)/2;for(let f=0;f<(u.length>1?3:1);f++)for(let d of u){let[p,h]=c(d),w=A=>(i[d]=A,a()),g=h-y*(h-p),v=p+y*(h-p),T=w(g),R=w(v);for(let A=0;A<18;A++)T<R?(h=v,v=g,R=T,g=h-y*(h-p),T=w(g)):(p=g,g=v,T=R,v=p+y*(h-p),R=w(v));i[d]=Math.round((p+h)/2*100)/100}return e.setSettings(i),e.target(r),e.settle(),i}function Y(e,t){let n=[];if(e.length<2)return e.slice();for(let s=0;s<e.length-1;s++){let r=e[s-1]??e[s],o=e[s],u=e[s+1],i=e[s+2]??u;for(let c=0;c<t;c++){let a=c/t,y=a*a,f=y*a,d=(p,h,w,g)=>.5*(2*h+(-p+w)*a+(2*p-5*h+4*w-g)*y+(-p+3*h-3*w+g)*f);n.push([d(r[0],o[0],u[0],i[0]),d(r[1],o[1],u[1],i[1])])}}return n.push(e[e.length-1]),n}function nt(e,t,n,s=0,r=40){let o=Math.cos(-s),u=Math.sin(-s),i=[];for(let c=0;c<=r;c++){let a=c/r*Math.PI*2,y=Math.cos(a)*t,f=Math.sin(a)*n;i.push([e[0]+y*o-f*u,e[1]+y*u+f*o])}return i}function Ft(e,t,n){let s=Math.min(e[0],t[0]),r=Math.max(e[0],t[0]),o=Math.min(e[1],t[1]),u=Math.max(e[1],t[1]),i=Math.min(n,(r-s)/2,(u-o)/2),c=[],a=(y,f,d)=>{for(let p=0;p<=6;p++){let h=d+p/6*(Math.PI/2);c.push([y+Math.cos(h)*i,f+Math.sin(h)*i])}};return a(r-i,u-i,0),a(s+i,u-i,Math.PI/2),a(s+i,o+i,Math.PI),a(r-i,o+i,3*Math.PI/2),c.push(c[0]),c}function X(e){let t=[];for(let n=0;n+1<e.length;n+=2)t.push([e[n],e[n+1]]);return t}function It(e){let t=e.k,n=e.pharynxScale,s=(l,m)=>[(l>.5?.5+(l-.5)*.86:l)*t,(m<7?7-(7-m)*n:m)*t],r=(l,m)=>[l*t,(m<7?7-(7-m)*n:m)*t],[o,u]=e.condyle,i=(l,m)=>{let[F,I]=s(l,m),C=F-o,j=I-u;return[o+C*e.jawCos-j*e.jawSin,u+C*e.jawSin+j*e.jawCos]},c=e.glottisY-s(0,0)[1],a=[0,e.glottisY],y=l=>-1.2-.025*l,f=X(e.upperLip),d=X(e.lowerLip),p=f.slice(7),h=d.slice(7),w=Y([r(2.3,-4.6),r(2.38,-1.5),r(2.52,.4),r(3,1.7),i(5.3,3),i(7.25,3.35),i(7.95,4.6),i(7.55,5.7)],4),g=Y([p[p.length-1],r(7.05,10.6),r(7.75,10.78),r(8.75,11.05),r(9.25,11.65),r(8.95,12.6),r(8.35,13.9),r(7.7,15),r(7.95,16.1),r(7.9,18.1),r(6.9,20.5)],4),v=Y([r(6.9,20.5),r(3,22.9),r(-2.2,22.7),r(-6.9,19.6),r(-8.7,15.4),r(-8.3,11.9),r(-7.4,8.9),r(-6.8,4.8),r(-6.6,0),r(-6.6,-4.6)],4),T=[];for(let l=0;l<9;l++){let m=-4.4+l*1.75;if(m>10.5)break;let F=y(m)-2.25;T.push(Ft(s(F,m+1.4),s(F+1.6,m),.32*t))}let R=X(e.palate),A=X(e.jawBone).filter(l=>l[0]>.8*t),b=[s(1.6,0)[0],s(0,2.9)[1]+.6*c],M=[];for(let l=0;l<4;l++){let m=a[1]-(.9+l*1)*t;if(m<-4.4)break;M.push([[a[0]+.8*t,m],[a[0]+1.05*t,m-.05],[a[0]+1.05*t,m-.5*t],[a[0]+.82*t,m-.45*t],[a[0]+.8*t,m]])}return{skinLower:[...w,...h.slice().reverse()],skinUpper:[...p,...g.slice(1),...v.slice(1)],skull:Y([r(7,16.2),r(7.3,18.5),r(6,20.7),r(3,22.1),r(-2,22),r(-6.3,19.2),r(-7.9,15.3),r(-7.4,12.6),r(-4.6,12.2),r(-2.2,13.3),r(1,13.7),r(4.1,14.1),r(6.2,14.9)],4),eye:nt(r(6.5,15.4),1.1*t,.95*t),vertebrae:T,nasal:Y([r(.3,11.2),r(1.1,10.25),r(2.7,10.75),r(4.6,10.85),r(6.4,10.65),r(7.6,10.85),r(8.45,11.3),r(8,12.2),r(6.7,13.4),r(4.4,13.9),r(1.8,13.6),r(.2,12.6)],4),turbinates:[[3,11.45,2.1,.32],[3.5,12.45,1.9,.3],[4,13.3,1.45,.22]].map(([l,m,F,I])=>nt(r(l,m),F*t,I*t,-.04)),palNasal:R.map(l=>[l[0],l[1]+.55*t]),jawLower:A,jawUpper:A.map(l=>[l[0],l[1]+.75*t]),hyoid:nt(b,.5*t,.28*t,.3,28),thyroid:[[a[0]+.75*t,a[1]-1.6*t],[a[0]+1.75*t,a[1]-.6*t],[a[0]+1.95*t,a[1]+1.2*t],[a[0]+1.45*t,a[1]+1.9*t],[a[0]+1.15*t,a[1]+1.1*t],[a[0]+1.3*t,a[1]-.4*t],[a[0]+.75*t,a[1]-1.6*t]],trachea:[[[a[0]-.65*t,a[1]],[a[0]-.75*t,-4.8]],[[a[0]+.75*t,a[1]],[a[0]+.95*t,-4.8]]],rings:M,folds:[[[a[0]-.62*t,a[1]+.05],[a[0]-.1,a[1]+.12*t],[a[0]-.62*t,a[1]+.32*t],[a[0]-.62*t,a[1]+.05]],[[a[0]+.72*t,a[1]+.05],[a[0]+.12,a[1]+.12*t],[a[0]+.72*t,a[1]+.32*t],[a[0]+.72*t,a[1]+.05]]],view:{x0:-7.5*t,x1:10.25*t,y0:-4.55,y1:19.9*t}}}export{Tt as ARTICULATOR_NAMES,rt as TractModel,Y as catmullRom,q as geometryDrawing,E as handlePoint,It as headProfile,Ot as mouthHandles,X as pairs,pt as phonemeTargets,St as settingsForHandle};
|
|
3
3
|
//# sourceMappingURL=view.js.map
|
package/dist/view.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/view/drawing.ts", "../src/engines/vowel-solver.ts", "../src/view/tract.ts", "../src/view/handles.ts", "../src/view/head.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * The anatomy around the air, for a side view: the whole tongue (root, arc, blade, underside, floor of\n * the mouth), each lip with its outer face, the upper and lower incisors, the jaw bone, the soft palate,\n * the epiglottis, the hard palate and the pharynx wall, from the geometry's last evaluate(). CHIMERA's\n * drawing parts (Jameson Hodge, MIT, crates/chimera/src/anatomy/human.rs:1228-1262), which the engine's\n * port leaves out: they are a view's, and this builds them on demand from the points the geometry keeps.\n * View code: it allocates. See THIRD_PARTY_NOTICES.md.\n */\n\nimport type { ChimeraGeometry } from '../engines/vocal-geometry';\n\n/** The drawing's parts: x, y pairs in body cm, glottis at the origin, x forward and y up. */\nexport interface GeometryDrawing {\n /** The body's scale (1 the male body). */\n k: number;\n tongue: number[];\n upperLip: number[];\n lowerLip: number[];\n jawBone: number[];\n upperTeeth: number[];\n lowerTeeth: number[];\n velum: number[];\n epiglottis: number[];\n palate: number[];\n pharynxWall: number[];\n outer: number[];\n inner: number[];\n glottisY: number;\n tongueCenter: [number, number];\n tongueRadius: number;\n /** The jaw's rotation about the condyle, for drawing jaw-carried points. */\n jawCos: number;\n jawSin: number;\n condyle: [number, number];\n pharynxScale: number;\n}\n\n/** The drawing parts of the geometry's last evaluate(), x, y pairs in body cm with the glottis at the origin. */\nexport function geometryDrawing(g: ChimeraGeometry): GeometryDrawing {\n const flat = (...polys: { xs: Float64Array; ys: Float64Array; n: number; from: number }[]): number[] => {\n const out: number[] = [];\n for (const p of polys) for (let i = p.from; i < p.n; i++) out.push(p.xs[i], p.ys[i]);\n return out;\n };\n const poly = (q: { xs: Float64Array; ys: Float64Array; n: number }, from = 0) => ({ xs: q.xs, ys: q.ys, n: q.n, from });\n const k = g.k;\n const floor = { xs: g['floorX'], ys: g['floorY'], n: 3, from: 1 };\n const tongue = flat(poly(g['root']), poly(g['arcPts'], 1), poly(g['blade'], 1), poly(g['under'], 1), floor);\n const bez = (x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, n: number): number[] => {\n const o: number[] = [];\n for (let i = 1; i <= n; i++) {\n const t = i / n;\n const u = 1 - t;\n o.push(u * u * u * x0 + 3 * u * u * t * x1 + 3 * u * t * t * x2 + t * t * t * x3, u * u * u * y0 + 3 * u * u * t * y1 + 3 * u * t * t * y2 + t * t * t * y3);\n }\n return o;\n };\n const jp = (x: number, y: number): [number, number] => {\n g['j'](x, y);\n return [g['r'][0], g['r'][1]];\n };\n const ulE = [g['dUlx'], g['dUly']];\n const llE = [g['dLlx'], g['dLly']];\n const [j81x, j81y] = jp(8.1, 6.3);\n const [j76x, j76y] = jp(7.6, 5.6);\n const upperLip = flat(poly(g['upperLipIn'])).concat(bez(ulE[0], ulE[1], ulE[0] + 0.25 * k, ulE[1] + 0.35 * k, g.pX(8.3), g.pY(9.6), g.pX(7.9), g.pY(10.4), 6));\n const lowerLip = flat(poly(g['lowerLipIn'])).concat(bez(llE[0], llE[1], llE[0] + 0.3 * k, llE[1] - 0.4 * k, j81x, j81y, j76x, j76y, 6));\n const jawBone: number[] = [];\n for (const [x, y] of [[7.25, 6.75], [7.4, 5.4], [6.4, 4.6], [3.5, 4.4], [1.2, 5.2], [-0.6, 7.4], [-1.9, 9.6]]) jawBone.push(...jp(x, y));\n const upperTeeth: number[] = [];\n for (const [x, y] of [[6.15, 9.36], [6.78, 8.7], [7.12, 7.95], [7.38, 8.7], [7.4, 9.3]]) upperTeeth.push(g.pX(x), g.pY(y));\n const lowerTeeth: number[] = [];\n for (let i = 0; i < 4; i++) lowerTeeth.push(g['lowTeethX'][i], g['lowTeethY'][i]);\n lowerTeeth.push(...jp(6.8, 6.0), ...jp(6.4, 6.2), g['lowTeethX'][0], g['lowTeethY'][0]);\n const velum = flat(poly(g['velNasal']));\n for (let i = g['velOral'].n - 1; i >= 0; i--) velum.push(g['velOral'].xs[i], g['velOral'].ys[i]);\n const e = g['dEpi'];\n return {\n k,\n tongue,\n upperLip,\n lowerLip,\n jawBone,\n upperTeeth,\n lowerTeeth,\n velum,\n epiglottis: [e[0], e[1], e[2], e[3], e[4], e[5]],\n palate: flat(poly(g['palate'])),\n pharynxWall: flat(poly(g['pharWall'])),\n outer: flat(poly(g['outer'])),\n inner: flat(poly(g['inner'])),\n glottisY: g['dGlotY'],\n tongueCenter: [g['dBX'], g['dBY']],\n tongueRadius: g['dRR'],\n jawCos: g['cosPhi'],\n jawSin: g['sinPhi'],\n condyle: [g['condX'], g['condY']],\n pharynxScale: g['phScale'],\n };\n}\n", "/*\n * Articulator targets for a vowel given its formants: analysis by synthesis on the voice's own\n * geometry, the method VocalTractLab uses to fit vowel shapes (Birkholz, VTL manual). A posture goes\n * through ChimeraGeometry to an area function, the area function through a chain of cylindrical\n * sections (closed glottis, lips radiating through an end-correction inertance) to its resonances, and\n * a bounded Nelder-Mead search over the jaw, the tongue body's x and y, the tongue root and the lips'\n * aperture and protrusion finds the posture whose first three resonances are nearest the target on the\n * Bark scale.\n *\n * The tube has rigid walls, which put F1 low; the voice's walls yield. The correction is the classic\n * wall resonance in quadrature, F1 = sqrt(F1_rigid^2 + FW^2), with FW fitted to the engine's own General\n * American vowels (MEASURED: FW 220 Hz brings /i/ /u/ /\u025B/ /\u0251/ within a few percent; F2 agreed within 2\n * percent before any correction). Solved vowels rendered through the engine land within 1 to 8 percent\n * of their targets (MEASURED; test/engines-physical/vowel-solver.test.ts gates it).\n *\n * Offline and build-time code: it allocates freely and never runs on the audio thread.\n */\n\nimport { ChimeraGeometry, GEOMETRY_BODIES } from './vocal-geometry';\nimport { VOCAL_ARTICULATOR_MAX, VOCAL_ARTICULATOR_MIN, VOCAL_NEUTRAL } from './vocal-tables.gen';\nimport { ART } from './vocal-articulators';\n\n/** Sections per tube in the resonance model. */\nconst SECTIONS = 24;\nconst SOUND_SPEED = 35000;\nconst AIR_DENSITY = 0.00114;\n/** The yielding wall's resonance, Hz, added to the rigid tube's F1 in quadrature (MEASURED, see above). */\nexport const WALL_HZ = 220;\n/** The articulators the search moves. */\nconst FREE_DEFAULT = [ART.jaw, ART.tbX, ART.tbY, ART.root, ART.lipAp, ART.lipProt] as const;\n\n/** Target formants, Hz; F3 optional. */\nexport interface VowelTarget {\n f1: number;\n f2: number;\n f3?: number;\n}\n\n/** A fitted posture and what the model predicts for it. */\nexport interface VowelFit {\n /** All 17 articulators. */\n posture: Float64Array;\n /** Predicted F1 (wall corrected), F2, F3, Hz. */\n formants: [number, number, number];\n /** Remaining cost, squared Bark. */\n cost: number;\n}\n\n/** Hz to Bark (Traunmuller-style arctangent form used across vowel normalization work). */\nexport function bark(f: number): number {\n return 13 * Math.atan(0.00076 * f) + 3.5 * Math.atan((f / 7500) ** 2);\n}\n\n/** One body's geometry, built once per solve. */\nexport function vowelGeometry(body: number): ChimeraGeometry {\n return new ChimeraGeometry(GEOMETRY_BODIES[Math.max(0, Math.min(GEOMETRY_BODIES.length - 1, body))]);\n}\n\n/** The area function (cm^2) and section lengths (cm) of a posture, glottis to lips. */\nexport function areaFunction(g: ChimeraGeometry, posture: ArrayLike<number>): { areas: number[]; lengths: number[] } {\n const ph = new Float64Array(SECTIONS);\n const or = new Float64Array(SECTIONS);\n const pm = new Float64Array(SECTIONS);\n const om = new Float64Array(SECTIONS);\n g.evaluate(posture);\n g.resampleInto(ph, or, pm, om, SECTIONS, SECTIONS);\n const areas: number[] = [];\n const lengths: number[] = [];\n for (let i = 0; i < SECTIONS; i++) {\n areas.push(Math.max(ph[i], 0.05));\n lengths.push(g.phLen / SECTIONS);\n }\n for (let i = 0; i < SECTIONS; i++) {\n areas.push(Math.max(or[i], 0.05));\n lengths.push(g.orLen / SECTIONS);\n }\n return { areas, lengths };\n}\n\n/** Resonance peaks (Hz) of the rigid tube, glottis closed and lips radiating, up to maxHz. */\nexport function tubeResonances(areas: number[], lengths: number[], maxHz = 4500): number[] {\n const peaks: number[] = [];\n let prev = 0;\n let prev2 = 0;\n const step = 5;\n for (let f = 50; f <= maxHz; f += step) {\n const w = 2 * Math.PI * f;\n let ar = 1, ai = 0, br = 0, bi = 0, cr = 0, ci = 0, dr = 1, di = 0;\n for (let s = 0; s < areas.length; s++) {\n const k = w / SOUND_SPEED;\n const kl = k * lengths[s];\n const z = (AIR_DENSITY * SOUND_SPEED) / areas[s];\n const cs = Math.cos(kl);\n const sn = Math.sin(kl);\n // a small loss in each section keeps the peaks finite\n const loss = 0.003 * kl;\n const mar = cs, mai = -loss * sn, mbr = loss * z * cs, mbi = z * sn;\n const mcr = (loss * cs) / z, mci = sn / z, mdr = cs, mdi = -loss * sn;\n const nar = ar * mar - ai * mai + br * mcr - bi * mci;\n const nai = ar * mai + ai * mar + br * mci + bi * mcr;\n const nbr = ar * mbr - ai * mbi + br * mdr - bi * mdi;\n const nbi = ar * mbi + ai * mbr + br * mdi + bi * mdr;\n const ncr = cr * mar - ci * mai + dr * mcr - di * mci;\n const nci = cr * mai + ci * mar + dr * mci + di * mcr;\n const ndr = cr * mbr - ci * mbi + dr * mdr - di * mdi;\n const ndi = cr * mbi + ci * mbr + dr * mdi + di * mdr;\n ar = nar; ai = nai; br = nbr; bi = nbi; cr = ncr; ci = nci; dr = ndr; di = ndi;\n }\n // lips: pressure = Zr * flow, an end-corrected inertance plus a small radiation resistance\n const al = areas[areas.length - 1];\n const r = Math.sqrt(al / Math.PI);\n const zri = (w * AIR_DENSITY * 0.8 * r) / al;\n const zrr = ((AIR_DENSITY * SOUND_SPEED) / al) * 0.5 * ((w * r) / SOUND_SPEED) ** 2;\n const gr = cr * zrr - ci * zri + dr;\n const gi = cr * zri + ci * zrr + di;\n const h = 1 / Math.hypot(gr, gi);\n if (prev > prev2 && prev > h && f > 150) peaks.push(f - step);\n prev2 = prev;\n prev = h;\n }\n return peaks;\n}\n\n/** F1 (wall corrected), F2 and F3 a posture gives, Hz. */\nexport function predictFormants(g: ChimeraGeometry, posture: ArrayLike<number>): [number, number, number] {\n const { areas, lengths } = areaFunction(g, posture);\n const p = tubeResonances(areas, lengths);\n return [Math.sqrt((p[0] ?? NaN) ** 2 + WALL_HZ * WALL_HZ), p[1] ?? NaN, p[2] ?? NaN];\n}\n\n/** What a solve may move and how much F3 counts. */\nexport interface SolveOptions {\n /** Articulator indices free to move; default the jaw, tongue body, root and lips (FREE). */\n free?: readonly number[];\n /** F3's weight against F1 and F2's 1 in the Bark cost; default 0.5. */\n f3Weight?: number;\n}\n\n/**\n * The posture nearest `start` (a full 17-articulator row) whose formants match `target`. By default only\n * the jaw, tongue body, root and lips move; everything else keeps start's values. An r-coloured vowel,\n * whose F3 is set by the tongue tip, frees the tip as well (`opts.free`).\n */\nexport function solveVowel(g: ChimeraGeometry, target: VowelTarget, start: ArrayLike<number> = VOCAL_NEUTRAL, opts: SolveOptions = {}): VowelFit {\n const FREE = opts.free ?? FREE_DEFAULT;\n const w3 = opts.f3Weight ?? 0.5;\n const base = Float64Array.from(start);\n const lo = FREE.map((k) => VOCAL_ARTICULATOR_MIN[k]);\n const hi = FREE.map((k) => VOCAL_ARTICULATOR_MAX[k]);\n const posture = (x: number[]): Float64Array => {\n const a = Float64Array.from(base);\n FREE.forEach((k, i) => (a[k] = Math.min(hi[i], Math.max(lo[i], x[i]))));\n return a;\n };\n const cost = (x: number[]): number => {\n let c = 0;\n FREE.forEach((k, i) => {\n const v = Math.min(hi[i], Math.max(lo[i], x[i]));\n c += (x[i] - v) ** 2 * 100;\n // a light pull toward the start, so of the postures that fit, the nearest wins\n c += 0.002 * ((x[i] - base[k]) / (hi[i] - lo[i])) ** 2;\n });\n const f = predictFormants(g, posture(x));\n if (!(f[0] > 0 && f[1] > 0)) return 1e9;\n c += (bark(f[0]) - bark(target.f1)) ** 2 + (bark(f[1]) - bark(target.f2)) ** 2;\n if (target.f3 !== undefined && f[2] > 0) c += w3 * (bark(f[2]) - bark(target.f3)) ** 2;\n return c;\n };\n const x = nelderMead(cost, FREE.map((k) => base[k]), FREE.map((_, i) => 0.12 * (hi[i] - lo[i])), 600);\n const best = posture(x.point);\n return { posture: best, formants: predictFormants(g, best), cost: x.value };\n}\n\n/** Minimize f from x0 with initial steps; plain Nelder-Mead (reflect 1, expand 2, contract and shrink 0.5). */\nfunction nelderMead(f: (x: number[]) => number, x0: number[], steps: number[], iterations: number): { point: number[]; value: number } {\n const n = x0.length;\n let pts: number[][] = [x0.slice()];\n for (let i = 0; i < n; i++) {\n const p = x0.slice();\n p[i] += steps[i];\n pts.push(p);\n }\n let vals = pts.map(f);\n for (let it = 0; it < iterations; it++) {\n const order = vals.map((v, i) => [v, i] as const).sort((a, b) => a[0] - b[0]).map((p) => p[1]);\n pts = order.map((i) => pts[i]);\n vals = order.map((i) => vals[i]);\n const c = pts[0].map((_, j) => pts.slice(0, n).reduce((s, p) => s + p[j], 0) / n);\n const worst = pts[n];\n const r = c.map((v, j) => v + (v - worst[j]));\n const fr = f(r);\n if (fr < vals[0]) {\n const e = c.map((v, j) => v + 2 * (v - worst[j]));\n const fe = f(e);\n if (fe < fr) [pts[n], vals[n]] = [e, fe];\n else [pts[n], vals[n]] = [r, fr];\n } else if (fr < vals[n - 1]) {\n [pts[n], vals[n]] = [r, fr];\n } else {\n const k = c.map((v, j) => v + 0.5 * (worst[j] - v));\n const fk = f(k);\n if (fk < vals[n]) [pts[n], vals[n]] = [k, fk];\n else\n for (let i = 1; i <= n; i++) {\n pts[i] = pts[i].map((v, j) => pts[0][j] + 0.5 * (v - pts[0][j]));\n vals[i] = f(pts[i]);\n }\n }\n }\n let best = 0;\n for (let i = 1; i <= n; i++) if (vals[i] < vals[best]) best = i;\n return { point: pts[best], value: vals[best] };\n}\n", "/*\n * The vocal tract as a picture: what the voice's mouth is doing, for a UI to draw. It runs the same\n * geometry the engine runs (ChimeraGeometry) on the same per-phoneme articulator targets\n * (vocal-tables.gen.ts), with the velum lowered for a nasal as the planner lowers it, moving each\n * articulator toward its target critically damped at the engine's own speeds (VOCAL_ARTICULATOR_HZ), so a consonant's targets overlay the vowel's posture\n * the way the engine's do: what a consonant does not set stays where the vowel put it.\n *\n * It does not listen to the audio thread; it follows the plan. Given the spans a sung or spoken\n * line returns, call target() with the phoneme at each moment and step() with the time passed.\n * Main-thread code: it allocates on construction and in shape(), never per sample.\n */\n\nimport { ChimeraGeometry, GEOMETRY_BODIES } from '../engines/vocal-geometry';\nimport { geometryDrawing, type GeometryDrawing } from './drawing';\nimport { settingOffsets, type SettingValues } from '../engines/vocal-settings';\nimport { predictFormants } from '../engines/vowel-solver';\nimport {\n VOCAL_ARTICULATOR_HZ,\n VOCAL_ARTICULATOR_MAX,\n VOCAL_ARTICULATOR_MIN,\n VOCAL_ARTICULATOR_NAMES,\n VOCAL_BODIES,\n VOCAL_NEUTRAL,\n VOCAL_TABLE_PHONEMES,\n} from '../engines/vocal-tables.gen';\nimport { BEAT_PREFIX } from '../engines/vocal-beats';\nimport { VOCAL_ACOUSTICS, vocalPhonemeIndex } from '../engines/vocal-phonemes';\nimport { ART } from '../engines/vocal-articulators';\n\n/* The velum's target for a nasal: the gesture the planner keys (vocal-planner.ts, M_NASAL). */\nconst NASAL_VELUM = 0.45;\n\n/*\n * A beat drawn as the planner makes it (vocal-planner.ts, beatScore): the consonant it is built on,\n * held, with the articulators the beat moves past it. An ejective shows its larynx rising, a click\n * its hollowed dorsum, the hum its lowered velum. '.' is the beatboxer's ready posture.\n */\nconst BEAT_VIEW: Readonly<Record<string, { base: string; set?: Partial<Record<keyof typeof ART, number>> }>> = {\n '.': { base: '\u0259', set: { jaw: 0.4, lipAp: 0.25, lipProt: 0.1 } },\n B: { base: 'p', set: { jaw: 0.3, tbY: 7.7, larynx: 1.55 } },\n t: { base: 't', set: { jaw: 0.3 } },\n tss: { base: 's' },\n Pf: { base: 'f' },\n K: { base: 'k', set: { jaw: 0.35, larynx: 1.55 } },\n '^K': { base: 'k', set: { jaw: 0.35, tbY: 7.4 } },\n '!': { base: 't', set: { dorsum: 1 } },\n 'P!': { base: 'p', set: { jaw: 1.6, dorsum: 1 } },\n kch: { base: '\u0283' },\n m: { base: 'm' },\n ch: { base: '\u0283', set: { jaw: 0.3 } },\n Psh: { base: '\u0283' },\n};\n\n/** The articulators, in the order postures use. */\nexport const ARTICULATOR_NAMES = VOCAL_ARTICULATOR_NAMES;\n\n/** A drawable midsagittal view of the tract, centimetres, glottis to lips. */\nexport interface TractShape {\n /** The lower wall (the tongue, the floor of the mouth, the lower lip), as x, y pairs. */\n lower: Float32Array;\n /** The upper wall (the back of the pharynx, the palate, the upper lip), as x, y pairs. */\n upper: Float32Array;\n /** Cross-sectional area at each point, cm^2. */\n area: Float32Array;\n /** Opening into the nose, cm^2 (0 for an oral sound, larger for m, n, \u014B). */\n velumPort: number;\n /** Area between the lips, cm^2. */\n lipArea: number;\n /** The tongue tip. */\n tipX: number;\n tipY: number;\n /** Each point's region: 1 the pharynx, 2 the mouth, 3 the lips. */\n region: Uint8Array;\n /** Index of the first mouth point, where the pharynx turns into the mouth below the velum (-1 if none). */\n split: number;\n /** Index of the narrowest point past the glottis, where the air is fastest (a closure if its area is near 0). */\n constriction: number;\n /** The anatomy around the air: tongue, lips, teeth, jaw, soft palate, epiglottis (view/drawing.ts). */\n drawing: GeometryDrawing;\n}\n\n/** Settings and anatomy for the model: SettingValues plus size and pharynx (engines/vocal-settings.ts). */\nexport interface MouthSettings extends SettingValues {\n size?: number;\n pharynx?: number;\n}\n\n/**\n * The articulator targets of one phoneme for a body (0 male, 1 female, 2 child), 17 values, NaN\n * where the phoneme sets none. Undefined for a symbol the voice does not have.\n */\nexport function phonemeTargets(body: number, ipa: string): Float64Array | undefined {\n const idx = vocalPhonemeIndex(ipa);\n if (idx < 0) return undefined;\n const b = VOCAL_BODIES[Math.max(0, Math.min(VOCAL_BODIES.length - 1, Math.round(body)))];\n if (VOCAL_TABLE_PHONEMES[idx] === undefined) return undefined;\n const vowel = b.vowelTargets[idx];\n return Float64Array.from(vowel.some((v) => v === v) ? vowel : b.consonantTargets[idx]);\n}\n\nexport class TractModel {\n /** The current posture, 17 articulators. */\n readonly posture = Float64Array.from(VOCAL_NEUTRAL);\n private readonly velocity = new Float64Array(VOCAL_NEUTRAL.length);\n private readonly goal = Float64Array.from(VOCAL_NEUTRAL);\n /** The vowel posture a consonant overlays. */\n private readonly vowelGoal = Float64Array.from(VOCAL_NEUTRAL);\n private geometry: ChimeraGeometry;\n private bodyIndex = 0;\n /** The phoneme the model is moving toward. */\n current = '_';\n\n /** The settings' articulator offsets, laid over every target. */\n private readonly offsets = new Float64Array(VOCAL_NEUTRAL.length);\n private settingValues: MouthSettings = {};\n /** Articulators the current consonant sets itself (its own targets win over a setting). */\n private readonly own = new Uint8Array(VOCAL_NEUTRAL.length);\n\n constructor(body = 0) {\n this.bodyIndex = clampBody(body);\n this.geometry = new ChimeraGeometry(GEOMETRY_BODIES[this.bodyIndex]);\n }\n\n /**\n * Voice settings and anatomy, as the engine's params of the same names take them (jawSet,\n * lipRound, larynxSet, nasal, twang, ..., size, pharynx): the mouth then shows what the voice does.\n */\n setSettings(values: MouthSettings): void {\n this.settingValues = { ...values };\n settingOffsets(values, this.offsets);\n this.layBody();\n if (this.current !== '_') this.target(this.current);\n else this.applyOffsets();\n }\n\n /** The settings last given. */\n get settings(): MouthSettings {\n return { ...this.settingValues };\n }\n\n private layBody(): void {\n const base = GEOMETRY_BODIES[this.bodyIndex];\n const size = clampNum(this.settingValues.size, 0.8, 1.25, 1);\n const ph = clampNum(this.settingValues.pharynx, 0.8, 1.25, 1);\n this.geometry.setBody(base.scale * size, base.pharynx * ph, base.tongueRadius, base.lipWidth);\n }\n\n private applyOffsets(): void {\n for (let k = 0; k < this.goal.length; k++) if (!this.own[k]) this.goal[k] += this.offsets[k];\n clampPosture(this.goal);\n }\n\n /**\n * Hold an exact posture: the given articulators (by name, ARTICULATOR_NAMES) at these values, the\n * rest where they are. `snap` jumps there; otherwise step() moves there at the engine's speeds.\n */\n pose(values: Partial<Record<string, number>>, snap = true): void {\n for (const [name, v] of Object.entries(values)) {\n const k = (VOCAL_ARTICULATOR_NAMES as readonly string[]).indexOf(name);\n if (k < 0 || typeof v !== 'number' || !Number.isFinite(v)) continue;\n this.goal[k] = Math.max(VOCAL_ARTICULATOR_MIN[k], Math.min(VOCAL_ARTICULATOR_MAX[k], v));\n if (snap) {\n this.posture[k] = this.goal[k];\n this.velocity[k] = 0;\n }\n }\n this.current = 'pose';\n }\n\n /** The current posture by articulator name. */\n postureByName(): Record<string, number> {\n const o: Record<string, number> = {};\n VOCAL_ARTICULATOR_NAMES.forEach((n, k) => (o[n] = this.posture[k]));\n return o;\n }\n\n /** The first three resonances of the current shape, Hz (the vowel solver's tube, walls corrected). */\n formants(): [number, number, number] {\n return predictFormants(this.geometry, this.posture);\n }\n\n /** The current posture's drawing parts and tongue tip, without the rest of shape(). */\n drawingNow(): GeometryDrawing & { tipX: number; tipY: number } {\n const g = this.geometry;\n g.evaluate(this.posture);\n return Object.assign(geometryDrawing(g), { tipX: g.tipX, tipY: g.tipY });\n }\n\n /** Change body (0 male, 1 female, 2 child, rounded). */\n setBody(body: number): void {\n const b = clampBody(body);\n if (b === this.bodyIndex) return;\n this.bodyIndex = b;\n this.geometry = new ChimeraGeometry(GEOMETRY_BODIES[b]);\n this.layBody();\n if (this.current !== '_') this.target(this.current);\n }\n\n /**\n * Move toward a phoneme: a vowel sets the whole posture, a consonant its own articulators over the\n * vowel's, silence ('_') the rest position. False for a symbol the voice does not have.\n */\n target(ipa: string): boolean {\n if (ipa.startsWith(BEAT_PREFIX)) return this.targetBeat(ipa);\n if (ipa === '_' || ipa === '') {\n this.goal.set(VOCAL_NEUTRAL);\n this.vowelGoal.set(VOCAL_NEUTRAL);\n this.own.fill(0);\n this.applyOffsets();\n this.current = '_';\n return true;\n }\n const row = phonemeTargets(this.bodyIndex, ipa);\n if (!row) return false;\n const idx = vocalPhonemeIndex(ipa);\n const isVowel = VOCAL_BODIES[this.bodyIndex].vowelTargets[idx].some((v) => v === v);\n for (let k = 0; k < row.length; k++) {\n const v = row[k];\n if (isVowel) {\n this.vowelGoal[k] = v === v ? v : VOCAL_NEUTRAL[k];\n this.goal[k] = this.vowelGoal[k];\n this.own[k] = 0;\n } else {\n this.goal[k] = v === v ? v : this.vowelGoal[k];\n this.own[k] = v === v ? 1 : 0;\n }\n }\n // the velum is not in the target tables: the planner lowers it for a nasal, as here\n this.goal[ART.velum] = VOCAL_ACOUSTICS[idx]?.cls === 'nasal' ? NASAL_VELUM : this.vowelGoal[ART.velum];\n this.applyOffsets();\n this.current = ipa;\n return true;\n }\n\n /** A beat token (\"beat:B\", \"beat:Pf>\"): its base consonant with the articulators it moves past it. */\n private targetBeat(token: string): boolean {\n let id = token.slice(BEAT_PREFIX.length);\n if (id.length > 1 && id.endsWith('>')) id = id.slice(0, -1);\n const view = BEAT_VIEW[id];\n if (!view) return false;\n if (!this.target(view.base)) return false;\n for (const [name, v] of Object.entries(view.set ?? {})) this.goal[ART[name as keyof typeof ART]] = v as number;\n if (id === 'm') this.goal[ART.velum] = 0.9;\n this.current = token;\n return true;\n }\n\n /** Advance the articulators by dt seconds, critically damped at their own speeds. */\n step(dt: number): void {\n if (!(dt > 0)) return;\n const n = Math.min(200, Math.ceil(dt / 0.002));\n const h = dt / n;\n for (let i = 0; i < n; i++) {\n for (let k = 0; k < this.posture.length; k++) {\n const w = 2 * Math.PI * VOCAL_ARTICULATOR_HZ[k];\n const acc = w * w * (this.goal[k] - this.posture[k]) - 2 * w * this.velocity[k];\n this.velocity[k] += acc * h;\n this.posture[k] += this.velocity[k] * h;\n if (this.posture[k] < VOCAL_ARTICULATOR_MIN[k]) this.posture[k] = VOCAL_ARTICULATOR_MIN[k];\n if (this.posture[k] > VOCAL_ARTICULATOR_MAX[k]) this.posture[k] = VOCAL_ARTICULATOR_MAX[k];\n }\n }\n }\n\n /** Jump straight to the target. */\n settle(): void {\n this.posture.set(this.goal);\n this.velocity.fill(0);\n }\n\n /** The tract the current posture makes. */\n shape(): TractShape {\n const g = this.geometry;\n g.evaluate(this.posture);\n const n = g.gN;\n const lower = new Float32Array(2 * n);\n const upper = new Float32Array(2 * n);\n const area = new Float32Array(n);\n const region = Uint8Array.from(g.gRegion.subarray(0, n));\n for (let i = 0; i < n; i++) {\n lower[2 * i] = g.gInX[i];\n lower[2 * i + 1] = g.gInY[i];\n upper[2 * i] = g.gOutX[i];\n upper[2 * i + 1] = g.gOutY[i];\n area[i] = g.gArea[i];\n }\n return {\n lower,\n upper,\n area,\n velumPort: g.velumPort,\n lipArea: g.lipArea,\n tipX: g.tipX,\n tipY: g.tipY,\n region,\n split: g.splitIndex,\n constriction: narrowest(area),\n drawing: geometryDrawing(g),\n };\n }\n}\n\nfunction clampNum(v: number | undefined, lo: number, hi: number, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? Math.max(lo, Math.min(hi, v)) : dflt;\n}\n\nfunction clampPosture(p: Float64Array): void {\n for (let k = 0; k < p.length; k++) p[k] = Math.max(VOCAL_ARTICULATOR_MIN[k], Math.min(VOCAL_ARTICULATOR_MAX[k], p[k]));\n}\n\n/** The narrowest point past the first few (the glottis end is narrow by anatomy, not by a constriction). */\nfunction narrowest(area: Float32Array): number {\n let best = -1;\n let min = Infinity;\n for (let i = Math.min(4, area.length - 1); i < area.length; i++) {\n if (area[i] < min) {\n min = area[i];\n best = i;\n }\n }\n return best;\n}\n\nfunction clampBody(body: number): number {\n return Math.max(0, Math.min(GEOMETRY_BODIES.length - 1, Math.round(Number.isFinite(body) ? body : 0)));\n}\n", "/*\n * The parts of the mouth a person can grab: where each handle sits on a drawing, and the voice\n * settings that put a handle where the pointer is. The handles are the settings (tongue: tongueFront\n * and tongueHigh; jaw: jawSet; lips: lipRound and lipOpen; velum: nasal; larynx: larynxSet), so a\n * dragged mouth is one the engine plays. View code over TractModel's public API.\n */\n\nimport type { GeometryDrawing } from './drawing';\nimport type { MouthSettings, TractModel } from './tract';\n\n/** The parts of the mouth a person can grab and move. */\nexport type MouthHandle = 'tongue' | 'tip' | 'jaw' | 'lips' | 'velum' | 'larynx';\n\n/** Where a handle sits on a drawing, body cm. */\nexport function handlePoint(d: GeometryDrawing & { tipX: number; tipY: number }, h: MouthHandle): [number, number] {\n if (h === 'tongue') return [d.tongueCenter[0], d.tongueCenter[1]];\n if (h === 'tip') return [d.tipX, d.tipY];\n if (h === 'jaw') return [d.lowerTeeth[4], d.lowerTeeth[5]];\n if (h === 'velum') return [d.velum[10], d.velum[11]];\n if (h === 'larynx') return [0.5 * (d.inner[0] + d.outer[0]), d.glottisY];\n // the lips: between the front-most points of the two\n const front = (pts: number[]): [number, number] => {\n let bi = 0;\n for (let i = 2; i < pts.length; i += 2) if (pts[i] > pts[bi]) bi = i;\n return [pts[bi], pts[bi + 1]];\n };\n const u = front(d.upperLip);\n const l = front(d.lowerLip);\n return [0.5 * (u[0] + l[0]) + 0.15 * d.k, 0.5 * (u[1] + l[1])];\n}\n\n/** Where each handle is now, body cm. */\nexport function mouthHandles(model: TractModel): Record<MouthHandle, [number, number]> {\n const s = model.drawingNow();\n return {\n tongue: handlePoint(s, 'tongue'),\n tip: handlePoint(s, 'tip'),\n jaw: handlePoint(s, 'jaw'),\n lips: handlePoint(s, 'lips'),\n velum: handlePoint(s, 'velum'),\n larynx: handlePoint(s, 'larynx'),\n };\n}\n\n/**\n * The settings that put a handle at body point (x, y), cm, holding sound `ipa`: the handles are the\n * settings (tongue: tongueFront and tongueHigh; jaw: jawSet; lips: lipRound forward and lipOpen up\n * and down; velum: nasal; larynx: larynxSet), so a dragged mouth is one the voice can play. A\n * coordinate-wise golden-section search on the handle's distance to the point. Leaves the model\n * showing the result.\n */\nexport function settingsForHandle(model: TractModel, handle: MouthHandle, x: number, y: number, ipa: string): MouthSettings {\n const PARAMS: Record<MouthHandle, string[]> = {\n tongue: ['tongueFront', 'tongueHigh'],\n tip: ['tongueFront', 'tongueHigh'],\n jaw: ['jawSet'],\n lips: ['lipRound', 'lipOpen'],\n velum: ['nasal'],\n larynx: ['larynxSet'],\n };\n const names = PARAMS[handle];\n const cur: MouthSettings = model.settings;\n const range = (n: string): [number, number] => (n === 'nasal' ? [0, 1] : [-1, 1]);\n const cost = (): number => {\n model.setSettings(cur);\n model.target(ipa);\n model.settle();\n const p = handlePoint(model.drawingNow(), handle);\n return Math.hypot(p[0] - x, p[1] - y);\n };\n const r = (Math.sqrt(5) - 1) / 2;\n for (let round = 0; round < (names.length > 1 ? 3 : 1); round++) {\n for (const n of names) {\n let [a, b] = range(n);\n const at = (v: number) => {\n (cur as Record<string, number>)[n] = v;\n return cost();\n };\n let c = b - r * (b - a);\n let d = a + r * (b - a);\n let fc = at(c);\n let fd = at(d);\n for (let i = 0; i < 18; i++) {\n if (fc < fd) {\n b = d;\n d = c;\n fd = fc;\n c = b - r * (b - a);\n fc = at(c);\n } else {\n a = c;\n c = d;\n fc = fd;\n d = a + r * (b - a);\n fd = at(d);\n }\n }\n (cur as Record<string, number>)[n] = Math.round(((a + b) / 2) * 100) / 100;\n }\n }\n model.setSettings(cur);\n model.target(ipa);\n model.settle();\n return cur;\n}\n", "/*\n * The head around the vocal tract, for a side view: skin (neck, chin, lips, nose, brow, crown), the\n * skull and eye, the cervical vertebrae, the nasal cavity and its turbinates, the hard palate's\n * nasal face, the jaw bone's two edges, the hyoid, the thyroid cartilage, the trachea and its rings,\n * and the vocal folds, in body cm with the glottis at the origin (x forward, y up). Built from one\n * frame's drawing (view/drawing.ts), so the jaw, lips and larynx move with the voice.\n *\n * Ported from CHIMERA by Jameson Hodge (MIT, https://github.com/jamesondh/chimera-vocal-synth,\n * src/ui/render/profile.ts, buildProfile and its helpers). Changes: points are [x, y] pairs, the\n * frame's fields come from bellows' geometry drawing, the larynx height is read back from the\n * glottis, and the brain's outline is left out. See THIRD_PARTY_NOTICES.md. View code: it allocates.\n */\n\nimport type { GeometryDrawing } from './drawing';\n\nexport type Pt = [number, number];\n\nexport interface HeadProfile {\n skinLower: Pt[];\n skinUpper: Pt[];\n skull: Pt[];\n eye: Pt[];\n vertebrae: Pt[][];\n nasal: Pt[];\n turbinates: Pt[][];\n palNasal: Pt[];\n jawLower: Pt[];\n jawUpper: Pt[];\n hyoid: Pt[];\n thyroid: Pt[];\n trachea: Pt[][];\n rings: Pt[][];\n folds: Pt[][];\n /** The whole head's extent, body cm, for a view that frames it. */\n view: { x0: number; x1: number; y0: number; y1: number };\n}\n\n/** A Catmull-Rom spline through pts, `seg` points a span. */\nexport function catmullRom(pts: Pt[], seg: number): Pt[] {\n const out: Pt[] = [];\n if (pts.length < 2) return pts.slice();\n for (let i = 0; i < pts.length - 1; i++) {\n const p0 = pts[i - 1] ?? pts[i];\n const p1 = pts[i];\n const p2 = pts[i + 1];\n const p3 = pts[i + 2] ?? p2;\n for (let s = 0; s < seg; s++) {\n const t = s / seg;\n const t2 = t * t;\n const t3 = t2 * t;\n const f = (a: number, b: number, c: number, d: number) => 0.5 * (2 * b + (-a + c) * t + (2 * a - 5 * b + 4 * c - d) * t2 + (-a + 3 * b - 3 * c + d) * t3);\n out.push([f(p0[0], p1[0], p2[0], p3[0]), f(p0[1], p1[1], p2[1], p3[1])]);\n }\n }\n out.push(pts[pts.length - 1]);\n return out;\n}\n\nfunction ellipse(c: Pt, rx: number, ry: number, rot = 0, n = 40): Pt[] {\n const cr = Math.cos(-rot);\n const sr = Math.sin(-rot);\n const o: Pt[] = [];\n for (let i = 0; i <= n; i++) {\n const an = (i / n) * Math.PI * 2;\n const x = Math.cos(an) * rx;\n const y = Math.sin(an) * ry;\n o.push([c[0] + x * cr - y * sr, c[1] + x * sr + y * cr]);\n }\n return o;\n}\n\nfunction roundRect(p0: Pt, p1: Pt, r: number): Pt[] {\n const x0 = Math.min(p0[0], p1[0]);\n const x1 = Math.max(p0[0], p1[0]);\n const y0 = Math.min(p0[1], p1[1]);\n const y1 = Math.max(p0[1], p1[1]);\n const rr = Math.min(r, (x1 - x0) / 2, (y1 - y0) / 2);\n const o: Pt[] = [];\n const corner = (cx: number, cy: number, a0: number) => {\n for (let i = 0; i <= 6; i++) {\n const an = a0 + (i / 6) * (Math.PI / 2);\n o.push([cx + Math.cos(an) * rr, cy + Math.sin(an) * rr]);\n }\n };\n corner(x1 - rr, y1 - rr, 0);\n corner(x0 + rr, y1 - rr, Math.PI / 2);\n corner(x0 + rr, y0 + rr, Math.PI);\n corner(x1 - rr, y0 + rr, (3 * Math.PI) / 2);\n o.push(o[0]);\n return o;\n}\n\n/** x, y pairs to points. */\nexport function pairs(flat: readonly number[]): Pt[] {\n const o: Pt[] = [];\n for (let i = 0; i + 1 < flat.length; i += 2) o.push([flat[i], flat[i + 1]]);\n return o;\n}\n\n/** The head around one frame of the tract. */\nexport function headProfile(d: GeometryDrawing): HeadProfile {\n const k = d.k;\n const ph = d.pharynxScale;\n // template to body (human.rs:685): the oral region's x compressed, the pharynx's y scaled\n const P = (x: number, y: number): Pt => [(x > 0.5 ? 0.5 + (x - 0.5) * 0.86 : x) * k, (y < 7 ? 7 - (7 - y) * ph : y) * k];\n // the face in true body coordinates (P compresses x, which would flatten the nose)\n const B = (x: number, y: number): Pt => [x * k, (y < 7 ? 7 - (7 - y) * ph : y) * k];\n const [cx, cy] = d.condyle;\n const J = (x: number, y: number): Pt => {\n const [px, py] = P(x, y);\n const dx = px - cx;\n const dy = py - cy;\n return [cx + dx * d.jawCos - dy * d.jawSin, cy + dx * d.jawSin + dy * d.jawCos];\n };\n const lar = d.glottisY - P(0, 0)[1];\n const g: Pt = [0, d.glottisY];\n const wallX = (y: number) => -1.2 - 0.025 * y;\n const upper = pairs(d.upperLip);\n const lower = pairs(d.lowerLip);\n const ulOut = upper.slice(7);\n const llOut = lower.slice(7);\n const neckFront = catmullRom([B(2.3, -4.6), B(2.38, -1.5), B(2.52, 0.4), B(3.0, 1.7), J(5.3, 3.0), J(7.25, 3.35), J(7.95, 4.6), J(7.55, 5.7)], 4);\n const face = catmullRom([ulOut[ulOut.length - 1], B(7.05, 10.6), B(7.75, 10.78), B(8.75, 11.05), B(9.25, 11.65), B(8.95, 12.6), B(8.35, 13.9), B(7.7, 15.0), B(7.95, 16.1), B(7.9, 18.1), B(6.9, 20.5)], 4);\n const cranium = catmullRom([B(6.9, 20.5), B(3.0, 22.9), B(-2.2, 22.7), B(-6.9, 19.6), B(-8.7, 15.4), B(-8.3, 11.9), B(-7.4, 8.9), B(-6.8, 4.8), B(-6.6, 0), B(-6.6, -4.6)], 4);\n const vertebrae: Pt[][] = [];\n for (let i = 0; i < 9; i++) {\n const y0 = -4.4 + i * 1.75;\n if (y0 > 10.5) break;\n const x0 = wallX(y0) - 2.25;\n vertebrae.push(roundRect(P(x0, y0 + 1.4), P(x0 + 1.6, y0), 0.32 * k));\n }\n const palate = pairs(d.palate);\n const jb = pairs(d.jawBone).filter((p) => p[0] > 0.8 * k);\n const hy: Pt = [P(1.6, 0)[0], P(0, 2.9)[1] + 0.6 * lar];\n const rings: Pt[][] = [];\n for (let i = 0; i < 4; i++) {\n const y = g[1] - (0.9 + i * 1.0) * k;\n if (y < -4.4) break;\n rings.push([[g[0] + 0.8 * k, y], [g[0] + 1.05 * k, y - 0.05], [g[0] + 1.05 * k, y - 0.5 * k], [g[0] + 0.82 * k, y - 0.45 * k], [g[0] + 0.8 * k, y]]);\n }\n return {\n skinLower: [...neckFront, ...llOut.slice().reverse()],\n skinUpper: [...ulOut, ...face.slice(1), ...cranium.slice(1)],\n skull: catmullRom([B(7.0, 16.2), B(7.3, 18.5), B(6.0, 20.7), B(3.0, 22.1), B(-2.0, 22.0), B(-6.3, 19.2), B(-7.9, 15.3), B(-7.4, 12.6), B(-4.6, 12.2), B(-2.2, 13.3), B(1.0, 13.7), B(4.1, 14.1), B(6.2, 14.9)], 4),\n eye: ellipse(B(6.5, 15.4), 1.1 * k, 0.95 * k),\n vertebrae,\n nasal: catmullRom([B(0.3, 11.2), B(1.1, 10.25), B(2.7, 10.75), B(4.6, 10.85), B(6.4, 10.65), B(7.6, 10.85), B(8.45, 11.3), B(8.0, 12.2), B(6.7, 13.4), B(4.4, 13.9), B(1.8, 13.6), B(0.2, 12.6)], 4),\n turbinates: ([[3.0, 11.45, 2.1, 0.32], [3.5, 12.45, 1.9, 0.3], [4.0, 13.3, 1.45, 0.22]] as const).map(([x, y, rx, ry]) => ellipse(B(x, y), rx * k, ry * k, -0.04)),\n palNasal: palate.map((p) => [p[0], p[1] + 0.55 * k] as Pt),\n jawLower: jb,\n jawUpper: jb.map((p) => [p[0], p[1] + 0.75 * k] as Pt),\n hyoid: ellipse(hy, 0.5 * k, 0.28 * k, 0.3, 28),\n thyroid: [[g[0] + 0.75 * k, g[1] - 1.6 * k], [g[0] + 1.75 * k, g[1] - 0.6 * k], [g[0] + 1.95 * k, g[1] + 1.2 * k], [g[0] + 1.45 * k, g[1] + 1.9 * k], [g[0] + 1.15 * k, g[1] + 1.1 * k], [g[0] + 1.3 * k, g[1] - 0.4 * k], [g[0] + 0.75 * k, g[1] - 1.6 * k]],\n trachea: [[[g[0] - 0.65 * k, g[1]], [g[0] - 0.75 * k, -4.8]], [[g[0] + 0.75 * k, g[1]], [g[0] + 0.95 * k, -4.8]]],\n rings,\n folds: [\n [[g[0] - 0.62 * k, g[1] + 0.05], [g[0] - 0.1, g[1] + 0.12 * k], [g[0] - 0.62 * k, g[1] + 0.32 * k], [g[0] - 0.62 * k, g[1] + 0.05]],\n [[g[0] + 0.72 * k, g[1] + 0.05], [g[0] + 0.12, g[1] + 0.12 * k], [g[0] + 0.72 * k, g[1] + 0.32 * k], [g[0] + 0.72 * k, g[1] + 0.05]],\n ],\n view: { x0: -7.5 * k, x1: 10.25 * k, y0: -4.55, y1: 19.9 * k },\n };\n}\n"],
|
|
4
|
+
"sourcesContent": ["/*\n * The anatomy around the air, for a side view: the whole tongue (root, arc, blade, underside, floor of\n * the mouth), each lip with its outer face, the upper and lower incisors, the jaw bone, the soft palate,\n * the epiglottis, the hard palate and the pharynx wall, from the geometry's last evaluate(). CHIMERA's\n * drawing parts (Jameson Hodge, MIT, crates/chimera/src/anatomy/human.rs:1228-1262), which the engine's\n * port leaves out: they are a view's, and this builds them on demand from the points the geometry keeps.\n * View code: it allocates. See THIRD_PARTY_NOTICES.md.\n */\n\nimport type { ChimeraGeometry } from '../engines/vocal-geometry';\n\n/** The drawing's parts: x, y pairs in body cm, glottis at the origin, x forward and y up. */\nexport interface GeometryDrawing {\n /** The body's scale (1 the male body). */\n k: number;\n tongue: number[];\n upperLip: number[];\n lowerLip: number[];\n jawBone: number[];\n upperTeeth: number[];\n lowerTeeth: number[];\n velum: number[];\n epiglottis: number[];\n palate: number[];\n pharynxWall: number[];\n outer: number[];\n inner: number[];\n glottisY: number;\n tongueCenter: [number, number];\n tongueRadius: number;\n /** The jaw's rotation about the condyle, for drawing jaw-carried points. */\n jawCos: number;\n jawSin: number;\n condyle: [number, number];\n pharynxScale: number;\n}\n\n/** The drawing parts of the geometry's last evaluate(), x, y pairs in body cm with the glottis at the origin. */\nexport function geometryDrawing(g: ChimeraGeometry): GeometryDrawing {\n const flat = (...polys: { xs: Float64Array; ys: Float64Array; n: number; from: number }[]): number[] => {\n const out: number[] = [];\n for (const p of polys) for (let i = p.from; i < p.n; i++) out.push(p.xs[i], p.ys[i]);\n return out;\n };\n const poly = (q: { xs: Float64Array; ys: Float64Array; n: number }, from = 0) => ({ xs: q.xs, ys: q.ys, n: q.n, from });\n const k = g.k;\n const floor = { xs: g['floorX'], ys: g['floorY'], n: 3, from: 1 };\n const tongue = flat(poly(g['root']), poly(g['arcPts'], 1), poly(g['blade'], 1), poly(g['under'], 1), floor);\n const bez = (x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, n: number): number[] => {\n const o: number[] = [];\n for (let i = 1; i <= n; i++) {\n const t = i / n;\n const u = 1 - t;\n o.push(u * u * u * x0 + 3 * u * u * t * x1 + 3 * u * t * t * x2 + t * t * t * x3, u * u * u * y0 + 3 * u * u * t * y1 + 3 * u * t * t * y2 + t * t * t * y3);\n }\n return o;\n };\n const jp = (x: number, y: number): [number, number] => {\n g['j'](x, y);\n return [g['r'][0], g['r'][1]];\n };\n const ulE = [g['dUlx'], g['dUly']];\n const llE = [g['dLlx'], g['dLly']];\n const [j81x, j81y] = jp(8.1, 6.3);\n const [j76x, j76y] = jp(7.6, 5.6);\n const upperLip = flat(poly(g['upperLipIn'])).concat(bez(ulE[0], ulE[1], ulE[0] + 0.25 * k, ulE[1] + 0.35 * k, g.pX(8.3), g.pY(9.6), g.pX(7.9), g.pY(10.4), 6));\n const lowerLip = flat(poly(g['lowerLipIn'])).concat(bez(llE[0], llE[1], llE[0] + 0.3 * k, llE[1] - 0.4 * k, j81x, j81y, j76x, j76y, 6));\n const jawBone: number[] = [];\n for (const [x, y] of [[7.25, 6.75], [7.4, 5.4], [6.4, 4.6], [3.5, 4.4], [1.2, 5.2], [-0.6, 7.4], [-1.9, 9.6]]) jawBone.push(...jp(x, y));\n const upperTeeth: number[] = [];\n for (const [x, y] of [[6.15, 9.36], [6.78, 8.7], [7.12, 7.95], [7.38, 8.7], [7.4, 9.3]]) upperTeeth.push(g.pX(x), g.pY(y));\n const lowerTeeth: number[] = [];\n for (let i = 0; i < 4; i++) lowerTeeth.push(g['lowTeethX'][i], g['lowTeethY'][i]);\n lowerTeeth.push(...jp(6.8, 6.0), ...jp(6.4, 6.2), g['lowTeethX'][0], g['lowTeethY'][0]);\n const velum = flat(poly(g['velNasal']));\n for (let i = g['velOral'].n - 1; i >= 0; i--) velum.push(g['velOral'].xs[i], g['velOral'].ys[i]);\n const e = g['dEpi'];\n return {\n k,\n tongue,\n upperLip,\n lowerLip,\n jawBone,\n upperTeeth,\n lowerTeeth,\n velum,\n epiglottis: [e[0], e[1], e[2], e[3], e[4], e[5]],\n palate: flat(poly(g['palate'])),\n pharynxWall: flat(poly(g['pharWall'])),\n outer: flat(poly(g['outer'])),\n inner: flat(poly(g['inner'])),\n glottisY: g['dGlotY'],\n tongueCenter: [g['dBX'], g['dBY']],\n tongueRadius: g['dRR'],\n jawCos: g['cosPhi'],\n jawSin: g['sinPhi'],\n condyle: [g['condX'], g['condY']],\n pharynxScale: g['phScale'],\n };\n}\n", "/*\n * Articulator targets for a vowel given its formants: analysis by synthesis on the voice's own\n * geometry, the method VocalTractLab uses to fit vowel shapes (Birkholz, VTL manual). A posture goes\n * through ChimeraGeometry to an area function, the area function through a chain of cylindrical\n * sections (closed glottis, lips radiating through an end-correction inertance) to its resonances, and\n * a bounded Nelder-Mead search over the jaw, the tongue body's x and y, the tongue root and the lips'\n * aperture and protrusion finds the posture whose first three resonances are nearest the target on the\n * Bark scale.\n *\n * The tube has rigid walls, which put F1 low; the voice's walls yield. The correction is the classic\n * wall resonance in quadrature, F1 = sqrt(F1_rigid^2 + FW^2), with FW fitted to the engine's own General\n * American vowels (MEASURED: FW 220 Hz brings /i/ /u/ /\u025B/ /\u0251/ within a few percent; F2 agreed within 2\n * percent before any correction). Solved vowels rendered through the engine land within 1 to 8 percent\n * of their targets (MEASURED; test/engines-physical/vowel-solver.test.ts gates it).\n *\n * Offline and build-time code: it allocates freely and never runs on the audio thread.\n */\n\nimport { ChimeraGeometry, GEOMETRY_BODIES } from './vocal-geometry';\nimport { VOCAL_ARTICULATOR_MAX, VOCAL_ARTICULATOR_MIN, VOCAL_NEUTRAL } from './vocal-tables.gen';\nimport { ART } from './vocal-articulators';\n\n/** Sections per tube in the resonance model. */\nconst SECTIONS = 24;\nconst SOUND_SPEED = 35000;\nconst AIR_DENSITY = 0.00114;\n/** The yielding wall's resonance, Hz, added to the rigid tube's F1 in quadrature (MEASURED, see above). */\nexport const WALL_HZ = 220;\n/** The articulators the search moves. */\nconst FREE_DEFAULT = [ART.jaw, ART.tbX, ART.tbY, ART.root, ART.lipAp, ART.lipProt] as const;\n\n/** Target formants, Hz; F3 optional. */\nexport interface VowelTarget {\n f1: number;\n f2: number;\n f3?: number;\n}\n\n/** A fitted posture and what the model predicts for it. */\nexport interface VowelFit {\n /** All 17 articulators. */\n posture: Float64Array;\n /** Predicted F1 (wall corrected), F2, F3, Hz. */\n formants: [number, number, number];\n /** Remaining cost, squared Bark. */\n cost: number;\n}\n\n/** Hz to Bark (Traunmuller-style arctangent form used across vowel normalization work). */\nexport function bark(f: number): number {\n return 13 * Math.atan(0.00076 * f) + 3.5 * Math.atan((f / 7500) ** 2);\n}\n\n/** One body's geometry, built once per solve. */\nexport function vowelGeometry(body: number): ChimeraGeometry {\n return new ChimeraGeometry(GEOMETRY_BODIES[Math.max(0, Math.min(GEOMETRY_BODIES.length - 1, body))]);\n}\n\n/** The area function (cm^2) and section lengths (cm) of a posture, glottis to lips. */\nexport function areaFunction(g: ChimeraGeometry, posture: ArrayLike<number>): { areas: number[]; lengths: number[] } {\n const ph = new Float64Array(SECTIONS);\n const or = new Float64Array(SECTIONS);\n const pm = new Float64Array(SECTIONS);\n const om = new Float64Array(SECTIONS);\n g.evaluate(posture);\n g.resampleInto(ph, or, pm, om, SECTIONS, SECTIONS);\n const areas: number[] = [];\n const lengths: number[] = [];\n for (let i = 0; i < SECTIONS; i++) {\n areas.push(Math.max(ph[i], 0.05));\n lengths.push(g.phLen / SECTIONS);\n }\n for (let i = 0; i < SECTIONS; i++) {\n areas.push(Math.max(or[i], 0.05));\n lengths.push(g.orLen / SECTIONS);\n }\n return { areas, lengths };\n}\n\n/** Resonance peaks (Hz) of the rigid tube, glottis closed and lips radiating, up to maxHz. */\nexport function tubeResonances(areas: number[], lengths: number[], maxHz = 4500): number[] {\n const peaks: number[] = [];\n let prev = 0;\n let prev2 = 0;\n const step = 5;\n for (let f = 50; f <= maxHz; f += step) {\n const w = 2 * Math.PI * f;\n let ar = 1, ai = 0, br = 0, bi = 0, cr = 0, ci = 0, dr = 1, di = 0;\n for (let s = 0; s < areas.length; s++) {\n const k = w / SOUND_SPEED;\n const kl = k * lengths[s];\n const z = (AIR_DENSITY * SOUND_SPEED) / areas[s];\n const cs = Math.cos(kl);\n const sn = Math.sin(kl);\n // a small loss in each section keeps the peaks finite\n const loss = 0.003 * kl;\n const mar = cs, mai = -loss * sn, mbr = loss * z * cs, mbi = z * sn;\n const mcr = (loss * cs) / z, mci = sn / z, mdr = cs, mdi = -loss * sn;\n const nar = ar * mar - ai * mai + br * mcr - bi * mci;\n const nai = ar * mai + ai * mar + br * mci + bi * mcr;\n const nbr = ar * mbr - ai * mbi + br * mdr - bi * mdi;\n const nbi = ar * mbi + ai * mbr + br * mdi + bi * mdr;\n const ncr = cr * mar - ci * mai + dr * mcr - di * mci;\n const nci = cr * mai + ci * mar + dr * mci + di * mcr;\n const ndr = cr * mbr - ci * mbi + dr * mdr - di * mdi;\n const ndi = cr * mbi + ci * mbr + dr * mdi + di * mdr;\n ar = nar; ai = nai; br = nbr; bi = nbi; cr = ncr; ci = nci; dr = ndr; di = ndi;\n }\n // lips: pressure = Zr * flow, an end-corrected inertance plus a small radiation resistance\n const al = areas[areas.length - 1];\n const r = Math.sqrt(al / Math.PI);\n const zri = (w * AIR_DENSITY * 0.8 * r) / al;\n const zrr = ((AIR_DENSITY * SOUND_SPEED) / al) * 0.5 * ((w * r) / SOUND_SPEED) ** 2;\n const gr = cr * zrr - ci * zri + dr;\n const gi = cr * zri + ci * zrr + di;\n const h = 1 / Math.hypot(gr, gi);\n if (prev > prev2 && prev > h && f > 150) peaks.push(f - step);\n prev2 = prev;\n prev = h;\n }\n return peaks;\n}\n\n/** F1 (wall corrected), F2 and F3 a posture gives, Hz. */\nexport function predictFormants(g: ChimeraGeometry, posture: ArrayLike<number>): [number, number, number] {\n const { areas, lengths } = areaFunction(g, posture);\n const p = tubeResonances(areas, lengths);\n return [Math.sqrt((p[0] ?? NaN) ** 2 + WALL_HZ * WALL_HZ), p[1] ?? NaN, p[2] ?? NaN];\n}\n\n/** What a solve may move and how much F3 counts. */\nexport interface SolveOptions {\n /** Articulator indices free to move; default the jaw, tongue body, root and lips (FREE). */\n free?: readonly number[];\n /** F3's weight against F1 and F2's 1 in the Bark cost; default 0.5. */\n f3Weight?: number;\n}\n\n/**\n * The posture nearest `start` (a full 17-articulator row) whose formants match `target`. By default only\n * the jaw, tongue body, root and lips move; everything else keeps start's values. An r-coloured vowel,\n * whose F3 is set by the tongue tip, frees the tip as well (`opts.free`).\n */\nexport function solveVowel(g: ChimeraGeometry, target: VowelTarget, start: ArrayLike<number> = VOCAL_NEUTRAL, opts: SolveOptions = {}): VowelFit {\n const FREE = opts.free ?? FREE_DEFAULT;\n const w3 = opts.f3Weight ?? 0.5;\n const base = Float64Array.from(start);\n const lo = FREE.map((k) => VOCAL_ARTICULATOR_MIN[k]);\n const hi = FREE.map((k) => VOCAL_ARTICULATOR_MAX[k]);\n const posture = (x: number[]): Float64Array => {\n const a = Float64Array.from(base);\n FREE.forEach((k, i) => (a[k] = Math.min(hi[i], Math.max(lo[i], x[i]))));\n return a;\n };\n const cost = (x: number[]): number => {\n let c = 0;\n FREE.forEach((k, i) => {\n const v = Math.min(hi[i], Math.max(lo[i], x[i]));\n c += (x[i] - v) ** 2 * 100;\n // a light pull toward the start, so of the postures that fit, the nearest wins\n c += 0.002 * ((x[i] - base[k]) / (hi[i] - lo[i])) ** 2;\n });\n const f = predictFormants(g, posture(x));\n if (!(f[0] > 0 && f[1] > 0)) return 1e9;\n c += (bark(f[0]) - bark(target.f1)) ** 2 + (bark(f[1]) - bark(target.f2)) ** 2;\n if (target.f3 !== undefined && f[2] > 0) c += w3 * (bark(f[2]) - bark(target.f3)) ** 2;\n return c;\n };\n const x = nelderMead(cost, FREE.map((k) => base[k]), FREE.map((_, i) => 0.12 * (hi[i] - lo[i])), 600);\n const best = posture(x.point);\n return { posture: best, formants: predictFormants(g, best), cost: x.value };\n}\n\n/** Minimize f from x0 with initial steps; plain Nelder-Mead (reflect 1, expand 2, contract and shrink 0.5). */\nfunction nelderMead(f: (x: number[]) => number, x0: number[], steps: number[], iterations: number): { point: number[]; value: number } {\n const n = x0.length;\n let pts: number[][] = [x0.slice()];\n for (let i = 0; i < n; i++) {\n const p = x0.slice();\n p[i] += steps[i];\n pts.push(p);\n }\n let vals = pts.map(f);\n for (let it = 0; it < iterations; it++) {\n const order = vals.map((v, i) => [v, i] as const).sort((a, b) => a[0] - b[0]).map((p) => p[1]);\n pts = order.map((i) => pts[i]);\n vals = order.map((i) => vals[i]);\n const c = pts[0].map((_, j) => pts.slice(0, n).reduce((s, p) => s + p[j], 0) / n);\n const worst = pts[n];\n const r = c.map((v, j) => v + (v - worst[j]));\n const fr = f(r);\n if (fr < vals[0]) {\n const e = c.map((v, j) => v + 2 * (v - worst[j]));\n const fe = f(e);\n if (fe < fr) [pts[n], vals[n]] = [e, fe];\n else [pts[n], vals[n]] = [r, fr];\n } else if (fr < vals[n - 1]) {\n [pts[n], vals[n]] = [r, fr];\n } else {\n const k = c.map((v, j) => v + 0.5 * (worst[j] - v));\n const fk = f(k);\n if (fk < vals[n]) [pts[n], vals[n]] = [k, fk];\n else\n for (let i = 1; i <= n; i++) {\n pts[i] = pts[i].map((v, j) => pts[0][j] + 0.5 * (v - pts[0][j]));\n vals[i] = f(pts[i]);\n }\n }\n }\n let best = 0;\n for (let i = 1; i <= n; i++) if (vals[i] < vals[best]) best = i;\n return { point: pts[best], value: vals[best] };\n}\n", "/*\n * The vocal tract as a picture: what the voice's mouth is doing, for a UI to draw. It runs the same\n * geometry the engine runs (ChimeraGeometry) on the same per-phoneme articulator targets\n * (vocal-tables.gen.ts), with the velum lowered for a nasal as the planner lowers it, moving each\n * articulator toward its target critically damped at the engine's own speeds (VOCAL_ARTICULATOR_HZ), so a consonant's targets overlay the vowel's posture\n * the way the engine's do: what a consonant does not set stays where the vowel put it.\n *\n * It does not listen to the audio thread; it follows the plan. Given the spans a sung or spoken\n * line returns, call target() with the phoneme at each moment and step() with the time passed.\n * Main-thread code: it allocates on construction and in shape(), never per sample.\n */\n\nimport { ChimeraGeometry, GEOMETRY_BODIES } from '../engines/vocal-geometry';\nimport { geometryDrawing, type GeometryDrawing } from './drawing';\nimport { settingOffsets, type SettingValues } from '../engines/vocal-settings';\nimport { predictFormants } from '../engines/vowel-solver';\nimport {\n VOCAL_ARTICULATOR_HZ,\n VOCAL_ARTICULATOR_MAX,\n VOCAL_ARTICULATOR_MIN,\n VOCAL_ARTICULATOR_NAMES,\n VOCAL_BODIES,\n VOCAL_NEUTRAL,\n VOCAL_TABLE_PHONEMES,\n} from '../engines/vocal-tables.gen';\nimport { BEAT_PREFIX } from '../engines/vocal-beats';\nimport { VOCAL_ACOUSTICS, vocalPhonemeIndex } from '../engines/vocal-phonemes';\nimport { ART } from '../engines/vocal-articulators';\n\n/* The velum's target for a nasal: the gesture the planner keys (vocal-planner.ts, M_NASAL). */\nconst NASAL_VELUM = 0.45;\n\n/*\n * A beat drawn as the planner makes it (writeBeatScore in engines/vocal-beat-scores.ts): the consonant it is built on,\n * held, with the articulators the beat moves past it. An ejective shows its larynx rising, a click\n * its hollowed dorsum, the hum its lowered velum. '.' is the beatboxer's ready posture.\n */\nconst BEAT_VIEW: Readonly<Record<string, { base: string; set?: Partial<Record<keyof typeof ART, number>> }>> = {\n '.': { base: '\u0259', set: { jaw: 0.4, lipAp: 0.25, lipProt: 0.1 } },\n B: { base: 'p', set: { jaw: 0.3, tbY: 7.7, larynx: 1.55 } },\n t: { base: 't', set: { jaw: 0.3 } },\n tss: { base: 's' },\n Pf: { base: 'f' },\n K: { base: 'k', set: { jaw: 0.35, larynx: 1.55 } },\n '^K': { base: 'k', set: { jaw: 0.35, tbY: 7.4 } },\n '!': { base: 't', set: { dorsum: 1 } },\n 'P!': { base: 'p', set: { jaw: 1.6, dorsum: 1 } },\n kch: { base: '\u0283' },\n m: { base: 'm' },\n ch: { base: '\u0283', set: { jaw: 0.3 } },\n Psh: { base: '\u0283' },\n};\n\n/** The articulators, in the order postures use. */\nexport const ARTICULATOR_NAMES = VOCAL_ARTICULATOR_NAMES;\n\n/** A drawable midsagittal view of the tract, centimetres, glottis to lips. */\nexport interface TractShape {\n /** The lower wall (the tongue, the floor of the mouth, the lower lip), as x, y pairs. */\n lower: Float32Array;\n /** The upper wall (the back of the pharynx, the palate, the upper lip), as x, y pairs. */\n upper: Float32Array;\n /** Cross-sectional area at each point, cm^2. */\n area: Float32Array;\n /** Opening into the nose, cm^2 (0 for an oral sound, larger for m, n, \u014B). */\n velumPort: number;\n /** Area between the lips, cm^2. */\n lipArea: number;\n /** The tongue tip. */\n tipX: number;\n tipY: number;\n /** Each point's region: 1 the pharynx, 2 the mouth, 3 the lips. */\n region: Uint8Array;\n /** Index of the first mouth point, where the pharynx turns into the mouth below the velum (-1 if none). */\n split: number;\n /** Index of the narrowest point past the glottis, where the air is fastest (a closure if its area is near 0). */\n constriction: number;\n /** The anatomy around the air: tongue, lips, teeth, jaw, soft palate, epiglottis (view/drawing.ts). */\n drawing: GeometryDrawing;\n}\n\n/** Settings and anatomy for the model: SettingValues plus size and pharynx (engines/vocal-settings.ts). */\nexport interface MouthSettings extends SettingValues {\n size?: number;\n pharynx?: number;\n}\n\n/**\n * The articulator targets of one phoneme for a body (0 male, 1 female, 2 child), 17 values, NaN\n * where the phoneme sets none. Undefined for a symbol the voice does not have.\n */\nexport function phonemeTargets(body: number, ipa: string): Float64Array | undefined {\n const idx = vocalPhonemeIndex(ipa);\n if (idx < 0) return undefined;\n const b = VOCAL_BODIES[Math.max(0, Math.min(VOCAL_BODIES.length - 1, Math.round(body)))];\n if (VOCAL_TABLE_PHONEMES[idx] === undefined) return undefined;\n const vowel = b.vowelTargets[idx];\n return Float64Array.from(vowel.some((v) => v === v) ? vowel : b.consonantTargets[idx]);\n}\n\nexport class TractModel {\n /** The current posture, 17 articulators. */\n readonly posture = Float64Array.from(VOCAL_NEUTRAL);\n private readonly velocity = new Float64Array(VOCAL_NEUTRAL.length);\n private readonly goal = Float64Array.from(VOCAL_NEUTRAL);\n /** The vowel posture a consonant overlays. */\n private readonly vowelGoal = Float64Array.from(VOCAL_NEUTRAL);\n private geometry: ChimeraGeometry;\n private bodyIndex = 0;\n /** The phoneme the model is moving toward. */\n current = '_';\n\n /** The settings' articulator offsets, laid over every target. */\n private readonly offsets = new Float64Array(VOCAL_NEUTRAL.length);\n private settingValues: MouthSettings = {};\n /** Articulators the current consonant sets itself (its own targets win over a setting). */\n private readonly own = new Uint8Array(VOCAL_NEUTRAL.length);\n\n constructor(body = 0) {\n this.bodyIndex = clampBody(body);\n this.geometry = new ChimeraGeometry(GEOMETRY_BODIES[this.bodyIndex]);\n }\n\n /**\n * Voice settings and anatomy, as the engine's params of the same names take them (jawSet,\n * lipRound, larynxSet, nasal, twang, ..., size, pharynx): the mouth then shows what the voice does.\n */\n setSettings(values: MouthSettings): void {\n this.settingValues = { ...values };\n settingOffsets(values, this.offsets);\n this.layBody();\n if (this.current !== '_') this.target(this.current);\n else this.applyOffsets();\n }\n\n /** The settings last given. */\n get settings(): MouthSettings {\n return { ...this.settingValues };\n }\n\n private layBody(): void {\n const base = GEOMETRY_BODIES[this.bodyIndex];\n const size = clampNum(this.settingValues.size, 0.8, 1.25, 1);\n const ph = clampNum(this.settingValues.pharynx, 0.8, 1.25, 1);\n this.geometry.setBody(base.scale * size, base.pharynx * ph, base.tongueRadius, base.lipWidth);\n }\n\n private applyOffsets(): void {\n for (let k = 0; k < this.goal.length; k++) if (!this.own[k]) this.goal[k] += this.offsets[k];\n clampPosture(this.goal);\n }\n\n /**\n * Hold an exact posture: the given articulators (by name, ARTICULATOR_NAMES) at these values, the\n * rest where they are. `snap` jumps there; otherwise step() moves there at the engine's speeds.\n */\n pose(values: Partial<Record<string, number>>, snap = true): void {\n for (const [name, v] of Object.entries(values)) {\n const k = (VOCAL_ARTICULATOR_NAMES as readonly string[]).indexOf(name);\n if (k < 0 || typeof v !== 'number' || !Number.isFinite(v)) continue;\n this.goal[k] = Math.max(VOCAL_ARTICULATOR_MIN[k], Math.min(VOCAL_ARTICULATOR_MAX[k], v));\n if (snap) {\n this.posture[k] = this.goal[k];\n this.velocity[k] = 0;\n }\n }\n this.current = 'pose';\n }\n\n /** The current posture by articulator name. */\n postureByName(): Record<string, number> {\n const o: Record<string, number> = {};\n VOCAL_ARTICULATOR_NAMES.forEach((n, k) => (o[n] = this.posture[k]));\n return o;\n }\n\n /** The first three resonances of the current shape, Hz (the vowel solver's tube, walls corrected). */\n formants(): [number, number, number] {\n return predictFormants(this.geometry, this.posture);\n }\n\n /** The current posture's drawing parts and tongue tip, without the rest of shape(). */\n drawingNow(): GeometryDrawing & { tipX: number; tipY: number } {\n const g = this.geometry;\n g.evaluate(this.posture);\n return Object.assign(geometryDrawing(g), { tipX: g.tipX, tipY: g.tipY });\n }\n\n /** Change body (0 male, 1 female, 2 child, rounded). */\n setBody(body: number): void {\n const b = clampBody(body);\n if (b === this.bodyIndex) return;\n this.bodyIndex = b;\n this.geometry = new ChimeraGeometry(GEOMETRY_BODIES[b]);\n this.layBody();\n if (this.current !== '_') this.target(this.current);\n }\n\n /**\n * Move toward a phoneme: a vowel sets the whole posture, a consonant its own articulators over the\n * vowel's, silence ('_') the rest position. False for a symbol the voice does not have.\n */\n target(ipa: string): boolean {\n if (ipa.startsWith(BEAT_PREFIX)) return this.targetBeat(ipa);\n if (ipa === '_' || ipa === '') {\n this.goal.set(VOCAL_NEUTRAL);\n this.vowelGoal.set(VOCAL_NEUTRAL);\n this.own.fill(0);\n this.applyOffsets();\n this.current = '_';\n return true;\n }\n const row = phonemeTargets(this.bodyIndex, ipa);\n if (!row) return false;\n const idx = vocalPhonemeIndex(ipa);\n const isVowel = VOCAL_BODIES[this.bodyIndex].vowelTargets[idx].some((v) => v === v);\n for (let k = 0; k < row.length; k++) {\n const v = row[k];\n if (isVowel) {\n this.vowelGoal[k] = v === v ? v : VOCAL_NEUTRAL[k];\n this.goal[k] = this.vowelGoal[k];\n this.own[k] = 0;\n } else {\n this.goal[k] = v === v ? v : this.vowelGoal[k];\n this.own[k] = v === v ? 1 : 0;\n }\n }\n // the velum is not in the target tables: the planner lowers it for a nasal, as here\n this.goal[ART.velum] = VOCAL_ACOUSTICS[idx]?.cls === 'nasal' ? NASAL_VELUM : this.vowelGoal[ART.velum];\n this.applyOffsets();\n this.current = ipa;\n return true;\n }\n\n /** A beat token (\"beat:B\", \"beat:Pf>\"): its base consonant with the articulators it moves past it. */\n private targetBeat(token: string): boolean {\n let id = token.slice(BEAT_PREFIX.length);\n if (id.length > 1 && id.endsWith('>')) id = id.slice(0, -1);\n const view = BEAT_VIEW[id];\n if (!view) return false;\n if (!this.target(view.base)) return false;\n for (const [name, v] of Object.entries(view.set ?? {})) this.goal[ART[name as keyof typeof ART]] = v as number;\n if (id === 'm') this.goal[ART.velum] = 0.9;\n this.current = token;\n return true;\n }\n\n /** Advance the articulators by dt seconds, critically damped at their own speeds. */\n step(dt: number): void {\n if (!(dt > 0)) return;\n const n = Math.min(200, Math.ceil(dt / 0.002));\n const h = dt / n;\n for (let i = 0; i < n; i++) {\n for (let k = 0; k < this.posture.length; k++) {\n const w = 2 * Math.PI * VOCAL_ARTICULATOR_HZ[k];\n const acc = w * w * (this.goal[k] - this.posture[k]) - 2 * w * this.velocity[k];\n this.velocity[k] += acc * h;\n this.posture[k] += this.velocity[k] * h;\n if (this.posture[k] < VOCAL_ARTICULATOR_MIN[k]) this.posture[k] = VOCAL_ARTICULATOR_MIN[k];\n if (this.posture[k] > VOCAL_ARTICULATOR_MAX[k]) this.posture[k] = VOCAL_ARTICULATOR_MAX[k];\n }\n }\n }\n\n /** Jump straight to the target. */\n settle(): void {\n this.posture.set(this.goal);\n this.velocity.fill(0);\n }\n\n /** The tract the current posture makes. */\n shape(): TractShape {\n const g = this.geometry;\n g.evaluate(this.posture);\n const n = g.gN;\n const lower = new Float32Array(2 * n);\n const upper = new Float32Array(2 * n);\n const area = new Float32Array(n);\n const region = Uint8Array.from(g.gRegion.subarray(0, n));\n for (let i = 0; i < n; i++) {\n lower[2 * i] = g.gInX[i];\n lower[2 * i + 1] = g.gInY[i];\n upper[2 * i] = g.gOutX[i];\n upper[2 * i + 1] = g.gOutY[i];\n area[i] = g.gArea[i];\n }\n return {\n lower,\n upper,\n area,\n velumPort: g.velumPort,\n lipArea: g.lipArea,\n tipX: g.tipX,\n tipY: g.tipY,\n region,\n split: g.splitIndex,\n constriction: narrowest(area),\n drawing: geometryDrawing(g),\n };\n }\n}\n\nfunction clampNum(v: number | undefined, lo: number, hi: number, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? Math.max(lo, Math.min(hi, v)) : dflt;\n}\n\nfunction clampPosture(p: Float64Array): void {\n for (let k = 0; k < p.length; k++) p[k] = Math.max(VOCAL_ARTICULATOR_MIN[k], Math.min(VOCAL_ARTICULATOR_MAX[k], p[k]));\n}\n\n/** The narrowest point past the first few (the glottis end is narrow by anatomy, not by a constriction). */\nfunction narrowest(area: Float32Array): number {\n let best = -1;\n let min = Infinity;\n for (let i = Math.min(4, area.length - 1); i < area.length; i++) {\n if (area[i] < min) {\n min = area[i];\n best = i;\n }\n }\n return best;\n}\n\nfunction clampBody(body: number): number {\n return Math.max(0, Math.min(GEOMETRY_BODIES.length - 1, Math.round(Number.isFinite(body) ? body : 0)));\n}\n", "/*\n * The parts of the mouth a person can grab: where each handle sits on a drawing, and the voice\n * settings that put a handle where the pointer is. The handles are the settings (tongue: tongueFront\n * and tongueHigh; jaw: jawSet; lips: lipRound and lipOpen; velum: nasal; larynx: larynxSet), so a\n * dragged mouth is one the engine plays. View code over TractModel's public API.\n */\n\nimport type { GeometryDrawing } from './drawing';\nimport type { MouthSettings, TractModel } from './tract';\n\n/** The parts of the mouth a person can grab and move. */\nexport type MouthHandle = 'tongue' | 'tip' | 'jaw' | 'lips' | 'velum' | 'larynx';\n\n/** Where a handle sits on a drawing, body cm. */\nexport function handlePoint(d: GeometryDrawing & { tipX: number; tipY: number }, h: MouthHandle): [number, number] {\n if (h === 'tongue') return [d.tongueCenter[0], d.tongueCenter[1]];\n if (h === 'tip') return [d.tipX, d.tipY];\n if (h === 'jaw') return [d.lowerTeeth[4], d.lowerTeeth[5]];\n if (h === 'velum') return [d.velum[10], d.velum[11]];\n if (h === 'larynx') return [0.5 * (d.inner[0] + d.outer[0]), d.glottisY];\n // the lips: between the front-most points of the two\n const front = (pts: number[]): [number, number] => {\n let bi = 0;\n for (let i = 2; i < pts.length; i += 2) if (pts[i] > pts[bi]) bi = i;\n return [pts[bi], pts[bi + 1]];\n };\n const u = front(d.upperLip);\n const l = front(d.lowerLip);\n return [0.5 * (u[0] + l[0]) + 0.15 * d.k, 0.5 * (u[1] + l[1])];\n}\n\n/** Where each handle is now, body cm. */\nexport function mouthHandles(model: TractModel): Record<MouthHandle, [number, number]> {\n const s = model.drawingNow();\n return {\n tongue: handlePoint(s, 'tongue'),\n tip: handlePoint(s, 'tip'),\n jaw: handlePoint(s, 'jaw'),\n lips: handlePoint(s, 'lips'),\n velum: handlePoint(s, 'velum'),\n larynx: handlePoint(s, 'larynx'),\n };\n}\n\n/**\n * The settings that put a handle at body point (x, y), cm, holding sound `ipa`: the handles are the\n * settings (tongue: tongueFront and tongueHigh; jaw: jawSet; lips: lipRound forward and lipOpen up\n * and down; velum: nasal; larynx: larynxSet), so a dragged mouth is one the voice can play. A\n * coordinate-wise golden-section search on the handle's distance to the point. Leaves the model\n * showing the result.\n */\nexport function settingsForHandle(model: TractModel, handle: MouthHandle, x: number, y: number, ipa: string): MouthSettings {\n const PARAMS: Record<MouthHandle, string[]> = {\n tongue: ['tongueFront', 'tongueHigh'],\n tip: ['tongueFront', 'tongueHigh'],\n jaw: ['jawSet'],\n lips: ['lipRound', 'lipOpen'],\n velum: ['nasal'],\n larynx: ['larynxSet'],\n };\n const names = PARAMS[handle];\n const cur: MouthSettings = model.settings;\n const range = (n: string): [number, number] => (n === 'nasal' ? [0, 1] : [-1, 1]);\n const cost = (): number => {\n model.setSettings(cur);\n model.target(ipa);\n model.settle();\n const p = handlePoint(model.drawingNow(), handle);\n return Math.hypot(p[0] - x, p[1] - y);\n };\n const r = (Math.sqrt(5) - 1) / 2;\n for (let round = 0; round < (names.length > 1 ? 3 : 1); round++) {\n for (const n of names) {\n let [a, b] = range(n);\n const at = (v: number) => {\n (cur as Record<string, number>)[n] = v;\n return cost();\n };\n let c = b - r * (b - a);\n let d = a + r * (b - a);\n let fc = at(c);\n let fd = at(d);\n for (let i = 0; i < 18; i++) {\n if (fc < fd) {\n b = d;\n d = c;\n fd = fc;\n c = b - r * (b - a);\n fc = at(c);\n } else {\n a = c;\n c = d;\n fc = fd;\n d = a + r * (b - a);\n fd = at(d);\n }\n }\n (cur as Record<string, number>)[n] = Math.round(((a + b) / 2) * 100) / 100;\n }\n }\n model.setSettings(cur);\n model.target(ipa);\n model.settle();\n return cur;\n}\n", "/*\n * The head around the vocal tract, for a side view: skin (neck, chin, lips, nose, brow, crown), the\n * skull and eye, the cervical vertebrae, the nasal cavity and its turbinates, the hard palate's\n * nasal face, the jaw bone's two edges, the hyoid, the thyroid cartilage, the trachea and its rings,\n * and the vocal folds, in body cm with the glottis at the origin (x forward, y up). Built from one\n * frame's drawing (view/drawing.ts), so the jaw, lips and larynx move with the voice.\n *\n * Ported from CHIMERA by Jameson Hodge (MIT, https://github.com/jamesondh/chimera-vocal-synth,\n * src/ui/render/profile.ts, buildProfile and its helpers). Changes: points are [x, y] pairs, the\n * frame's fields come from bellows' geometry drawing, the larynx height is read back from the\n * glottis, and the brain's outline is left out. See THIRD_PARTY_NOTICES.md. View code: it allocates.\n */\n\nimport type { GeometryDrawing } from './drawing';\n\nexport type Pt = [number, number];\n\nexport interface HeadProfile {\n skinLower: Pt[];\n skinUpper: Pt[];\n skull: Pt[];\n eye: Pt[];\n vertebrae: Pt[][];\n nasal: Pt[];\n turbinates: Pt[][];\n palNasal: Pt[];\n jawLower: Pt[];\n jawUpper: Pt[];\n hyoid: Pt[];\n thyroid: Pt[];\n trachea: Pt[][];\n rings: Pt[][];\n folds: Pt[][];\n /** The whole head's extent, body cm, for a view that frames it. */\n view: { x0: number; x1: number; y0: number; y1: number };\n}\n\n/** A Catmull-Rom spline through pts, `seg` points a span. */\nexport function catmullRom(pts: Pt[], seg: number): Pt[] {\n const out: Pt[] = [];\n if (pts.length < 2) return pts.slice();\n for (let i = 0; i < pts.length - 1; i++) {\n const p0 = pts[i - 1] ?? pts[i];\n const p1 = pts[i];\n const p2 = pts[i + 1];\n const p3 = pts[i + 2] ?? p2;\n for (let s = 0; s < seg; s++) {\n const t = s / seg;\n const t2 = t * t;\n const t3 = t2 * t;\n const f = (a: number, b: number, c: number, d: number) => 0.5 * (2 * b + (-a + c) * t + (2 * a - 5 * b + 4 * c - d) * t2 + (-a + 3 * b - 3 * c + d) * t3);\n out.push([f(p0[0], p1[0], p2[0], p3[0]), f(p0[1], p1[1], p2[1], p3[1])]);\n }\n }\n out.push(pts[pts.length - 1]);\n return out;\n}\n\nfunction ellipse(c: Pt, rx: number, ry: number, rot = 0, n = 40): Pt[] {\n const cr = Math.cos(-rot);\n const sr = Math.sin(-rot);\n const o: Pt[] = [];\n for (let i = 0; i <= n; i++) {\n const an = (i / n) * Math.PI * 2;\n const x = Math.cos(an) * rx;\n const y = Math.sin(an) * ry;\n o.push([c[0] + x * cr - y * sr, c[1] + x * sr + y * cr]);\n }\n return o;\n}\n\nfunction roundRect(p0: Pt, p1: Pt, r: number): Pt[] {\n const x0 = Math.min(p0[0], p1[0]);\n const x1 = Math.max(p0[0], p1[0]);\n const y0 = Math.min(p0[1], p1[1]);\n const y1 = Math.max(p0[1], p1[1]);\n const rr = Math.min(r, (x1 - x0) / 2, (y1 - y0) / 2);\n const o: Pt[] = [];\n const corner = (cx: number, cy: number, a0: number) => {\n for (let i = 0; i <= 6; i++) {\n const an = a0 + (i / 6) * (Math.PI / 2);\n o.push([cx + Math.cos(an) * rr, cy + Math.sin(an) * rr]);\n }\n };\n corner(x1 - rr, y1 - rr, 0);\n corner(x0 + rr, y1 - rr, Math.PI / 2);\n corner(x0 + rr, y0 + rr, Math.PI);\n corner(x1 - rr, y0 + rr, (3 * Math.PI) / 2);\n o.push(o[0]);\n return o;\n}\n\n/** x, y pairs to points. */\nexport function pairs(flat: readonly number[]): Pt[] {\n const o: Pt[] = [];\n for (let i = 0; i + 1 < flat.length; i += 2) o.push([flat[i], flat[i + 1]]);\n return o;\n}\n\n/** The head around one frame of the tract. */\nexport function headProfile(d: GeometryDrawing): HeadProfile {\n const k = d.k;\n const ph = d.pharynxScale;\n // template to body (human.rs:685): the oral region's x compressed, the pharynx's y scaled\n const P = (x: number, y: number): Pt => [(x > 0.5 ? 0.5 + (x - 0.5) * 0.86 : x) * k, (y < 7 ? 7 - (7 - y) * ph : y) * k];\n // the face in true body coordinates (P compresses x, which would flatten the nose)\n const B = (x: number, y: number): Pt => [x * k, (y < 7 ? 7 - (7 - y) * ph : y) * k];\n const [cx, cy] = d.condyle;\n const J = (x: number, y: number): Pt => {\n const [px, py] = P(x, y);\n const dx = px - cx;\n const dy = py - cy;\n return [cx + dx * d.jawCos - dy * d.jawSin, cy + dx * d.jawSin + dy * d.jawCos];\n };\n const lar = d.glottisY - P(0, 0)[1];\n const g: Pt = [0, d.glottisY];\n const wallX = (y: number) => -1.2 - 0.025 * y;\n const upper = pairs(d.upperLip);\n const lower = pairs(d.lowerLip);\n const ulOut = upper.slice(7);\n const llOut = lower.slice(7);\n const neckFront = catmullRom([B(2.3, -4.6), B(2.38, -1.5), B(2.52, 0.4), B(3.0, 1.7), J(5.3, 3.0), J(7.25, 3.35), J(7.95, 4.6), J(7.55, 5.7)], 4);\n const face = catmullRom([ulOut[ulOut.length - 1], B(7.05, 10.6), B(7.75, 10.78), B(8.75, 11.05), B(9.25, 11.65), B(8.95, 12.6), B(8.35, 13.9), B(7.7, 15.0), B(7.95, 16.1), B(7.9, 18.1), B(6.9, 20.5)], 4);\n const cranium = catmullRom([B(6.9, 20.5), B(3.0, 22.9), B(-2.2, 22.7), B(-6.9, 19.6), B(-8.7, 15.4), B(-8.3, 11.9), B(-7.4, 8.9), B(-6.8, 4.8), B(-6.6, 0), B(-6.6, -4.6)], 4);\n const vertebrae: Pt[][] = [];\n for (let i = 0; i < 9; i++) {\n const y0 = -4.4 + i * 1.75;\n if (y0 > 10.5) break;\n const x0 = wallX(y0) - 2.25;\n vertebrae.push(roundRect(P(x0, y0 + 1.4), P(x0 + 1.6, y0), 0.32 * k));\n }\n const palate = pairs(d.palate);\n const jb = pairs(d.jawBone).filter((p) => p[0] > 0.8 * k);\n const hy: Pt = [P(1.6, 0)[0], P(0, 2.9)[1] + 0.6 * lar];\n const rings: Pt[][] = [];\n for (let i = 0; i < 4; i++) {\n const y = g[1] - (0.9 + i * 1.0) * k;\n if (y < -4.4) break;\n rings.push([[g[0] + 0.8 * k, y], [g[0] + 1.05 * k, y - 0.05], [g[0] + 1.05 * k, y - 0.5 * k], [g[0] + 0.82 * k, y - 0.45 * k], [g[0] + 0.8 * k, y]]);\n }\n return {\n skinLower: [...neckFront, ...llOut.slice().reverse()],\n skinUpper: [...ulOut, ...face.slice(1), ...cranium.slice(1)],\n skull: catmullRom([B(7.0, 16.2), B(7.3, 18.5), B(6.0, 20.7), B(3.0, 22.1), B(-2.0, 22.0), B(-6.3, 19.2), B(-7.9, 15.3), B(-7.4, 12.6), B(-4.6, 12.2), B(-2.2, 13.3), B(1.0, 13.7), B(4.1, 14.1), B(6.2, 14.9)], 4),\n eye: ellipse(B(6.5, 15.4), 1.1 * k, 0.95 * k),\n vertebrae,\n nasal: catmullRom([B(0.3, 11.2), B(1.1, 10.25), B(2.7, 10.75), B(4.6, 10.85), B(6.4, 10.65), B(7.6, 10.85), B(8.45, 11.3), B(8.0, 12.2), B(6.7, 13.4), B(4.4, 13.9), B(1.8, 13.6), B(0.2, 12.6)], 4),\n turbinates: ([[3.0, 11.45, 2.1, 0.32], [3.5, 12.45, 1.9, 0.3], [4.0, 13.3, 1.45, 0.22]] as const).map(([x, y, rx, ry]) => ellipse(B(x, y), rx * k, ry * k, -0.04)),\n palNasal: palate.map((p) => [p[0], p[1] + 0.55 * k] as Pt),\n jawLower: jb,\n jawUpper: jb.map((p) => [p[0], p[1] + 0.75 * k] as Pt),\n hyoid: ellipse(hy, 0.5 * k, 0.28 * k, 0.3, 28),\n thyroid: [[g[0] + 0.75 * k, g[1] - 1.6 * k], [g[0] + 1.75 * k, g[1] - 0.6 * k], [g[0] + 1.95 * k, g[1] + 1.2 * k], [g[0] + 1.45 * k, g[1] + 1.9 * k], [g[0] + 1.15 * k, g[1] + 1.1 * k], [g[0] + 1.3 * k, g[1] - 0.4 * k], [g[0] + 0.75 * k, g[1] - 1.6 * k]],\n trachea: [[[g[0] - 0.65 * k, g[1]], [g[0] - 0.75 * k, -4.8]], [[g[0] + 0.75 * k, g[1]], [g[0] + 0.95 * k, -4.8]]],\n rings,\n folds: [\n [[g[0] - 0.62 * k, g[1] + 0.05], [g[0] - 0.1, g[1] + 0.12 * k], [g[0] - 0.62 * k, g[1] + 0.32 * k], [g[0] - 0.62 * k, g[1] + 0.05]],\n [[g[0] + 0.72 * k, g[1] + 0.05], [g[0] + 0.12, g[1] + 0.12 * k], [g[0] + 0.72 * k, g[1] + 0.32 * k], [g[0] + 0.72 * k, g[1] + 0.05]],\n ],\n view: { x0: -7.5 * k, x1: 10.25 * k, y0: -4.55, y1: 19.9 * k },\n };\n}\n"],
|
|
5
5
|
"mappings": ";yKAsCO,SAASA,EAAgBC,EAAqC,CACnE,IAAMC,EAAO,IAAIC,IAAuF,CACtG,IAAMC,EAAgB,CAAC,EACvB,QAAWC,KAAKF,EAAO,QAASG,EAAID,EAAE,KAAMC,EAAID,EAAE,EAAGC,IAAKF,EAAI,KAAKC,EAAE,GAAGC,CAAC,EAAGD,EAAE,GAAGC,CAAC,CAAC,EACnF,OAAOF,CACT,EACMG,EAAO,CAACC,EAAsDC,EAAO,KAAO,CAAE,GAAID,EAAE,GAAI,GAAIA,EAAE,GAAI,EAAGA,EAAE,EAAG,KAAAC,CAAK,GAC/GC,EAAIT,EAAE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U,EAAE,CAAC,EAAI,GAAMV,CAAC,EAAG,CAACU,EAAE,CAAC,EAAI,IAAOV,EAAGU,EAAE,CAAC,EAAI,IAAMV,CAAC,CAAC,EAC5P,QAAS,CAAC,CAAC,CAACU,EAAE,CAAC,EAAI,IAAOV,EAAGU,EAAE,CAAC,CAAC,EAAG,CAACA,EAAE,CAAC,EAAI,IAAOV,EAAG,IAAI,CAAC,EAAG,CAAC,CAACU,EAAE,CAAC,EAAI,IAAOV,EAAGU,EAAE,CAAC,CAAC,EAAG,CAACA,EAAE,CAAC,EAAI,IAAOV,EAAG,IAAI,CAAC,CAAC,EAChH,MAAAwB,EACA,MAAO,CACL,CAAC,CAACd,EAAE,CAAC,EAAI,IAAOV,EAAGU,EAAE,CAAC,EAAI,GAAI,EAAG,CAACA,EAAE,CAAC,EAAI,GAAKA,EAAE,CAAC,EAAI,IAAOV,CAAC,EAAG,CAACU,EAAE,CAAC,EAAI,IAAOV,EAAGU,EAAE,CAAC,EAAI,IAAOV,CAAC,EAAG,CAACU,EAAE,CAAC,EAAI,IAAOV,EAAGU,EAAE,CAAC,EAAI,GAAI,CAAC,EAClI,CAAC,CAACA,EAAE,CAAC,EAAI,IAAOV,EAAGU,EAAE,CAAC,EAAI,GAAI,EAAG,CAACA,EAAE,CAAC,EAAI,IAAMA,EAAE,CAAC,EAAI,IAAOV,CAAC,EAAG,CAACU,EAAE,CAAC,EAAI,IAAOV,EAAGU,EAAE,CAAC,EAAI,IAAOV,CAAC,EAAG,CAACU,EAAE,CAAC,EAAI,IAAOV,EAAGU,EAAE,CAAC,EAAI,GAAI,CAAC,CACrI,EACA,KAAM,CAAE,GAAI,KAAOV,EAAG,GAAI,MAAQA,EAAG,GAAI,MAAO,GAAI,KAAOA,CAAE,CAC/D,CACF",
|
|
6
6
|
"names": ["geometryDrawing", "g", "flat", "polys", "out", "p", "i", "poly", "q", "from", "k", "floor", "tongue", "bez", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "n", "o", "t", "u", "jp", "x", "y", "ulE", "llE", "j81x", "j81y", "j76x", "j76y", "upperLip", "lowerLip", "jawBone", "upperTeeth", "lowerTeeth", "velum", "e", "SECTIONS", "SOUND_SPEED", "AIR_DENSITY", "WALL_HZ", "FREE_DEFAULT", "ART", "areaFunction", "g", "posture", "ph", "SECTIONS", "or", "pm", "om", "areas", "lengths", "i", "tubeResonances", "maxHz", "peaks", "prev", "prev2", "step", "f", "w", "ar", "ai", "br", "bi", "cr", "ci", "dr", "di", "s", "kl", "SOUND_SPEED", "z", "AIR_DENSITY", "cs", "sn", "loss", "mar", "mai", "mbr", "mbi", "mcr", "mci", "mdr", "mdi", "nar", "nai", "nbr", "nbi", "ncr", "nci", "ndr", "ndi", "al", "r", "zri", "zrr", "gr", "gi", "h", "predictFormants", "p", "WALL_HZ", "NASAL_VELUM", "BEAT_VIEW", "ARTICULATOR_NAMES", "VOCAL_ARTICULATOR_NAMES", "phonemeTargets", "body", "ipa", "idx", "vocalPhonemeIndex", "b", "VOCAL_BODIES", "VOCAL_TABLE_PHONEMES", "vowel", "v", "TractModel", "VOCAL_NEUTRAL", "clampBody", "ChimeraGeometry", "GEOMETRY_BODIES", "values", "settingOffsets", "base", "size", "clampNum", "ph", "k", "clampPosture", "snap", "name", "VOCAL_ARTICULATOR_MIN", "VOCAL_ARTICULATOR_MAX", "o", "predictFormants", "g", "geometryDrawing", "BEAT_PREFIX", "row", "isVowel", "ART", "VOCAL_ACOUSTICS", "token", "id", "view", "dt", "h", "i", "w", "VOCAL_ARTICULATOR_HZ", "acc", "lower", "upper", "area", "region", "narrowest", "lo", "hi", "dflt", "p", "best", "min", "handlePoint", "d", "h", "front", "pts", "bi", "u", "l", "mouthHandles", "model", "s", "settingsForHandle", "handle", "x", "y", "ipa", "names", "cur", "range", "n", "cost", "p", "r", "round", "a", "b", "at", "v", "c", "fc", "fd", "i", "catmullRom", "pts", "seg", "out", "i", "p0", "p1", "p2", "p3", "s", "t", "t2", "t3", "f", "a", "b", "c", "d", "ellipse", "rx", "ry", "rot", "n", "cr", "sr", "o", "an", "x", "y", "roundRect", "r", "x0", "x1", "y0", "y1", "rr", "corner", "cx", "cy", "a0", "pairs", "flat", "headProfile", "k", "ph", "P", "B", "J", "px", "py", "dx", "dy", "lar", "g", "wallX", "upper", "lower", "ulOut", "llOut", "neckFront", "face", "cranium", "vertebrae", "palate", "jb", "p", "hy", "rings"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worklet-code.gen.d.ts","sourceRoot":"","sources":["../src/worklet-code.gen.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"worklet-code.gen.d.ts","sourceRoot":"","sources":["../src/worklet-code.gen.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,EAAE,MAAgk+J,CAAC"}
|