bellows-voice 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +98 -2
- package/THIRD_PARTY_NOTICES.md +131 -0
- package/dist/catalog.gen.d.ts +4 -0
- package/dist/catalog.gen.d.ts.map +1 -0
- package/dist/chunk-4LLNG2YR.js +6 -0
- package/dist/chunk-4LLNG2YR.js.map +7 -0
- package/dist/chunk-BUKRW4C6.js +3 -0
- package/dist/chunk-BUKRW4C6.js.map +7 -0
- package/dist/chunk-EQRI7KVA.js +3 -0
- package/dist/chunk-EQRI7KVA.js.map +7 -0
- package/dist/chunk-TIHSSFTZ.js +3 -0
- package/dist/chunk-TIHSSFTZ.js.map +7 -0
- package/dist/dsp/air.d.ts +31 -0
- package/dist/dsp/air.d.ts.map +1 -0
- package/dist/dsp/airway-tube.d.ts +46 -0
- package/dist/dsp/airway-tube.d.ts.map +1 -0
- package/dist/dsp/area-rate.d.ts +19 -0
- package/dist/dsp/area-rate.d.ts.map +1 -0
- package/dist/dsp/cascade.d.ts +55 -0
- package/dist/dsp/cascade.d.ts.map +1 -0
- package/dist/dsp/critdamp.d.ts +99 -0
- package/dist/dsp/critdamp.d.ts.map +1 -0
- package/dist/dsp/fold-oscillator.d.ts +94 -0
- package/dist/dsp/fold-oscillator.d.ts.map +1 -0
- package/dist/dsp/geometric-glottis.d.ts +39 -0
- package/dist/dsp/geometric-glottis.d.ts.map +1 -0
- package/dist/dsp/glottal.d.ts +169 -0
- package/dist/dsp/glottal.d.ts.map +1 -0
- package/dist/dsp/junction-airway.d.ts +293 -0
- package/dist/dsp/junction-airway.d.ts.map +1 -0
- package/dist/dsp/phonation-threshold.d.ts +35 -0
- package/dist/dsp/phonation-threshold.d.ts.map +1 -0
- package/dist/dsp/pitch-servo.d.ts +32 -0
- package/dist/dsp/pitch-servo.d.ts.map +1 -0
- package/dist/dsp/pitchglide.d.ts +42 -0
- package/dist/dsp/pitchglide.d.ts.map +1 -0
- package/dist/engine.d.ts +6 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +3 -0
- package/dist/engine.js.map +7 -0
- package/dist/engines/vocal-articulators.d.ts +22 -0
- package/dist/engines/vocal-articulators.d.ts.map +1 -0
- package/dist/engines/vocal-drive.d.ts +55 -0
- package/dist/engines/vocal-drive.d.ts.map +1 -0
- package/dist/engines/vocal-geometry.d.ts +129 -0
- package/dist/engines/vocal-geometry.d.ts.map +1 -0
- package/dist/engines/vocal-lead.d.ts +19 -0
- package/dist/engines/vocal-lead.d.ts.map +1 -0
- package/dist/engines/vocal-phonemes.d.ts +44 -0
- package/dist/engines/vocal-phonemes.d.ts.map +1 -0
- package/dist/engines/vocal-planner.d.ts +157 -0
- package/dist/engines/vocal-planner.d.ts.map +1 -0
- package/dist/engines/vocal-roof.d.ts +36 -0
- package/dist/engines/vocal-roof.d.ts.map +1 -0
- package/dist/engines/vocal-tables.gen.d.ts +50 -0
- package/dist/engines/vocal-tables.gen.d.ts.map +1 -0
- package/dist/engines/vocal.d.ts +4 -0
- package/dist/engines/vocal.d.ts.map +1 -0
- package/dist/engines/vowel-solver.d.ts +37 -0
- package/dist/engines/vowel-solver.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +7 -0
- package/dist/lyrics/accents.d.ts +118 -0
- package/dist/lyrics/accents.d.ts.map +1 -0
- package/dist/lyrics/allophones.d.ts +14 -0
- package/dist/lyrics/allophones.d.ts.map +1 -0
- package/dist/lyrics/arpabet.d.ts +4 -0
- package/dist/lyrics/arpabet.d.ts.map +1 -0
- package/dist/lyrics/cmudict.d.ts +3 -0
- package/dist/lyrics/cmudict.d.ts.map +1 -0
- package/dist/lyrics/durations.d.ts +14 -0
- package/dist/lyrics/durations.d.ts.map +1 -0
- package/dist/lyrics/english.d.ts +25 -0
- package/dist/lyrics/english.d.ts.map +1 -0
- package/dist/lyrics/ipa-front-end.d.ts +9 -0
- package/dist/lyrics/ipa-front-end.d.ts.map +1 -0
- package/dist/lyrics/ipa.d.ts +20 -0
- package/dist/lyrics/ipa.d.ts.map +1 -0
- package/dist/lyrics/letter-to-sound.d.ts +4 -0
- package/dist/lyrics/letter-to-sound.d.ts.map +1 -0
- package/dist/lyrics/lexical-sets.d.ts +10 -0
- package/dist/lyrics/lexical-sets.d.ts.map +1 -0
- package/dist/lyrics/pronounce.d.ts +34 -0
- package/dist/lyrics/pronounce.d.ts.map +1 -0
- package/dist/lyrics/read.d.ts +27 -0
- package/dist/lyrics/read.d.ts.map +1 -0
- package/dist/lyrics/sing.d.ts +53 -0
- package/dist/lyrics/sing.d.ts.map +1 -0
- package/dist/lyrics/speech.d.ts +29 -0
- package/dist/lyrics/speech.d.ts.map +1 -0
- package/dist/lyrics/syllabify.d.ts +25 -0
- package/dist/lyrics/syllabify.d.ts.map +1 -0
- package/dist/lyrics/types.d.ts +87 -0
- package/dist/lyrics/types.d.ts.map +1 -0
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/register.d.ts +3 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/sing.d.ts +67 -0
- package/dist/sing.d.ts.map +1 -0
- package/dist/singer.d.ts +131 -0
- package/dist/singer.d.ts.map +1 -0
- package/dist/text.d.ts +13 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +3 -0
- package/dist/text.js.map +7 -0
- package/dist/view/tract.d.ts +54 -0
- package/dist/view/tract.d.ts.map +1 -0
- package/dist/view.d.ts +2 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +3 -0
- package/dist/view.js.map +7 -0
- package/dist/worklet-code.gen.d.ts +2 -0
- package/dist/worklet-code.gen.d.ts.map +1 -0
- package/dist/worklet-entry.d.ts +2 -0
- package/dist/worklet-entry.d.ts.map +1 -0
- package/dist/worklet.js +2 -0
- package/package.json +75 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Moheeb Zara
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,99 @@
|
|
|
1
|
-
#
|
|
1
|
+
# bellows-voice
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A singing and speaking voice for [bellows](https://bellows.live). It is an articulatory synthesizer, a physical model of a singer: lyrics move 17 articulators (jaw, tongue, lips, velum and the rest), their positions become the shape of the throat and mouth, and air from the lungs flows through that shape in a waveguide airway. It sings and speaks English in eight accents, and IPA.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install bellowsjs bellows-voice
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import { Bellows } from 'bellowsjs';
|
|
11
|
+
import { voice, singer } from 'bellows-voice';
|
|
12
|
+
|
|
13
|
+
const b = await Bellows.boot({ plugins: [voice] }); // from a click handler
|
|
14
|
+
const alto = singer(b, { body: 1 }); // 0 male, 1 female, 2 child
|
|
15
|
+
|
|
16
|
+
alto.sing('twinkle twinkle little star', [
|
|
17
|
+
{ note: 'C4', dur: '4n' }, { note: 'C4', dur: '4n' },
|
|
18
|
+
{ note: 'G4', dur: '4n' }, { note: 'G4', dur: '4n' },
|
|
19
|
+
{ note: 'A4', dur: '4n' }, { note: 'A4', dur: '4n' },
|
|
20
|
+
{ note: 'G4', dur: '2n' },
|
|
21
|
+
], { at: b.now() + 0.5 });
|
|
22
|
+
|
|
23
|
+
alto.speak('Good morning. Where are you from?', { accent: 'australian' });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`voice` is a bellows plugin: the engine, prebuilt as one script that loads into bellows' AudioWorklet beside its kernel, so a page that never sings never loads it. `singer(b, params, opts)` makes an instrument on it and gives it `sing()` and `speak()`, which reach bellows only through its public API. Notes go through bellows' tempo map and tuning like any other note.
|
|
27
|
+
|
|
28
|
+
## Accents
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
const tenor = singer(b, { body: 0 }, { accent: 'southern-british' });
|
|
32
|
+
tenor.sing('the water in the bath was far too hot', melody, { accent: 'scottish' });
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Twenty are built in:
|
|
36
|
+
|
|
37
|
+
| Region | Accents |
|
|
38
|
+
|---|---|
|
|
39
|
+
| North America | `general-american` (the default), `canadian`, `californian`, `new-york`, `southern-us` |
|
|
40
|
+
| Britain and Ireland | `southern-british`, `london`, `northern-english`, `geordie`, `scottish`, `welsh`, `irish`, `northern-irish` |
|
|
41
|
+
| Southern hemisphere | `australian`, `new-zealand`, `south-african` |
|
|
42
|
+
| Africa, Asia, the Caribbean | `nigerian`, `jamaican`, `indian`, `singaporean` |
|
|
43
|
+
|
|
44
|
+
Each is a broad transcription of the accent's mainstream form, from the published lexical-set tables (sources in `src/lyrics/accents.ts`), not a recording of any one speaker. An accent is plain data: each of Wells's lexical sets (KIT, BATH, GOAT, NURSE...) voiced as a vowel or a diphthong with its glide timing, whether r after a vowel is said, its t, l, th, r and h rules, vowels raised before voiceless consonants (Canadian "price" and "house"), and a speech melody: the final tune, the pitch range, the rate, and how much longer a stressed syllable is than an unstressed one (about twice in British or American English, nearly the same in the syllable-timed Englishes of India, Nigeria, Singapore and Jamaica). Spread a built-in to make your own:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import { ACCENTS } from 'bellows-voice';
|
|
48
|
+
const mine = { ...ACCENTS.irish, id: 'mine', sets: { ...ACCENTS.irish.sets, FACE: 'eɪ' } };
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Text to IPA, without audio
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
import { toIPA, pronounce } from 'bellows-voice/text';
|
|
55
|
+
|
|
56
|
+
toIPA('far away', { accent: 'southern-british' }); // 'fɑɹ ə.ˈweɪ'
|
|
57
|
+
pronounce('hello').words[0].sets; // [undefined, 'GOAT']
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`bellows-voice/text` is pure TypeScript with no audio and no bellows, for a page, a server or a test.
|
|
61
|
+
|
|
62
|
+
## Drawing the mouth
|
|
63
|
+
|
|
64
|
+
`bellows-voice/view` runs the voice's own geometry on its articulator targets, for a UI to draw:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { TractModel } from 'bellows-voice/view';
|
|
68
|
+
const tract = new TractModel(1); // body
|
|
69
|
+
tract.target('i'); // follow the plan's spans as they play
|
|
70
|
+
tract.step(1 / 60); // articulators move at the engine's speeds
|
|
71
|
+
const { upper, lower, velumPort, lipArea } = tract.shape(); // centimetres, glottis to lips
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Rendering
|
|
75
|
+
|
|
76
|
+
`b.render()` renders through the worklet with the plugin loaded, exactly as it plays. To render with `renderOffline()` or in Node without a worklet, register the engine on that thread:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
import { renderOffline, registerBuiltins } from 'bellowsjs';
|
|
80
|
+
import { registerVoice } from 'bellows-voice/engine';
|
|
81
|
+
registerBuiltins();
|
|
82
|
+
registerVoice();
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Pronunciations
|
|
86
|
+
|
|
87
|
+
Words go through English letter-to-sound rules unless you give a pronouncing dictionary: `alto.dictionary = parseCmudict(text)` with your own copy of CMUdict (none ships). IPA between slashes, `/ˈlɪt.əl/`, sets the sounds directly.
|
|
88
|
+
|
|
89
|
+
## Content-Security-Policy
|
|
90
|
+
|
|
91
|
+
The plugin loads through a blob URL, as bellows' kernel does. A host that blocks blob: script sources serves `bellows-voice/worklet.js` itself and passes `{ ...voice, workletUrl: '/path/to/worklet.js' }`.
|
|
92
|
+
|
|
93
|
+
## Credits
|
|
94
|
+
|
|
95
|
+
The voice owes a large debt to [CHIMERA](https://github.com/jamesondh/chimera-vocal-synth), Jameson Hodge's physical-model voice synthesizer (MIT): the articulators and their speeds, the gesture planner, the mouth geometry, the airway's physical elements, the glottal source and the lyric front end are ported from it or learned from its code (THIRD_PARTY_NOTICES.md). The waveguide airway, the pitch behaviour, accents, speech and the vowel solver are bellows-voice's own.
|
|
96
|
+
|
|
97
|
+
Documentation: [bellows.live/docs/singing](https://bellows.live/docs/singing). Design notes: `docs/`.
|
|
98
|
+
|
|
99
|
+
MIT License.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
bellows-voice is licensed under MIT (see LICENSE). Parts of it are ported from, or learned
|
|
4
|
+
from, the software below, which is distributed under its own license. The notice for each is
|
|
5
|
+
reproduced here because the build strips source comments from the executable bundles, so the
|
|
6
|
+
headers in the source files do not reach their code. Each bundle (`dist/index.js`,
|
|
7
|
+
`dist/text.js`, `dist/engine.js`, `dist/worklet.js` and the chunks they share) opens instead
|
|
8
|
+
with a one-line banner naming bellows-voice's license and CHIMERA's copyright and MIT license
|
|
9
|
+
and pointing here; the shipped source maps quote the sources whole, headers included.
|
|
10
|
+
|
|
11
|
+
This code lived in bellowsjs until 0.4.0 and moved here with its history; the paths below are
|
|
12
|
+
this repository's.
|
|
13
|
+
|
|
14
|
+
## CHIMERA
|
|
15
|
+
|
|
16
|
+
CHIMERA, a physical-model voice synthesizer by Jameson Hodge.
|
|
17
|
+
https://github.com/jamesondh/chimera-vocal-synth
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2026 Jameson Hodge
|
|
20
|
+
|
|
21
|
+
Everything below was taken from CHIMERA at commit `1d3ea49`. Where a TypeScript original is
|
|
22
|
+
named, it is the engine CHIMERA deleted in commit `cd247a6`, readable at `cd247a6^:src/engine`.
|
|
23
|
+
|
|
24
|
+
### Ported from CHIMERA
|
|
25
|
+
|
|
26
|
+
These files are translations of CHIMERA's code. Each one starts with a header naming the
|
|
27
|
+
CHIMERA file it came from and what was changed.
|
|
28
|
+
|
|
29
|
+
| file | CHIMERA source |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| `src/dsp/glottal.ts` | `crates/chimera/src/sources/glottis.rs`, the drift in `math.rs`, the voice mapping in `voice/human_voice.rs` (TypeScript original `sources/glottis.ts`) |
|
|
32
|
+
| `src/lyrics/ipa.ts` | `crates/chimera/src/phonetics/ipa.rs` (`phonetics/ipa.ts`) |
|
|
33
|
+
| `src/lyrics/arpabet.ts` | `crates/chimera/src/phonetics/english.rs` (`phonetics/english.ts`) |
|
|
34
|
+
| `src/lyrics/letter-to-sound.ts` | `crates/chimera/src/phonetics/english.rs` (`phonetics/english.ts`) |
|
|
35
|
+
| `src/lyrics/english.ts` | `crates/chimera/src/phonetics/english.rs` and `syllables.rs` (`phonetics/english.ts`, `phonetics/syllables.ts`) |
|
|
36
|
+
| `src/lyrics/syllabify.ts` | `crates/chimera/src/phonetics/syllables.rs` (`phonetics/syllables.ts`) |
|
|
37
|
+
| `src/lyrics/read.ts` | `crates/chimera/src/phonetics/syllables.rs` (`phonetics/syllables.ts`) |
|
|
38
|
+
| `src/lyrics/durations.ts` | the consonant durations of `crates/chimera/src/phonetics/inventory.rs` (`phonetics/inventory.ts`) |
|
|
39
|
+
| `src/lyrics/types.ts` | the Segment and Syllable model of `crates/chimera/src/phonetics/mod.rs` and the FrontEnd trait of `syllables.rs` (`phonetics/syllables.ts`, `phonetics/planner.ts`) |
|
|
40
|
+
| `src/dsp/area-rate.ts` | the area rate limit, `crates/chimera/src/voice/human_airway.rs:151-156, 190-262`, applied to the junction airway's grid sections and their sub-section minima |
|
|
41
|
+
| `src/engines/vocal-geometry.ts` | the midsagittal geometry, `crates/chimera/src/anatomy/human.rs` 276-278 (body constants), 421-439 (NEUTRAL), 507-519 (constants), 644-692 (landmarks, area law, template-to-body map), 725-1263 (`compute`: jaw, velum, outer wall, lips, tongue, inner wall, grid rays, contact model, lip contact, area laws, spike clamp, lateral channel, centreline), 1266-1282 (`epilarynx_area`), 1287-1374 (`resample` with sub-section minima), 1398-1490 (`project_on`, `point_along`, `signed_gap`, `closest_approach`); `anatomy/geom.rs` (polar, rotate_about, ray_polyline, crossing_t, ray_crossings, bezier3, bezier2, arc, catmull_rom, tangent_angle); `math.rs` 89-158. Changes: preallocated point lists, results in scratch fields, a body set in place, drawing-only outputs left out |
|
|
42
|
+
|
|
43
|
+
In the repository only, `test/lyrics/chimera-golden.test.ts` carries cases converted from
|
|
44
|
+
CHIMERA's golden fixtures (`crates/chimera/tests/golden/phonetics-*.json`), and the lyric
|
|
45
|
+
tests beside it quote CHIMERA's behaviour to show where the port differs. Tests are not
|
|
46
|
+
published to npm.
|
|
47
|
+
|
|
48
|
+
### Techniques learned from CHIMERA and reimplemented
|
|
49
|
+
|
|
50
|
+
These files contain no CHIMERA code. They follow an approach, a rule or a set of values found
|
|
51
|
+
in CHIMERA, written again in bellows' own idiom, and they say so in their headers.
|
|
52
|
+
|
|
53
|
+
| file | what follows CHIMERA |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `src/lyrics/sing.ts` | the sung timing rules: vowel on the beat, onsets borrowing from the previous note, proportional consonant squeeze (`phonetics/sing.rs`) |
|
|
56
|
+
| `src/dsp/critdamp.ts` | critically damped tracking of articulation targets (`control/articulators.rs`) |
|
|
57
|
+
| `src/engines/vocal.ts` | the articulators and their speeds (`control/articulators.rs`), the contact rule (`voice/human_voice.rs:520-552`; here it moves only the output stage of the articulator cascade), the sung breath (`phonetics/planner.rs:376-379`), the vibrato bloom (`phonetics/sing.rs`), the voice's wiring of planner, geometry and airway |
|
|
58
|
+
| `src/engines/vocal-planner.ts` | the gestural planner: vowel overlap ramps, a consonant's dominant, secondary, velar-place and alveolar-fronting gestures with their lead, early and release-hold times and speeds by manner, the affricate split, the tap, the nasal velum gesture, the glottal and voiceless abduction rules and the end of the breath group, and the blend of gestures with the rest posture (`phonetics/planner.rs:24, 88-108, 196-390, 532-577`, `control/score.rs:273-430`, `voice/human_voice.rs:445`), planned online here; the return gestures, the closure-then-anterior priority, the per-articulator lead and the virtual lip target are bellows' own |
|
|
59
|
+
| `src/engines/vocal-roof.ts` | the roof polylines (from `anatomy/human.rs`), the template-to-body transform (`human.rs:685`), the tip kept outside the tongue body (`human.rs:828`) |
|
|
60
|
+
| `src/engines/vocal-drive.ts` | CHIMERA's section counts (`voice/human_airway.rs:75-80`), the area rate law on each keyframe (`human_airway.rs:190-262`), the jet rule of the smallest sub-section minimum (`airway/network.rs:919-930`), the anatomical moving-wall flow (`airway/network.rs` node continuity) |
|
|
61
|
+
| `src/dsp/junction-airway.ts` | the airway's elements: trachea 12 k cm by 2.5 k^2 and the lungs' resistance, the nasal profile, the glottal port (kinetic 0.37, slit 1.4 k, depth 0.3 k) and the velum port (length 1.0 k, kinetic 0.3 and 0.8), perimeter and viscous factors and wall radiation 0.25 (`voice/human_airway.rs:84-123`); viscous resistance at 700 Hz, closed area 2e-4, Borda-Carnot loss with a 0.1 contraction loss, the 60 Hz moving-wall filter, the Flanagan radiators (`airway/network.rs:360, 417, 866, 919-930, 1067-1068`); the voicing gate (`sources/glottis.rs:170-176`); the effort mapping (`voice/human_voice.rs:317-350`); the output gain (`human_voice.rs:220`). The formulation (a waveguide at Courant number 1 with the flow solved in its junctions) is bellows' own; the turbulence sources follow Stevens and Birkholz (below), not CHIMERA |
|
|
62
|
+
| `src/dsp/airway-tube.ts` | the fixed tubes' wall and viscous elements (`airway/network.rs:860-1010`), lumped onto a few nodes here |
|
|
63
|
+
| `src/dsp/air.ts` | the physical constants and the trachea's and nasal cavity's wall tissues (`physics.rs:5-35`); the tract wall's mass, 1.5 g/cm^2, is CHIMERA's `WALL_SOFT` (`physics.rs:28`), its stiffness and damping Birkholz and Zhang's (below) |
|
|
64
|
+
| `src/engines/vocal-tables.gen.ts` and `data/vocal/` | CHIMERA's articulator ranges and speeds, rest posture, inventory and calibrated targets, body constants and roofs, and tables measured on its geometry: the formant-tuning rows and the layout lengths (`data/vocal/README.md`) |
|
|
65
|
+
| `src/engines/vocal-phonemes.ts` | the phoneme classes checked against `phonetics/inventory.rs`, and the stop release rules, no aspiration after /s/, 12 ms when unaspirated, aspiration only before a vowel (`phonetics/planner.rs`) |
|
|
66
|
+
|
|
67
|
+
`src/lyrics/ipa-front-end.ts` and `src/lyrics/cmudict.ts` were written for bellows; they use
|
|
68
|
+
the ported tokenizer and syllabifier and read the dictionary formats CHIMERA reads.
|
|
69
|
+
|
|
70
|
+
Published research keeps its own credit, given in the files that use it: for the
|
|
71
|
+
articulatory voice, the digital waveguide (J. O. Smith, Physical Audio Signal Processing) and
|
|
72
|
+
the Kelly-Lochbaum scattering junction (Kelly and Lochbaum 1962) behind `src/dsp/junction-airway.ts`,
|
|
73
|
+
Jongman, Wayland and Wong (2000) for the fricative spectra its noise is calibrated against,
|
|
74
|
+
Stevens (Acoustic Phonetics, 1998) for the turbulence source law and corner, Birkholz (ISSP 2014)
|
|
75
|
+
for the constriction detection, source types, places and their split between junctions, Jackson
|
|
76
|
+
and Shadle (2000) and Pincas and Jackson (2005) for frication pulsing with voicing behind a
|
|
77
|
+
convective delay, VocalTractLab 2.4's manual for the velic noise source (implemented from the
|
|
78
|
+
papers and the manual, not from VocalTractLab's GPL code), Birkholz and Zhang (Interspeech 2025)
|
|
79
|
+
for the vocal tract wall's mass, stiffness and damping (`src/dsp/air.ts`), Story and Bunton for
|
|
80
|
+
the velopharyngeal port at which a stop turns nasal (`test/engines-physical/vocal.test.ts`), Pink
|
|
81
|
+
Trombone (Neil Thapen) as the proof that such a tract runs in a browser, Story (2005) for the
|
|
82
|
+
parametric area model behind the design, Saitou, Unoki and Akagi (2005) for sung pitch with
|
|
83
|
+
overshoot and preparation (`src/dsp/pitchglide.ts`), Sundberg for the singer's formant and
|
|
84
|
+
Joliveau, Smith and Wolfe (2004) for first-resonance tuning on high notes (`src/engines/vocal.ts`),
|
|
85
|
+
Hanson (2009) and Lofqvist et al. (1989) for the fold stiffness gesture that raises the pitch after
|
|
86
|
+
voiceless obstruents (`src/engines/vocal-planner.ts`); Titze (1984, 1988, 1989) and Birkholz,
|
|
87
|
+
Drechsel and Stone (Interspeech 2019) for the geometric two-edge glottis (`src/dsp/geometric-glottis.ts`),
|
|
88
|
+
Titze (1988, 1992) and Lucero (1999) for the phonation threshold and its hysteresis
|
|
89
|
+
(`src/dsp/phonation-threshold.ts`), Ishizaka and Flanagan (1972), Steinecke and Herzel (1995) and
|
|
90
|
+
Birkholz, Kroger and Neuschaefer-Rube (2011) for the self-oscillating two-mass folds
|
|
91
|
+
(`src/dsp/fold-oscillator.ts`); Shadle (1991) for keeping the obstacle source broadband while the
|
|
92
|
+
free-jet, wall and labiodental sources fall through a second pole, and the critical Reynolds number
|
|
93
|
+
of a turbulent jet (Flanagan, Speech Analysis, Synthesis and Perception) for the threshold under
|
|
94
|
+
which a constriction makes no noise (`src/dsp/junction-airway.ts`); Klatt (1980) and Gold and
|
|
95
|
+
Rabiner (1968) behind the resonators and the higher-pole correction in `src/dsp/resonator.ts`;
|
|
96
|
+
Lisker and Abramson (1964) for voice onset times; Birkholz, Kroger and Neuschaefer-Rube (2011) and
|
|
97
|
+
Birkholz and Hoole (2012) for the six-stage articulator cascade (`src/dsp/cascade.ts`), the
|
|
98
|
+
VocalTractLab 2.4 manual (Birkholz 2025) for return gestures and Lofqvist and Gracco (1997) for
|
|
99
|
+
the virtual lip target (`src/engines/vocal-planner.ts`), all implemented from the publications. The consonant
|
|
100
|
+
durations are CHIMERA's own values, not a published table; `src/lyrics/durations.ts` says how
|
|
101
|
+
they compare with Klatt's.
|
|
102
|
+
|
|
103
|
+
### No dictionary data
|
|
104
|
+
|
|
105
|
+
bellows ships no pronouncing dictionary: no CMUdict and no copy of CHIMERA's. `parseCmudict()`
|
|
106
|
+
reads a dictionary the caller loads, and `Bellows.dictionary` or the `dictionary` option of
|
|
107
|
+
`sing()` takes the resulting map. Without one, words go through letter-to-sound rules.
|
|
108
|
+
|
|
109
|
+
### License
|
|
110
|
+
|
|
111
|
+
MIT License
|
|
112
|
+
|
|
113
|
+
Copyright (c) 2026 Jameson Hodge
|
|
114
|
+
|
|
115
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
116
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
117
|
+
in the Software without restriction, including without limitation the rights
|
|
118
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
119
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
120
|
+
furnished to do so, subject to the following conditions:
|
|
121
|
+
|
|
122
|
+
The above copyright notice and this permission notice shall be included in all
|
|
123
|
+
copies or substantial portions of the Software.
|
|
124
|
+
|
|
125
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
126
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
127
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
128
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
129
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
130
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
131
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.gen.d.ts","sourceRoot":"","sources":["../src/catalog.gen.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,uEAAuE;AAEvE,eAAO,MAAM,iBAAiB,EAAE,UA6J/B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
var re="iy\u0268\u0289\u026Fu\u026A\u028F\u028Ae\xF8\u0258\u0275\u0264o\u0259\u025B\u0153\u025C\u025E\u028C\u0254\xE6\u0250a\u0276\u0251\u0252\u025D\u025A",je="pbtd\u0288\u0256c\u025Fkgq\u0262\u0294m\u0271n\u0273\u0272\u014B\u0274\u0278\u03B2fv\u03B8\xF0sz\u0283\u0292\u0282\u0290\xE7\u029Dx\u0263\u03C7\u0281\u0127\u0295h\u0266\u026C\u026E\u0255\u0291w\u028B\u0279\u027Bj\u0265\u0270l\u026B\u026D\u028E\u027E\u027Dr\u0280\u0299",se=["t\u0283","d\u0292","a\u026A","a\u028A","\u0254\u026A","e\u026A","o\u028A"],Ke=new Map([["\u0261","g"],["\u02A7","t\u0283"],["\u02A4","d\u0292"],["\u03B5","\u025B"],["\u03B1","\u0251"],["\u1D7B","\u026A"],["\u1D7F","\u028A"],["\u0269","\u026A"],["\u0277","\u028A"],["\u02A6","ts"],["\u02A3","dz"],["\u02A8","t\u0255"],["\u02A5","d\u0291"]]),Ze=/^(?=[\p{Ll}\p{Lo}])[\p{Script=Latin}\p{Script=Greek}]$/u,Qe=new Set(Array.from(re)),k=new Set([...re,...je,...se]),y="_",$e=.16,qe=.15,Je=.09,Xe=1.7,et="\u0329",tt="\u030D",nt=/[\u035C\u0361]/g,U=0,Y=1,x=2;function h(e){let t=e.codePointAt(0);return t!==void 0&&Qe.has(String.fromCodePoint(t))}function ot(e){return _(e).segments}function _(e){let t=Array.from(at(e)),r=[],n=[],o=0,s=0;for(;s<t.length;){let a=t[s];if(a==="\u02C8"||a==="'"){o=1,s++;continue}if(a==="\u02CC"){o=2,s++;continue}if(a==="."){v(n,Y),s++;continue}if(a===","||a==="|"||a==="\u2016"){v(n,x),r.push({ipa:y,dur:$e}),n.push(U),s++;continue}if(/\s/.test(a)){v(n,x),s++;continue}if(a==="\u02D0"||a===":"){let u=r[r.length-1];if(u){let d=h(u.ipa)?qe:Je;u.dur=(u.dur??d)*Xe}s++;continue}let i=a;for(let u of se)rt(t,s,u)&&(i=u);s+=i===a?1:Array.from(i).length;let l=!1;for(;s<t.length&&st(t[s]);)(t[s]===et||t[s]===tt)&&(l=!0),s++;if(!(!k.has(i)&&!Ze.test(i))){if(h(i)){r.push({ipa:i,stress:o}),n.push(U),o=0;continue}l&&(r.push({ipa:"\u0259",stress:o}),n.push(U),o=0),r.push({ipa:i}),n.push(U)}}return{segments:r,breaks:n}}function v(e,t){let r=e.length-1;r>=0&&e[r]<t&&(e[r]=t)}function rt(e,t,r){let n=t;for(let o of r){if(e[n]!==o)return!1;n++}return!0}function st(e){return e>="\u0300"&&e<="\u036F"}function at(e){let t="";for(let r of e.normalize("NFC")){if(k.has(r)){t+=r;continue}let n=Ke.get(r);if(n!==void 0){t+=n;continue}let o=Array.from(r.normalize("NFD"));if(o.length>1){let s=(o[0]+o[1]).normalize("NFC");if(k.has(s)){t+=s+o.slice(2).join("");continue}}t+=o.join("")}return t.replace(nt,"")}var it=new Map([["AA","\u0251"],["AE","\xE6"],["AH","\u028C"],["AO","\u0254"],["AW","a\u028A"],["AY","a\u026A"],["EH","\u025B"],["ER","\u025D"],["EY","e\u026A"],["IH","\u026A"],["IY","i"],["OW","o\u028A"],["OY","\u0254\u026A"],["UH","\u028A"],["UW","u"],["B","b"],["CH","t\u0283"],["D","d"],["DH","\xF0"],["F","f"],["G","g"],["HH","h"],["JH","d\u0292"],["K","k"],["L","l"],["M","m"],["N","n"],["NG","\u014B"],["P","p"],["R","\u0279"],["S","s"],["SH","\u0283"],["T","t"],["TH","\u03B8"],["V","v"],["W","w"],["Y","j"],["Z","z"],["ZH","\u0292"]]),lt=/^([A-Z]+)([012])?$/;function z(e){let t=[];for(let r of e.trim().split(/\s+/)){let n=lt.exec(r);if(!n)continue;let o=n[1],s=n[2]==="1"?1:n[2]==="2"?2:0,a=it.get(o);a!==void 0&&(s===0&&o==="AH"&&(a="\u0259"),s===0&&o==="ER"&&(a="\u025A"),t.push(h(a)?{ipa:a,stress:s}:{ipa:a}))}return t}var V=[["#C","ed","#","\u025B d"],["#CC","ed","#","\u025B d"],["#CCC","ed","#","\u025B d"],["#C","es","#","\u025B s"],["#CC","es","#","\u025B s"],["#y","es","#","\u025B s"],["t","ed","#","\u026A d"],["d","ed","#","\u026A d"],["k","ed","#","t"],["p","ed","#","t"],["s","ed","#","t"],["f","ed","#","t"],["x","ed","#","t"],["h","ed","#","t"],["c","ed","#","t"],["s","es","#","\u026A z"],["z","es","#","\u026A z"],["x","es","#","\u026A z"],["h","es","#","\u026A z"],["c","es","#","\u026A z"],["g","es","#","\u026A z"],["r","s","#","z"],["l","s","#","z"],["m","s","#","z"],["n","s","#","z"],["d","s","#","z"],["g","s","#","z"],["b","s","#","z"],["v","s","#","z"],["w","s","#","z"],["u","s","#","s"],["","ng","s#","\u014B"],["","ng","ing","\u014B"],["","ng","ly","\u014B"],["","ng","ed#","\u014B"],["","n","k","\u014B"],["","iew","","j u"],["f","ew","","j u"],["p","ew","","j u"],["m","ew","","j u"],["h","ew","","j u"],["","ew","","u"],["","cious","","\u0283 \u0259 s"],["","tious","","\u0283 \u0259 s"],["","ous","#","\u0259 s"],["#h","ow","","a\u028A"],["#n","ow","","a\u028A"],["#c","ow","","a\u028A"],["#w","ow","","a\u028A"],["#v","ow","","a\u028A"],["#all","ow","","a\u028A"],["","ow","s#","o\u028A"],["","ow","ing","o\u028A"],["","ow","ly","o\u028A"],["","ow","ed#","o\u028A"],["#","ow","n","o\u028A"],["l","ow","n","o\u028A"],["h","ow","n","o\u028A"],["n","ow","n","o\u028A"],["gr","ow","n","o\u028A"],["thr","ow","n","o\u028A"],["","o","#","o\u028A"],["","o","ld","o\u028A"],["","o","lt","o\u028A"],["","i","nd#","a\u026A"],["","i","nds#","a\u026A"],["","i","nding","a\u026A"],["","i","ndly","a\u026A"],["","i","ndness","a\u026A"],["","i","ld#","a\u026A"],["","i","ldly","a\u026A"],["","all","#","\u0254 l"],["","all","s#","\u0254 l"],["","all","ing","\u0254 l"],["","all","ed#","\u0254 l"],["","alk","","\u0254 k"],["w","ar","","\u0254 \u0279"],["w","a","CC","\u0251"],["w","a","C#","\u0251"],["","ea","d#","\u025B"],["","ea","dy","\u025B"],["","ea","lth","\u025B"],["","ea","th#","\u025B"],["","ea","ther","\u025B"],["","ea","vy","\u025B"],["","ea","ven","\u025B"],["","ea","sant","\u025B"],["","ea","sure","\u025B"],["","ea","dow","\u025B"],["","oo","k","\u028A"],["g","oo","d","\u028A"],["w","oo","d","\u028A"],["h","oo","d","\u028A"],["t","oo","d","\u028A"],["f","oo","t","\u028A"],["d","oo","r","\u0254"],["fl","oo","r","\u0254"],["l","o","ve","\u028C"],["l","o","vi","\u028C"],["b","o","ve#","\u028C"],["c","o","ver","\u028C"],["s","o","me","\u028C"],["c","o","me","\u028C"],["w","o","n","\u028C"],["","o","ney","\u028C"],["","o","nth","\u028C"],["","o","ther","\u028C"],["","o","thing","\u028C"],["","th","er","\xF0"],["","th","e#","\xF0"],["","ear","l","\u025D"],["","ear","n","\u025D"],["","ear","ch","\u025D"],["","ear","th","\u025D"],["h","ear","d#","\u025D"],["h","ear","t","\u0251 \u0279"],["C","are","#","\u025B \u0279"],["","a","rr","\xE6"],["C","a","rV","\u025B"],["","i","re#","a\u026A"],["V","sure","","\u0292 \u025A"],["#","s","ure","\u0283"],["","ure","#","\u028A \u0279"],["","i","ty#","\u026A"],["t","i","ve#","\u026A"],["C","i","ly#","\u0259"],["","i","ver","\u026A"],["","i","ven","\u026A"],["#","a","Ce#","e\u026A"],["#","a","wa","\u0259"],["#","a","CV","\u0259"],["#","u","CV","j u"],["m","u","CV","j u"],["f","u","CV","j u"],["p","u","CV","j u"],["b","u","CV","j u"],["c","u","CV","j u"],["h","u","CV","j u"],["","ough","t","\u0254"],["","ou","l","o\u028A"],["","ou","ng","\u028C"],["","ou","ble","\u028C"],["","ou","ntry","\u028C"],["f","our","","\u0254 \u0279"],["p","our","","\u0254 \u0279"],["c","our","","\u0254 \u0279"],["s","our","","\u0254 \u0279"],["#","g","i","g"],["w","or","n","\u0254 \u0279"],["w","or","C","\u025D"],["","er","r","\u025B"],["VC","er","y#","\u025A"],["VC","or","y#","\u025A"],["VC","or","ies#","\u025A"],["","a","nge#","e\u026A"],["","a","nges#","e\u026A"],["","a","nged#","e\u026A"],["","a","ngel","e\u026A"],["","n","ge#","n"],["","n","ges#","n"],["","n","ged#","n"],["","n","gel","n"],["m","n","#",""],["#gu","y","#","a\u026A"],["#","gu","V","g"],["","eau","t","j u"],["#","al","so","\u0254 l"],["#","al","w","\u0254 l"],["#","al","r","\u0254 l"],["#","al","mo","\u0254 l"],["#","al","th","\u0254 l"],["Co","s","e#","z"],["Ci","s","e#","z"],["au","s","e#","z"],["ai","s","e#","z"],["oi","s","e#","z"],["ea","s","on","z"],["#h","ere","#","\u026A \u0279"],["h","ere","#","\u025B \u0279"],["","ere","#","\u026A \u0279"],["m","o","st","o\u028A"],["p","o","st","o\u028A"],["h","o","st","o\u028A"],["#","o","nly","o\u028A"],["VC","e","ly#",""],["VC","e","ful",""],["VC","e","ness",""],["VC","e","ment",""],["VC","e","less",""],["w","a","ter","\u0254"],["f","a","ther","\u0251"],["","a","Cow","\xE6"],["","i","Cow","\u026A"],["","i","rV","\u026A"],["#f","or","ev","\u025A"],["#f","or","g","\u025A"],["#","o","h#","o\u028A"],["V","h","#",""],["","aa","","\u0251"],["#y","e","#","i"],["#h","ey","#","e\u026A"],["","eah","#","\xE6"],["","tion","","\u0283 \u0259 n"],["","sion","","\u0292 \u0259 n"],["","ture","","t\u0283 \u025A"],["","ough","#","o\u028A"],["","augh","","\u0254"],["","igh","","a\u026A"],["","eigh","","e\u026A"],["","tch","","t\u0283"],["","dge","","d\u0292"],["","sch","","s k"],["","ch","","t\u0283"],["","sh","","\u0283"],["","th","","\u03B8"],["","ph","","f"],["","wh","","w"],["","ck","","k"],["","ng","#","\u014B"],["","ng","","\u014B g"],["","qu","","k w"],["#","kn","","n"],["#","wr","","\u0279"],["","gh","",""],["","ee","","i"],["","ea","","i"],["","oo","","u"],["","ou","","a\u028A"],["","ow","#","o\u028A"],["","ow","","a\u028A"],["","oi","","\u0254\u026A"],["","oy","","\u0254\u026A"],["","ai","","e\u026A"],["","ay","","e\u026A"],["","au","","\u0254"],["","aw","","\u0254"],["","ie","#","a\u026A"],["","ie","","i"],["","ei","","e\u026A"],["","ey","#","i"],["","oa","","o\u028A"],["","ue","#","u"],["","er","#","\u025A"],["","er","C","\u025D"],["","ir","","\u025D"],["","ur","","\u025D"],["","or","","\u0254 \u0279"],["","ar","","\u0251 \u0279"],["C","le","#","\u0259 \u026B"],["","ed","#","d"],["","es","#","z"],["C","s","#","s"],["V","s","#","z"],["#C","y","#","a\u026A"],["#CC","y","#","a\u026A"],["#CCC","y","#","a\u026A"],["","y","#","i"],["#","y","","j"],["C","y","","a\u026A"],["#C","e","#","i"],["#CC","e","#","i"],["","e","#",""],["#C","a","#","\u0251"],["#CC","a","#","\u0251"],["","a","CV","e\u026A"],["","a","","\xE6"],["","e","","\u025B"],["","i","CV","a\u026A"],["","i","","\u026A"],["","o","CV","o\u028A"],["","o","","\u0251"],["","u","CV","u"],["","u","","\u028C"],["","y","","\u026A"],["","c","e","s"],["","c","i","s"],["","c","y","s"],["","c","","k"],["","g","e","d\u0292"],["","g","i","d\u0292"],["","g","","g"],["","x","","k s"],["","j","","d\u0292"],["","q","","k"],["","b","","b"],["","d","","d"],["","f","","f"],["","h","","h"],["","k","","k"],["","l","","l"],["","m","","m"],["","n","","n"],["","p","","p"],["","r","","\u0279"],["","s","","s"],["","t","","t"],["","v","","v"],["","w","","w"],["","z","","z"]],ct=V.map(e=>e[3]?e[3].split(" "):[]);function le(e){let t=[],r=0;for(;r<e.length;){let s=!1;for(let a=0;a<V.length;a++){let[i,l,u]=V[a];if(e.startsWith(l,r)&&ie(e,r-1,i,-1)&&ie(e,r+l.length,u,1)){for(let d of ct[a])!h(d)&&d===t[t.length-1]||t.push(d);r+=l.length,s=!0;break}}s||r++}let n=[],o=t.findIndex(s=>h(s)&&s!=="\u0259"&&s!=="\u025A");o<0&&(o=t.findIndex(s=>h(s)));for(let s=0;s<t.length;s++){let a=t[s];h(a)?n.push({ipa:a,stress:s===o?1:0}):n.push({ipa:a})}return n}function ae(e){return e==="a"||e==="e"||e==="i"||e==="o"||e==="u"||e==="y"}function ie(e,t,r,n){let o=t;for(let s=0;s<r.length;s++){let a=n===1?r[s]:r[r.length-1-s],i=o>=0&&o<e.length?e[o]:void 0;if(a==="#"){if(i!==void 0)return!1}else if(a==="V"){if(!ae(i))return!1}else if(a==="C"){if(i===void 0||ae(i))return!1}else if(i!==a)return!1;o+=n}return!0}var ut=new Set(["p","b","t","d","k","g","f","v","\u03B8","\xF0","s","z","\u0283","\u0292","h","m","n","l","\u0279","w","j","t\u0283","d\u0292","pl","bl","kl","gl","fl","sl","p\u0279","b\u0279","t\u0279","d\u0279","k\u0279","g\u0279","f\u0279","\u03B8\u0279","\u0283\u0279","sp","st","sk","sm","sn","sw","sf","tw","kw","dw","gw","\u03B8w","pj","bj","kj","gj","mj","nj","fj","vj","hj","lj","spl","sp\u0279","st\u0279","sk\u0279","skw","skj","spj"]),dt=new Map([["r","\u0279"],["\u026B","l"]]),pt=new Set(Array.from("m\u0271n\u0273\u0272\u014B\u0274l\u026B\u026D\u028E\u0279\u027Br\u0280\u0299\u027E\u027Djw\u028B\u0265\u0270")),ft=new Set(Array.from("\u0278\u03B2fv\u03B8\xF0sz\u0283\u0292\u0282\u0290\xE7\u029Dx\u0263\u03C7\u0281\u0127\u0295h\u0266\u026C\u026E\u0255\u0291"));function ce(e){return pt.has(e)?2:ft.has(e)?1:0}function F(e){if(e.length===0)return;let t=0;for(let r=1;r<e.length;r++)ce(e[r].ipa)>ce(e[t].ipa)&&(t=r);return{onset:e.slice(0,t),nucleus:e[t],coda:e.slice(t+1)}}var ht=3;function C(e){let t=[];for(let o=0;o<e.length;o++)h(e[o].ipa)&&t.push(o);let r=[],n=0;for(let o=0;o<t.length;o++){let s=t[o],a=e.length;if(o+1<t.length){let i=t[o+1],l=i-(s+1),u=0;for(let d=Math.min(ht,l);d>=1;d--)if(Et(e,i-d,i)){u=d;break}a=i-u}r.push({onset:e.slice(n,s),nucleus:e[s],coda:e.slice(s+1,a)}),n=a}return r}function Et(e,t,r){if(r-t===1){let o=e[t].ipa;return o!=="\u014B"&&o!==y}let n="";for(let o=t;o<r;o++)n+=dt.get(e[o].ipa)??e[o].ipa;return ut.has(n)}var At=new Set(["th","sh","ch","ph","wh","ck","gh"]);function ue(e,t){let r=Math.floor(t);if(!(r>1)||!Number.isFinite(r))return[e];let n=Array.from(e),o=n.length,s=[];for(let p=0;p<o;){if(!P(n[p])){p++;continue}let E=p;do p++;while(p<o&&P(n[p])&&!St(n[p]));s.push([E,p])}let a=o>=2&&(n[o-1]==="e"||n[o-1]==="E"),i=a&&!P(n[o-2]),l=a&&o>=3&&(n[o-2]==="l"||n[o-2]==="L")&&!P(n[o-3])&&n[o-3]!=="l"&&n[o-3]!=="L";if(s.length>1&&i&&!l&&s[s.length-1][0]+1===o&&s.pop(),s.length<r){let p=[e];for(let E=1;E<r;E++)p.push("~");return p}for(;s.length>r;){let p=s.pop();s[s.length-1][1]=p[1]}let u=[0];for(let p=0;p<s.length-1;p++){let E=s[p][1],c=s[p+1][0],f=c-E,A=f>=2&&At.has((n[c-2]+n[c-1]).toLowerCase());u.push(A?c-2:E+(f<=1?0:Math.floor(f/2)))}u.push(o);let d=[];for(let p=0;p<u.length-1;p++)d.push(n.slice(u[p],u[p+1]).join(""));return d}function P(e){switch(e.length===1&&e<"\x80"?e:e.normalize("NFD")[0]){case"a":case"e":case"i":case"o":case"u":case"y":case"A":case"E":case"I":case"O":case"U":case"Y":return!0;default:return!1}}function St(e){return e.length===1&&e<"\xC0"?!1:e.normalize("NFD").includes("\u0308")}var Tt=["KIT","DRESS","TRAP","LOT","STRUT","FOOT","BATH","CLOTH","NURSE","FLEECE","FACE","PALM","THOUGHT","GOAT","GOOSE","PRICE","CHOICE","MOUTH","NEAR","SQUARE","START","NORTH","FORCE","CURE","happY","lettER","commA"],gt=new Set(["dance","dancer","dancing","chance","glance","lance","prance","trance","france","advance","enhance","plant","grant","slant","chant","aunt","can't","shan't","branch","answer","example","sample","demand","command","commander","remand","rather","father","half","calf","laugh","laughter","banana","drama"]),mt=new Set(["after","nasty","master","disaster","plaster","pastor","rafter","castle","fasten"]),Rt=/au|aw|al[lkt]|ough|augh|oa|wa/;function B(e,t){let r=e.toLowerCase(),n=[];for(let o=0;o<t.length;o++)h(t[o].ipa)&&n.push(o);for(let o=0;o<n.length;o++){let s=n[o],a=t[s],i=t[s+1]?.ipa,l=t[s+2]?.ipa,d=i==="\u0279"&&(l===void 0||!h(l)),p=a.stress!==void 0&&a.stress>0,E=o===n.length-1;a.set=Ot(a.ipa,{w:r,next:i,after:l,rCoda:d,stressed:p,last:E,single:n.length===1})}}function Ot(e,t){switch(e){case"i":return t.rCoda?"NEAR":!t.stressed&&t.last?"happY":"FLEECE";case"\u026A":return t.rCoda?"NEAR":"KIT";case"\u025B":return t.rCoda?"SQUARE":"DRESS";case"e\u026A":return t.rCoda?"SQUARE":"FACE";case"\xE6":return gt.has(t.w)||mt.has(t.w)||(t.next==="f"||t.next==="\u03B8"||t.next==="s")&&(t.after===void 0||!h(t.after))?"BATH":"TRAP";case"\u0251":return t.rCoda?"START":/(w|qu)a/.test(t.w)||t.w.includes("o")&&!/a(?!u|w)/.test(t.w)?"LOT":t.w.includes("a")&&!t.w.includes("o")?"PALM":"LOT";case"\u0254":return t.rCoda?"NORTH":Rt.test(t.w)?"THOUGHT":"CLOTH";case"o\u028A":return t.rCoda?"FORCE":"GOAT";case"\u028C":return"STRUT";case"\u028A":return t.rCoda?"CURE":"FOOT";case"u":return t.rCoda?"CURE":"GOOSE";case"\u025D":case"\u025A":return t.stressed?"NURSE":"lettER";case"\u0259":return t.last&&t.next===void 0&&!t.single?"commA":void 0;case"a\u026A":return"PRICE";case"a\u028A":return"MOUTH";case"\u0254\u026A":return"CHOICE";default:return}}var Ht=new Map([["wind","W IH1 N D"],["read","R IY1 D"],["live","L IH1 V"],["lead","L IY1 D"],["close","K L OW1 Z"],["wound","W UW1 N D"]]),de=new Map([["a","AH0"],["an","AE1 N"],["the","DH AH0"],["of","AH1 V"],["to","T UW1"],["in","IH0 N"],["on","AA1 N"],["at","AE1 T"],["by","B AY1"],["for","F AO1 R"],["from","F R AH1 M"],["with","W IH1 DH"],["as","AE1 Z"],["and","AH0 N D"],["or","AO1 R"],["but","B AH1 T"],["nor","N AO1 R"],["so","S OW1"],["if","IH1 F"],["is","IH1 Z"],["am","AE1 M"],["are","AA1 R"],["was","W AA1 Z"],["were","W ER1"],["be","B IY1"],["been","B IH1 N"],["do","D UW1"],["does","D AH1 Z"],["did","D IH1 D"],["has","HH AE1 Z"],["have","HH AE1 V"],["had","HH AE1 D"],["will","W IH1 L"],["would","W UH1 D"],["can","K AE1 N"],["could","K UH1 D"],["should","SH UH1 D"],["shall","SH AE1 L"],["may","M EY1"],["might","M AY1 T"],["must","M AH1 S T"],["it","IH1 T"],["its","IH1 T S"],["i","AY1"],["you","Y UW1"],["he","HH IY1"],["she","SH IY1"],["we","W IY1"],["they","DH EY1"],["me","M IY1"],["him","HH IH1 M"],["her","HH ER1"],["us","AH1 S"],["them","DH EH1 M"],["my","M AY1"],["your","Y AO1 R"],["his","HH IH1 Z"],["our","AW1 ER0"],["their","DH EH1 R"],["this","DH IH1 S"],["that","DH AE1 T"],["than","DH AE1 N"],["then","DH EH1 N"],["there","DH EH1 R"],["not","N AA1 T"],["no","N OW1"]]),yt=new Map([["one","W AH1 N"],["once","W AH1 N S"],["what","W AH1 T"],["who","HH UW1"],["two","T UW1"],["into","IH1 N T UW0"],["through","TH R UW1"],["where","W EH1 R"],["these","DH IY1 Z"],["those","DH OW1 Z"],["thee","DH IY1"],["thou","DH AW1"],["thy","DH AY1"],["thine","DH AY1 N"],["though","DH OW1"],["people","P IY1 P AH0 L"],["eye","AY1"],["eyes","AY1 Z"],["said","S EH1 D"],["any","EH1 N IY0"],["many","M EH1 N IY0"],["anywhere","EH1 N IY0 W EH2 R"],["anything","EH1 N IY0 TH IH2 NG"],["anyone","EH1 N IY0 W AH2 N"],["everything","EH1 V R IY0 TH IH2 NG"],["everywhere","EH1 V R IY0 W EH2 R"],["everyone","EH1 V R IY0 W AH2 N"],["great","G R EY1 T"],["friend","F R EH1 N D"],["hour","AW1 R"],["whole","HH OW1 L"],["woman","W UH1 M AH0 N"],["women","W IH1 M AH0 N"],["touch","T AH1 CH"],["ocean","OW1 SH AH0 N"],["together","T AH0 G EH1 DH ER0"],["get","G EH1 T"],["forget","F ER0 G EH1 T"],["give","G IH1 V"],["again","AH0 G EH1 N"],["against","AH0 G EH1 N S T"],["because","B IH0 K AO1 Z"],["even","IY1 V IH0 N"],["busy","B IH1 Z IY0"],["sure","SH UH1 R"],["sugar","SH UH1 G ER0"],["enough","IH0 N AH1 F"],["young","Y AH1 NG"],["done","D AH1 N"],["gone","G AO1 N"],["none","N AH1 N"],["bear","B EH1 R"],["wear","W EH1 R"],["break","B R EY1 K"],["guy","G AY1"],["buy","B AY1"],["lose","L UW1 Z"],["move","M UW1 V"],["goes","G OW1 Z"],["door","D AO1 R"],["fire","F AY1 R"],["desire","D IH0 Z AY1 R"],["i'm","AY1 M"],["i'll","AY1 L"],["i've","AY1 V"],["i'd","AY1 D"],["you're","Y UH1 R"],["you'll","Y UW1 L"],["you've","Y UW1 V"],["we're","W IY1 R"],["we'll","W IY1 L"],["they're","DH EH1 R"],["don't","D OW1 N T"],["won't","W OW1 N T"],["can't","K AE1 N T"],["isn't","IH1 Z AH0 N T"],["it's","IH1 T S"],["that's","DH AE1 T S"],["there's","DH EH1 R Z"],["let's","L EH1 T S"],["ain't","EY1 N T"],["didn't","D IH1 D AH0 N T"],["doesn't","D AH1 Z AH0 N T"],["wasn't","W AA1 Z AH0 N T"],["couldn't","K UH1 D AH0 N T"],["wouldn't","W UH1 D AH0 N T"],["shouldn't","SH UH1 D AH0 N T"],["he's","HH IY1 Z"],["she's","SH IY1 Z"],["what's","W AH1 T S"],["o'er","OW1 R"],["ne'er","N EH1 R"],["e'er","EH1 R"]]),Ct=new Set(["\u028C","\xE6","\u0251","\u025B","\u0254","u","\u028A"]),Nt=new Set(["you","do","to","who","not","no"]),wt=/[\u0300-\u036F]/g,Lt=/^'+|'+$/g;function fe(e,t={}){let r=e.toLowerCase().replace(Lt,""),n=r.normalize("NFD").replace(wt,""),o=Ht.get(n)??bt(t.dictionary,r,n)??de.get(n)??yt.get(n);if(o){let s=z(o);return t.reduce&&de.has(n)&&It(s,n),s}if(r.includes("-")){let s=[];for(let a of r.split("-"))s.push(...fe(a,t));return s}return le(n)}function bt(e,t,r){if(e)return e.get(t)||(r!==t?e.get(r):void 0)}function It(e,t){let r=0;for(let n of e)h(n.ipa)&&r++;for(let n of e)h(n.ipa)&&(n.stress=0,r===1&&Ct.has(n.ipa)&&!Nt.has(t)&&(n.ipa="\u0259"))}function j(e={}){return{starts:pe,continues:t=>t==="-"||pe(t)||t>="\u0300"&&t<="\u036F",word:t=>Ut(t,e)}}function Ut(e,t){let r=e.split("-").filter(o=>o!==""),n=[];for(let o of r){let s=fe(o,t);B(o,s);let a=C(s);if(a.length===0){let l=F(s);l&&a.push(l)}let i=r.length>1?[o]:ue(o,a.length);for(let l=0;l<a.length;l++){let{onset:u,nucleus:d,coda:p}=a[l];n.push({text:i[l]??"~",onset:u,nucleus:d,coda:p,wordEnd:!1,phraseEnd:!1})}}return n}function pe(e){if(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="'")return!0;if(e<"\xC0")return!1;let t=e.normalize("NFD");if(t.length<2)return!1;let r=t[0];if(!(r>="a"&&r<="z"||r>="A"&&r<="Z"))return!1;for(let n=1;n<t.length;n++)if(t[n]<"\u0300"||t[n]>"\u036F")return!1;return!0}var D="/",K={starts:e=>e===D,continues:e=>e!==D&&e!==`
|
|
3
|
+
`&&e!=="\r",word:e=>xt(Gt(e))};function xt(e){let{segments:t,breaks:r}=_(e),n=[],o=[[]];for(let s=0;s<t.length;s++){let a=t[s];if(a.ipa===y){n.length>0&&(n[n.length-1].phraseEnd=!0);continue}o[o.length-1].push(a),r[s]===x||s===t.length-1?(Pt(o,n),o=[[]]):r[s]===Y&&o.push([])}return n}function Pt(e,t){let r=e.length>1?Ft(e):C(e[0]);if(r.length===0){let n=F(e.flat());if(!n)return;r.push(n)}for(let n=0;n<r.length;n++){let{onset:o,nucleus:s,coda:a}=r[n];t.push({text:Dt(r[n]),onset:o,nucleus:s,coda:a,wordEnd:n===r.length-1,phraseEnd:!1})}}function Ft(e){let t=[],r=[];for(let n of e){let o=C(n);if(o.length===0){t.length>0?t[t.length-1].coda.push(...n):r.push(...n);continue}r.length>0&&(o[0].onset.unshift(...r),r=[]),t.push(...o)}return t}function Dt(e){let t=e.nucleus.stress===1?"\u02C8":e.nucleus.stress===2?"\u02CC":"";for(let r of e.onset)t+=r.ipa;t+=e.nucleus.ipa;for(let r of e.coda)t+=r.ipa;return t}function Gt(e){let t=e.startsWith(D)?1:0,r=e.length>t&&e.endsWith(D)?e.length-1:e.length;return e.slice(t,r)}function he(e,t,r={}){let n=r.t??"flap",o=r.l??"dark-coda",s=[],a=()=>{s.length>0&&Mt(s,n,o),s=[]};for(let i of e){if(!t(i)||i.melisma){a();continue}let l=[...i.onset,i.nucleus,...i.coda];l.forEach((u,d)=>s.push({seg:u,wordEnd:i.wordEnd&&d===l.length-1})),i.phraseEnd&&a()}a()}function Mt(e,t,r){if(t==="flap")for(let n=1;n+1<e.length;n++){let o=e[n-1],s=e[n+1],a=e[n].seg;(a.ipa==="t"||a.ipa==="d")&&(h(o.seg.ipa)||o.seg.ipa==="\u0279")&&h(s.seg.ipa)&&!(s.seg.stress!==void 0&&s.seg.stress!==0)&&!o.wordEnd&&(a.ipa="\u027E")}else if(t==="glottal"||t==="glottal-coda")for(let n=1;n<e.length;n++){let o=e[n].seg,s=e[n-1].seg.ipa;if(o.ipa!=="t"||!(h(s)||s==="n"||s==="l"))continue;let a=e[n+1]?.seg,i=a===void 0?t==="glottal":!h(a.ipa)&&!Wt.has(a.ipa),l=t==="glottal"&&a!==void 0&&h(a.ipa)&&!(a.stress!==void 0&&a.stress!==0)&&!e[n-1].wordEnd&&h(e[n-1].seg.ipa);(i||l)&&(o.ipa="\u0294")}if(r!=="clear")for(let n=0;n<e.length;n++){if(e[n].seg.ipa!=="l")continue;let s=!(n+1<e.length&&h(e[n+1].seg.ipa))||e[n].wordEnd;r==="dark"?e[n].seg.ipa="\u026B":s&&(e[n].seg.ipa=r==="vocalized"?"w":"\u026B")}}var Wt=new Set(["\u0279","w","j"]);var Q={tune:"fall",range:4,declination:2,rate:1},N={id:"general-american",name:"General American",rhotic:!0,sets:{},t:"flap",l:"dark-coda",th:"fricative",r:"approximant"},Ee={id:"southern-british",name:"Southern British",rhotic:!1,sets:{KIT:"\u026A",DRESS:"\u025B",TRAP:"a",LOT:"\u0252",STRUT:"\u0250",FOOT:"\u028A",BATH:"\u0251\u02D0",CLOTH:"\u0252",NURSE:"\u025C\u02D0",FLEECE:"i\u02D0",FACE:"e\u026A",PALM:"\u0251\u02D0",THOUGHT:"o\u02D0",GOAT:"\u0259\u028A",GOOSE:"\u0289\u02D0",PRICE:"a\u026A",CHOICE:"\u0254\u026A",MOUTH:"a\u028A",NEAR:"\u026A\u0259",SQUARE:"\u025B\u02D0",START:"\u0251\u02D0",NORTH:"o\u02D0",FORCE:"o\u02D0",CURE:"o\u02D0",happY:"i",lettER:"\u0259",commA:"\u0259"},hold:.55,t:"glottal-coda",l:"dark-coda",th:"fricative",r:"approximant",prosody:{tune:"fall",range:6,declination:3,rate:1}},Ae={id:"london",name:"London",rhotic:!1,sets:{KIT:"\u026A",DRESS:"e",TRAP:"\xE6",LOT:"\u0252",STRUT:"\u0250",FOOT:"\u028A",BATH:"\u0251\u02D0",CLOTH:"\u0252",NURSE:"\u025C\u02D0",FLEECE:"\u0259i",FACE:"\xE6\u026A",PALM:"\u0251\u02D0",THOUGHT:"o\u02D0",GOAT:"\u028C\u028A",GOOSE:"\u0289\u02D0",PRICE:"\u0251\u026A",CHOICE:"o\u026A",MOUTH:"\xE6\u028A",NEAR:"\u026A\u0259",SQUARE:"e\u02D0",START:"\u0251\u02D0",NORTH:"o\u02D0",FORCE:"o\u02D0",CURE:"o\u02D0",happY:"i",lettER:"\u0259",commA:"\u0259"},hold:.5,t:"glottal",l:"vocalized",th:"front",r:"approximant",hDrop:!0,prosody:{tune:"fall",range:5,declination:2,rate:1.05}},Se={id:"australian",name:"Australian",rhotic:!1,sets:{KIT:"\u026A",DRESS:"e",TRAP:"\xE6",LOT:"\u0254",STRUT:"\u0250",FOOT:"\u028A",BATH:"\u0250\u02D0",CLOTH:"\u0254",NURSE:"\u0275\u02D0",FLEECE:"\u026Ai",FACE:"\xE6\u026A",PALM:"\u0250\u02D0",THOUGHT:"o\u02D0",GOAT:"\u0250\u0289",GOOSE:"\u0289\u02D0",PRICE:"\u0252e",CHOICE:"o\u026A",MOUTH:"\xE6\u0254",NEAR:"\u026A\u0259",SQUARE:"e\u02D0",START:"\u0250\u02D0",NORTH:"o\u02D0",FORCE:"o\u02D0",CURE:"o\u02D0",happY:"i",lettER:"\u0259",commA:"\u0259"},hold:.45,t:"flap",l:"dark-coda",th:"fricative",r:"approximant",prosody:{tune:"rise",range:4,declination:1.5,rate:1}},Te={id:"new-zealand",name:"New Zealand",rhotic:!1,sets:{KIT:"\u0258",DRESS:"e",TRAP:"\u025B",LOT:"\u0252",STRUT:"\u0250",FOOT:"\u028A",BATH:"\u0250\u02D0",CLOTH:"\u0252",NURSE:"\xF8\u02D0",FLEECE:"\u026Ai",FACE:"\xE6\u026A",PALM:"\u0250\u02D0",THOUGHT:"o\u02D0",GOAT:"\u0250\u0289",GOOSE:"\u0289\u02D0",PRICE:"\u0252e",CHOICE:"oe",MOUTH:"\xE6\u028A",NEAR:"i\u0259",SQUARE:"i\u0259",START:"\u0250\u02D0",NORTH:"o\u02D0",FORCE:"o\u02D0",CURE:"\u0289\u0259",happY:"i",lettER:"\u0258",commA:"\u0258"},hold:.45,t:"flap",l:"dark",th:"fricative",r:"approximant",prosody:{tune:"rise",range:3.5,declination:1.5,rate:1.05}},ge={id:"irish",name:"Irish",rhotic:!0,sets:{KIT:"\u026A",DRESS:"\u025B",TRAP:"a",LOT:"\u0251",STRUT:"\u0250",FOOT:"\u028A",BATH:"a\u02D0",CLOTH:"\u0252",FLEECE:"i\u02D0",FACE:"e\u02D0",PALM:"a\u02D0",THOUGHT:"\u0252\u02D0",GOAT:"o\u02D0",GOOSE:"u\u02D0",PRICE:"\u0251\u026A",CHOICE:"\u0252\u026A",MOUTH:"\u0250\u028A",NEAR:"i",SQUARE:"e",START:"a",NORTH:"\u0252",FORCE:"o",CURE:"u",happY:"i"},hold:.6,t:"released",l:"clear",th:"stop",r:"approximant",prosody:{tune:"fall",range:5,declination:2,rate:1.05}},me={id:"scottish",name:"Scottish",rhotic:!0,sets:{KIT:"\u0258",DRESS:"\u025B",TRAP:"a",LOT:"\u0254",STRUT:"\u028C",FOOT:"\u0289",BATH:"a",CLOTH:"\u0254",NURSE:"\u028C\u027E",FLEECE:"i",FACE:"e",PALM:"a",THOUGHT:"\u0254",GOAT:"o",GOOSE:"\u0289",PRICE:"\u028C\u026A",CHOICE:"\u0254\u026A",MOUTH:"\u028C\u0289",NEAR:"i\u027E",SQUARE:"e\u027E",START:"a\u027E",NORTH:"\u0254\u027E",FORCE:"o\u027E",CURE:"\u0289\u027E",happY:"e",lettER:"\u0259\u027E",commA:"\u028C"},hold:.5,t:"glottal-coda",l:"dark",th:"fricative",r:"tap",prosody:{tune:"fall",range:4,declination:2,rate:1}},Re={id:"southern-us",name:"Southern US",rhotic:!0,sets:{DRESS:"\u025B",TRAP:"\xE6",BATH:"\xE6",FACE:"\u025B\u026A",THOUGHT:"\u0252\u0254",CLOTH:"\u0252\u0254",GOAT:"\u025C\u0289",GOOSE:"\u0289",PRICE:"a\u02D0",MOUTH:"\xE6\u028A",CHOICE:"o\u026A"},hold:.5,t:"flap",l:"dark",th:"fricative",r:"approximant",prosody:{tune:"fall",range:5,declination:2,rate:.85}},Oe={id:"canadian",name:"Canadian",rhotic:!0,sets:{TRAP:"a",BATH:"a",LOT:"\u0252",CLOTH:"\u0252",THOUGHT:"\u0252",PALM:"\u0252",FACE:"e\u026A",GOAT:"o\u028A"},raised:{PRICE:"\u028C\u026A",MOUTH:"\u028C\u028A"},hold:.6,t:"flap",l:"dark-coda",th:"fricative",r:"approximant",prosody:{tune:"fall",range:4,declination:2,rate:1}},He={id:"californian",name:"Californian",rhotic:!0,sets:{KIT:"\u026A",DRESS:"\u025B",TRAP:"a",BATH:"a",LOT:"\u0251",CLOTH:"\u0251",THOUGHT:"\u0251",FOOT:"\u0275",GOOSE:"\u0289",GOAT:"\u0275\u028A",FACE:"e\u026A"},hold:.55,t:"flap",l:"dark-coda",th:"fricative",r:"approximant",prosody:{tune:"fall",range:4.5,declination:2,rate:1.05}},ye={id:"new-york",name:"New York",rhotic:!1,sets:{TRAP:"\xE6",BATH:"e\u0259",LOT:"\u0251",PALM:"\u0251",CLOTH:"o\u0259",THOUGHT:"o\u0259",NORTH:"o\u0259",FORCE:"o\u0259",START:"\u0251",NURSE:"\u025C",PRICE:"\u0251\u026A",MOUTH:"\xE6\u028A",GOAT:"o\u028A",NEAR:"\u026A\u0259",SQUARE:"e\u0259",CURE:"\u028A\u0259",lettER:"\u0259"},hold:.55,t:"flap",l:"dark-coda",th:"fricative",r:"approximant",prosody:{tune:"fall",range:5,declination:2,rate:1.1}},Ce={id:"northern-english",name:"Northern English",rhotic:!1,sets:{KIT:"\u026A",DRESS:"\u025B",TRAP:"a",BATH:"a",LOT:"\u0252",CLOTH:"\u0252",STRUT:"\u028A",FOOT:"\u028A",NURSE:"\u025C",FLEECE:"i",FACE:"e",PALM:"\u0251",THOUGHT:"o",GOAT:"o",GOOSE:"u",PRICE:"a\u026A",CHOICE:"\u0254\u026A",MOUTH:"a\u028A",NEAR:"\u026A\u0259",SQUARE:"\u025B",START:"a",NORTH:"o",FORCE:"o",CURE:"\u028A\u0259",happY:"\u026A",lettER:"\u0259",commA:"\u0259"},hold:.6,t:"glottal-coda",l:"dark-coda",th:"fricative",r:"approximant",hDrop:!0,prosody:{tune:"fall",range:4,declination:2,rate:1}},Ne={id:"geordie",name:"Geordie (Tyneside)",rhotic:!1,sets:{KIT:"\u026A",DRESS:"\u025B",TRAP:"a",BATH:"a",LOT:"\u0252",CLOTH:"\u0252",STRUT:"\u028A",FOOT:"\u028A",NURSE:"\xF8",FLEECE:"i",FACE:"e\u0259",PALM:"\u0251",THOUGHT:"\u0252",GOAT:"\u0275",GOOSE:"\u0289",PRICE:"\u025B\u026A",CHOICE:"\u0254\u026A",MOUTH:"u",NEAR:"i\u0259",SQUARE:"\u025B",START:"\u0251",NORTH:"\u0252",FORCE:"\u0252",CURE:"\u0289\u0259",happY:"i",lettER:"\u0250",commA:"\u0250"},hold:.55,t:"glottal-coda",l:"clear",th:"fricative",r:"approximant",prosody:{tune:"rise",range:5,declination:1.5,rate:1.05}},we={id:"welsh",name:"Welsh",rhotic:!1,sets:{KIT:"\u026A",DRESS:"\u025B",TRAP:"a",BATH:"a",LOT:"\u0252",CLOTH:"\u0252",STRUT:"\u0259",FOOT:"\u028A",NURSE:"\xF8",FLEECE:"i",FACE:"e",PALM:"a",THOUGHT:"o",GOAT:"o",GOOSE:"\u0289",PRICE:"\u0259\u026A",CHOICE:"\u0254\u026A",MOUTH:"\u0259\u028A",NEAR:"\u026A\u0259",SQUARE:"\u025B",START:"a",NORTH:"o",FORCE:"o",CURE:"\u028A\u0259",happY:"i",lettER:"\u0259",commA:"a"},hold:.55,t:"released",l:"clear",th:"fricative",r:"tap",prosody:{tune:"rise",range:6,declination:1,rate:1,stressRatio:1.5}},Le={id:"northern-irish",name:"Northern Irish (Belfast)",rhotic:!0,sets:{KIT:"\u0258",DRESS:"\u025B",TRAP:"\u0251",BATH:"\u0251",LOT:"\u0254",CLOTH:"\u0254",STRUT:"\u0250",FOOT:"\u0289",FLEECE:"i",FACE:"e\u0259",PALM:"\u0251",THOUGHT:"\u0254",GOAT:"o",GOOSE:"\u0289",PRICE:"\u025B\u026A",CHOICE:"\u0254\u026A",MOUTH:"\u0258\u0289",NEAR:"i",SQUARE:"e",START:"\u0251",NORTH:"\u0254",FORCE:"o",CURE:"\u0289",happY:"e"},hold:.5,t:"flap",l:"clear",th:"fricative",r:"approximant",prosody:{tune:"rise",range:5,declination:1.5,rate:1.05}},be={id:"south-african",name:"South African",rhotic:!1,sets:{KIT:"\u026A",DRESS:"e",TRAP:"\u025B",BATH:"\u0251",LOT:"\u0252",CLOTH:"\u0252",STRUT:"\u0250",FOOT:"\u028A",NURSE:"\xF8",FLEECE:"i",FACE:"e\u026A",PALM:"\u0251",THOUGHT:"o",GOAT:"\u0153\u028A",GOOSE:"\u0289",PRICE:"\u0251\u026A",CHOICE:"\u0254\u026A",MOUTH:"\xE6\u028A",NEAR:"\u026A\u0259",SQUARE:"e",START:"\u0251",NORTH:"o",FORCE:"o",CURE:"\u028A\u0259",happY:"i",lettER:"\u0259",commA:"\u0259"},hold:.55,t:"released",l:"clear",th:"fricative",r:"approximant",prosody:{tune:"fall",range:4,declination:2,rate:1}},Ie={id:"nigerian",name:"Nigerian",rhotic:!1,sets:{KIT:"i",DRESS:"\u025B",TRAP:"a",BATH:"a",LOT:"\u0254",CLOTH:"\u0254",STRUT:"\u0254",FOOT:"u",NURSE:"\u025B",FLEECE:"i",FACE:"e",PALM:"a",THOUGHT:"\u0254",GOAT:"o",GOOSE:"u",PRICE:"a\u026A",CHOICE:"\u0254\u026A",MOUTH:"a\u028A",NEAR:"ia",SQUARE:"\u025B",START:"a",NORTH:"\u0254",FORCE:"\u0254",CURE:"ua",happY:"i",lettER:"a",commA:"a"},hold:.5,t:"released",l:"clear",th:"stop",r:"tap",prosody:{tune:"fall",range:4,declination:1.5,rate:1,stressRatio:1.1}},Ue={id:"jamaican",name:"Jamaican",rhotic:!1,sets:{KIT:"\u026A",DRESS:"\u025B",TRAP:"a",BATH:"a",LOT:"a",CLOTH:"a",STRUT:"\u0254",FOOT:"\u028A",NURSE:"\u0254",FLEECE:"i",FACE:"ie",PALM:"a",THOUGHT:"a",GOAT:"uo",GOOSE:"u",PRICE:"a\u026A",CHOICE:"a\u026A",MOUTH:"\u0254\u028A",NEAR:"i\u025B",SQUARE:"i\u025B",START:"a",NORTH:"a",FORCE:"uo",CURE:"uo",happY:"i",lettER:"a",commA:"a"},hold:.45,t:"released",l:"clear",th:"stop",r:"approximant",hDrop:!0,prosody:{tune:"fall",range:6,declination:1.5,rate:1.05,stressRatio:1.3}},xe={id:"indian",name:"Indian",rhotic:!0,sets:{KIT:"\u026A",DRESS:"\u025B",TRAP:"\xE6",BATH:"\u0251",LOT:"\u0252",CLOTH:"\u0252",STRUT:"\u0259",FOOT:"\u028A",NURSE:"\u0259\u027E",FLEECE:"i",FACE:"e",PALM:"\u0251",THOUGHT:"\u0254",GOAT:"o",GOOSE:"u",PRICE:"a\u026A",CHOICE:"\u0254\u026A",MOUTH:"a\u028A",NEAR:"i\u0259",SQUARE:"e",START:"\u0251",NORTH:"\u0254",FORCE:"o",CURE:"u\u0259",happY:"i",lettER:"\u0259\u027E",commA:"\u0259"},hold:.5,t:"released",l:"clear",th:"stop",r:"tap",prosody:{tune:"fall",range:5,declination:1.5,rate:1.05,stressRatio:1.25}},Pe={id:"singaporean",name:"Singaporean",rhotic:!1,sets:{KIT:"i",DRESS:"\u025B",TRAP:"\u025B",BATH:"\u0251",LOT:"\u0254",CLOTH:"\u0254",STRUT:"\u0250",FOOT:"u",NURSE:"\u0259",FLEECE:"i",FACE:"e",PALM:"\u0251",THOUGHT:"\u0254",GOAT:"o",GOOSE:"u",PRICE:"a\u026A",CHOICE:"\u0254\u026A",MOUTH:"a\u028A",NEAR:"\u026A\u0259",SQUARE:"\u025B",START:"\u0251",NORTH:"\u0254",FORCE:"\u0254",CURE:"\u028A\u0259",happY:"i",lettER:"\u0259",commA:"\u0259"},hold:.5,t:"glottal-coda",l:"clear",th:"stop",r:"approximant",prosody:{tune:"fall",range:3,declination:1,rate:1.1,stressRatio:1}},Z=Object.freeze(Object.fromEntries([N,Oe,He,ye,Re,Ee,Ae,Ce,Ne,me,we,ge,Le,Se,Te,be,Ie,Ue,xe,Pe].map(e=>[e.id,e])));function $(e){if(e===void 0)return N;if(typeof e!="string")return e;let t=Z[e];if(!t)throw new Error(`unknown accent "${e}"; built in: ${Object.keys(Z).join(", ")}`);return t}var vt=/[ːˑ:]/g;function kt(e){let t=Array.from(e.replace(vt,"")),r,n=t[t.length-1];(n==="\u0279"||n==="\u027E"||n==="r")&&(r=n==="r"?"\u0279":n,t.pop());let o=t.filter(s=>h(s));if(o.length===0||o.length>2||o.length!==t.length)throw new Error(`accent realization "${e}" is not one or two vowels and an optional r`);return{vowels:o,r}}var Fe=new Set(["\u0279","\u027E","r"]);function q(e,t,r){for(let n=0;n<e.length;n++){let o=e[n];if(!t(o)||o.melisma)continue;let s=e[n+1],a=!o.phraseEnd&&s!==void 0&&t(s)&&!s.melisma&&s.onset.length===0,i=o.coda[0]??(!o.wordEnd&&s!==void 0?s.onset[0]:void 0),l=i!==void 0&&Yt.has(i.ipa);_t(o,r,a,l),Vt(o,r,n===0||e[n-1].wordEnd)}}var Yt=new Set(["p","t","k","f","\u03B8","s","\u0283","t\u0283","h"]);function _t(e,t,r,n){let o=e.nucleus,s=o.set,i=(s!==void 0&&n?t.raised?.[s]:void 0)??(s===void 0?void 0:t.sets[s]),l=o.ipa==="\u025D"||o.ipa==="\u025A";if(i!==void 0){let u=kt(i);if(o.ipa=u.vowels.join(""),u.r!==void 0){let d=t.r==="tap"?"\u027E":u.r;e.coda.length>0&&Fe.has(e.coda[0].ipa)?e.coda[0].ipa=d:e.coda.unshift({ipa:d})}else l&&!t.rhotic&&r&&e.coda.unshift({ipa:"\u0279"})}if(t.rhotic||zt(e,r),Array.from(o.ipa).length===2&&s!==void 0){let u=t.holds?.[s]??t.hold;u!==void 0&&(o.hold=Math.max(0,Math.min(1,u)))}}function zt(e,t){for(let r=e.coda.length-1;r>=0;r--)!Fe.has(e.coda[r].ipa)||r===e.coda.length-1&&t||e.coda.splice(r,1)}function Vt(e,t,r){let n=[e.onset,e.coda];for(let o of n)for(let s=0;s<o.length;s++){let a=o[s],i=r&&o===e.onset&&s===0;t.th==="stop"?a.ipa==="\u03B8"?a.ipa="t":a.ipa==="\xF0"&&(a.ipa="d"):t.th==="front"&&(a.ipa==="\u03B8"?a.ipa="f":a.ipa==="\xF0"&&(a.ipa=i?"d":"v")),t.r==="tap"&&a.ipa==="\u0279"&&(a.ipa="\u027E")}t.hDrop&&r&&e.onset.length>0&&e.onset[0].ipa==="h"&&e.onset.shift()}var G=/\s/,Bt=/[\p{L}\p{M}\p{N}]/u;function jt(e){return e==="."||e===","||e===";"||e===":"||e==="!"||e==="?"||e===`
|
|
4
|
+
`}function De(e,t){let r=Array.from(e.normalize("NFC").replace(/’/g,"'")),n=[],o=0;for(;o<r.length;){let s=r[o],a=t.find(i=>i.starts(s));if(a){let i=a.continues(s)?Zt(r,o,a):Qt(r,o,a);if(i>o){Kt(n,a.word(r.slice(o,i).join(""))),o=i;continue}}if(jt(s))n.length>0&&(n[n.length-1].phraseEnd=!0);else if($t(r,o)){let i=n[n.length-1];i&&n.push({text:"~",onset:[],nucleus:{...i.nucleus},coda:[],melisma:!0,wordEnd:i.wordEnd,phraseEnd:!1})}o++}return n}function J(e,t={}){let r=j({dictionary:t.dictionary,reduce:t.reduce}),n=new WeakSet,o={starts:r.starts,continues:r.continues,word:l=>{let u=r.word(l);for(let d of u)n.add(d);return u}},s=De(e,[o,K]),a=$(t.accent),i=l=>n.has(l);return a!==N&&q(s,i,a),t.allophones!==!1&&he(s,i,{t:a.t,l:a.l}),s}function Kt(e,t){if(t.length!==0){t[t.length-1].wordEnd=!0;for(let r of t)e.push(r)}}function Zt(e,t,r){let n=t+1;for(;n<e.length&&r.continues(e[n]);)n++;return n}function Qt(e,t,r){let n=e[t];if(t>0&&Bt.test(e[t-1])||t+1>=e.length||e[t+1]===n||G.test(e[t+1]))return t;let o=t+1;for(;o<e.length&&e[o]!==n&&r.continues(e[o]);)o++;return o>=e.length||e[o]!==n||G.test(e[o-1])?t:o+1}function $t(e,t){let r=e[t];if(r!=="-"&&r!=="~")return!1;let n=t===0||G.test(e[t-1]),o=t+1===e.length||G.test(e[t+1]);return n&&o}var qt=/^(\S+)\s+(.+)$/,Jt=/\(\d+\)$/;function Xt(e){let t=new Map;for(let r of e.split(`
|
|
5
|
+
`)){let n=r.trim();if(n===""||n.startsWith(";;;"))continue;let o=qt.exec(n);if(!o)continue;let s=o[1];if(Jt.test(s))continue;let a=o[2].indexOf("#"),i=(a<0?o[2]:o[2].slice(0,a)).trim().split(/\s+/).join(" ");if(i==="")continue;let l=s.toLowerCase();t.has(l)||t.set(l,i)}return t}import{clamp as W}from"bellowsjs";var en=Object.freeze({p:.085,b:.07,t:.075,d:.06,\u0288:.075,\u0256:.065,c:.08,\u025F:.07,k:.08,g:.07,q:.085,\u0262:.075,\u0294:.06,m:.075,\u0271:.075,n:.07,\u0273:.07,\u0272:.075,\u014B:.08,\u0274:.08,\u0278:.11,\u03B2:.09,f:.11,v:.08,\u03B8:.11,\u00F0:.07,s:.12,z:.09,\u0283:.12,\u0292:.09,\u0282:.12,\u0290:.09,\u00E7:.12,\u029D:.09,x:.12,\u0263:.09,\u03C7:.12,\u0281:.09,\u0127:.12,\u0295:.09,h:.09,\u0266:.08,\u026C:.12,\u026E:.09,ts:.14,dz:.12,t\u0283:.15,d\u0292:.13,\u0255:.12,\u0291:.09,t\u0255:.14,d\u0291:.12,t\u0282:.14,d\u0290:.12,pf:.14,w:.06,\u028B:.06,\u0279:.065,\u027B:.065,j:.055,\u0265:.055,\u0270:.06,l:.065,\u026B:.075,\u026D:.065,\u028E:.07,\u027E:.025,\u027D:.03,r:.11,\u0280:.11,\u0299:.12}),tn=.07,We=.8;var Ge=new Map(Object.entries(en)),nn=new Map([["\u0261","g"],["\u02A3","dz"],["\u02A4","d\u0292"],["\u02A5","d\u0291"],["\u02A6","ts"],["\u02A7","t\u0283"],["\u02A8","t\u0255"]]),on=/[ʰ-˿̀-ͯ]/g;function Me(e){let t=Ge.get(e);if(t!==void 0)return t;let r=nn.get(e);return r===void 0?void 0:Ge.get(r)}function O(e){return Me(e)??Me(e.replace(on,""))??tn}var rn=.05,sn=.012,an=.02,ln=.12,cn=.3,un=.8,dn=.001,pn=.8,fn=4,hn=86400,En=10,An=new Map([["a\u026A",["a","\u026A"]],["a\u028A",["a","\u028A"]],["e\u026A",["e","i"]],["o\u028A",["o","u"]],["\u0254\u026A",["\u0254","\u026A"]]]);function Sn(e){let t=An.get(e);if(t!==void 0||e.length!==2)return t;let r=e[0],n=e[1];return h(r)&&h(n)?[r,n]:void 0}var Tn={text:"ah",onset:[],nucleus:{ipa:"\u0251",stress:1},coda:[],wordEnd:!0,phraseEnd:!1};function gn(e,t,r={}){let n=W(r.consonantScale??We,0,fn),o=mn(e,t),s=o.length;if(s===0)return{phrases:[],leadIn:0};let a=new Array(s);for(let c=0;c<s;c++){let f=o[c];a[c]=c===s-1||f.syl.phraseEnd||o[c+1].time-(f.time+f.len)>dn}let i=new Array(s),l=new Array(s),u=0;for(let c=0;c<s;c++){c>0&&a[c-1]&&(u=c),i[c]=o[c].syl.melisma===!0?[]:ve(o[c].syl.onset,n);let f=!a[c]&&o[c+1].syl.melisma===!0;l[c]=f?[]:ve(Rn(o,c,u).coda,n)}let d=new Array(s);for(let c=0;c<s;c++){let f=o[c];if(a[c])if(c+1<s){let A=o[c+1].time,L=A-f.time,m=Math.min(f.len,L),H=f.syl.phraseEnd?Math.min(ln,cn*m):0;M(l[c].concat(i[c+1]),L-H),M(l[c],m),d[c]=Math.max(f.time,Math.min(f.time+m,A-w(i[c+1])-H))}else M(l[c],f.len),d[c]=f.time+f.len;else{let A=o[c+1].time;M(l[c].concat(i[c+1]),A-f.time),d[c]=Math.max(f.time,A-w(i[c+1]))}}let p=[],E=0;for(let c=0;c<s;){let f=c;for(;!a[f];)f++;let A=On(o,i,l,d,c,f);A!==void 0&&(p.push(A),E=Math.max(E,o[c].time-A.start)),c=f+1}return{phrases:p,leadIn:E}}function mn(e,t){let r=[];for(let o of e)Number.isFinite(o.time)&&Number.isFinite(o.hz)&&o.hz>0&&r.push(o);r.sort((o,s)=>o.time-s.time);let n=t.length>0?t:[Tn];return r.map((o,s)=>({time:o.time,len:W(o.dur,0,hn),hz:o.hz,vel:W(o.vel??pn,0,1),syl:n[s%n.length]}))}function Rn(e,t,r){let n=t;for(;n>r&&e[n].syl.melisma===!0;)n--;return e[n].syl}function ve(e,t){let r=[];for(let n of e){let o=n.dur,s=typeof o=="number"&&Number.isFinite(o)?W(o,0,En):O(n.ipa)*t;r.push({ipa:n.ipa,dur:s})}return r}function w(e){let t=0;for(let r of e)t+=r.dur;return t}function M(e,t){let r=w(e),n=t-rn;if(r<=n||r<=0)return;let o=Math.max(0,n)/r,s=0;for(let i of e)i.dur=Math.max(Math.min(i.dur,sn),i.dur*o),s+=i.dur;let a=s+an;if(a>t){let i=Math.max(0,t)/a;for(let l of e)l.dur*=i}}function On(e,t,r,n,o,s){let a=[],i=e[o].time,l=i-w(t[o]),u=[{time:l,hz:e[o].hz}];X(a,t[o],l,i,"onset");for(let d=o;d<=s;d++){let p=e[d],E=n[d],c=Math.max(p.time,E-w(r[d])),f=d===s||e[d+1].syl.melisma!==!0,A=d>o&&p.syl.melisma===!0;Hn(a,p.syl.nucleus,p.time,c,f,A),X(a,r[d],c,E,"coda"),d<s&&(u.push({time:E,hz:e[d+1].hz}),X(a,t[d+1],E,e[d+1].time,"onset"))}if(a.length!==0)return{start:a[0].start,end:a[a.length-1].end,vel:e[o].vel,spans:a,pitches:u}}function X(e,t,r,n,o){let s=r;for(let a=0;a<t.length;a++){let i=a===t.length-1?n:Math.min(n,s+t[a].dur);i>s&&e.push({ipa:t[a].ipa,start:s,end:i,kind:o}),s=i}}function Hn(e,t,r,n,o,s){let a=t.ipa,i=Sn(a);if(i!==void 0&&o){let l=r+(t.hold??un)*(n-r);ee(e,i[0],r,l,s),ee(e,i[1],l,n,!1)}else ee(e,i===void 0?a:i[0],r,n,s)}function ee(e,t,r,n,o){if(!(n>r))return;let s=e[e.length-1],a=s!==void 0&&s.kind==="nucleus"&&s.ipa===t;if(o&&a&&s.end===r){s.end=n;return}e.push({ipa:t,start:r,end:n,kind:"nucleus"})}function Ye(e,t={}){let r=J(e,t),n=[],o=[],s=[];for(let a of r){if(o.push(a),!a.wordEnd)continue;let i=ke(o);n.push(i),s.push(i.ipa,a.phraseEnd?" | ":" "),o=[]}if(o.length>0){let a=ke(o);n.push(a),s.push(a.ipa)}return{words:n,ipa:s.join("").replace(/ \| $/,"").trim(),syllables:r}}function yn(e,t={}){return Ye(e,t).ipa}function ke(e){let t=e.filter(n=>!n.melisma).length>1,r=e.filter(n=>!n.melisma).map(n=>{let o=t&&n.nucleus.stress===1?"\u02C8":t&&n.nucleus.stress===2?"\u02CC":"",s=[...n.onset,n.nucleus,...n.coda].map(a=>a.ipa).join("");return o+s}).join(".");return{text:e.map(n=>n.text).join("-"),ipa:r,syllables:e,sets:e.map(n=>n.nucleus.set)}}var ze=.18,Ve=.09,_e=ze+Ve,te=2,Cn=1.5,Nn=.28;function wn(e,t={},r=[]){let n=t.prosody??Q,o=t.hz!==void 0&&t.hz>0?t.hz:110,s=Math.max(.1,(t.rate??1)*n.rate),a=Math.max(.5,n.stressRatio??te),i=a===te?Ve:_e/(1+a),l=a===te?ze:_e*a/(1+a),u=[],d=[],p=0,E=0;for(let c=0;c<e.length;){let f=c;for(;f<e.length-1&&!e[f].phraseEnd;)f++;let A=e.slice(c,f+1),L=r[E]??n.tune==="rise",{pitches:m,endTone:H}=Ln(A,n,L);for(let T=0;T<A.length;T++){let S=A[T],R=T===A.length-1,Be=S.nucleus.stress!==void 0&&S.nucleus.stress>0,b=S.nucleus.dur??(Be?l:i);R&&(b*=Cn);let I=0;for(let g of S.coda)I+=g.dur??O(g.ipa);if(!R)for(let g of A[T+1].onset)I+=g.dur??O(g.ipa);if(R&&H!==void 0){let g=.45*b/s,oe=(.55*b+I)/s;d.push({...S,coda:[],phraseEnd:!1,wordEnd:!1}),d.push({text:"~",onset:[],nucleus:{...S.nucleus},coda:S.coda,melisma:!0,wordEnd:S.wordEnd,phraseEnd:S.phraseEnd}),u.push({time:p,dur:g,hz:o*2**(m[T]/12)}),u.push({time:p+g,dur:oe,hz:o*2**(H/12)}),p+=g+oe;continue}let ne=(b+I)/s;d.push(S),u.push({time:p,dur:ne,hz:o*2**(m[T]/12)}),p+=ne}if(f<e.length-1){let T=0;for(let R of e[f+1].onset)T+=R.dur??O(R.ipa);let S=Nn/s+T;u.push({time:p,dur:S,hz:0,rest:!0}),p+=S}E++,c=f+1}return{syllables:d,notes:u}}function Ln(e,t,r){let n=e.length,o=-1;for(let a=n-1;a>=0;a--){let i=e[a].nucleus.stress;if(i!==void 0&&i>0){o=a;break}}o<0&&(o=n-1);let s=[];for(let a=0;a<n;a++){let i=n>1?-t.declination*(a/(n-1)):0,l=e[a].nucleus.stress??0,u=i;if(a<o)l===1?u+=t.range*(a===bn(e)?1:.7):l===2&&(u+=t.range*.35);else if(a===o)u+=r?-.25*t.range:t.range;else{let d=(a-o)/(n-1-o);u+=r?t.range*(.4+.8*d):-.6*t.range*d-.2*t.range}s.push(u)}return o<n-1?{pitches:s}:{pitches:s,endTone:r?-t.declination+t.range:-t.declination-.4*t.range}}function bn(e){for(let t=0;t<e.length;t++)if(e[t].nucleus.stress===1)return t;return-1}export{ot as a,z as b,Tt as c,B as d,j as e,K as f,Q as g,N as h,Ee as i,Ae as j,Se as k,Te as l,ge as m,me as n,Re as o,Oe as p,He as q,ye as r,Ce as s,Ne as t,we as u,Le as v,be as w,Ie as x,Ue as y,xe as z,Pe as A,Z as B,$ as C,q as D,De as E,J as F,wn as G,gn as H,Xt as I,Ye as J,yn as K};
|
|
6
|
+
//# sourceMappingURL=chunk-4LLNG2YR.js.map
|