SOURCE / PINNED RELEASE
Made of little things.
Pursuit PIT
- Release
- 565f4981bdc3…
- Author-recorded commit
- 197afdbed44b…
- License
- LICENSE
- Author’s source reference
- nostr://npub12lm3rxsva8kfempyjkxupt09e02n3fezurkyadyqfejdc5e0r2kscqty6r/wss%3A%2F%2Fgit.napplet.soy%2F/n-951414e7fd7
Archive hash verified: 3b0485589942fd5c…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
// Prints how Piper/espeak-ng will pronounce every radio clip (IPA phonemes per sentence),
// for checking pronunciation. Run with: bun tools/voices/phonemes.ts
import { homedir } from 'node:os';
import { join } from 'node:path';
import { CLIPS } from '../../src/game/radio-script.ts';
const dir = join(homedir(), '.cache/piper-dl');
const keys = Object.keys(CLIPS).filter((k) => !/\.(speed|fast)\d+$/.test(k) || /(speed|fast)(60|100|110|140|160)$/.test(k));
const input = keys.map((k) => JSON.stringify({ text: CLIPS[k].say, output_file: join(dir, 'phon.wav') })).join('\n') + '\n';
const p = Bun.spawnSync([join(dir, 'piper/piper/piper.exe'), '--model', join(dir, 'models/en_US-libritts-high.onnx'), '--json-input', '--debug'],
{ stdin: Buffer.from(input), cwd: join(dir, 'piper/piper') });
const log = p.stderr.toString() + p.stdout.toString();
// Piper logs "Phonemizing text: ..." per input, then "Converting N phoneme(s) to ids: ..." per sentence.
const out: string[] = [];
for (const line of log.split(/\r?\n/)) {
const text = line.match(/Phonemizing text: (.*)$/);
if (text) out.push(`\n${keys[out.filter((l) => l.startsWith('\n')).length] ?? '?'}: ${text[1].trim()}`);
const ph = line.match(/to ids: (.*)$/);
if (ph) out.push(` ${ph[1].trim()}`);
}
console.log(out.join('\n'));
