{"_id":"@caseys-npm/hear-say","name":"@caseys-npm/hear-say","dist-tags":{"latest":"0.4.0"},"versions":{"0.4.0":{"name":"@caseys-npm/hear-say","version":"0.4.0","description":"macOS text-to-speech and speech-to-text library wrapping say and hear CLI","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","lint":"eslint src","lint:fix":"eslint src --fix","knip":"knip","test":"tsx test.ts","test:phonetic":"tsx tests/phonetic.test.ts","prepublishOnly":"npm run build","postinstall":"node -e \"if(process.platform!=='darwin')console.warn('[hear-say] Warning: This library only works on macOS.')\""},"keywords":["macos","tts","stt","speech","voice","say","hear","text-to-speech","speech-to-text"],"author":{"name":"Casey Kolderup"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/caseys/hear-say.git"},"bugs":{"url":"https://github.com/caseys/hear-say/issues"},"homepage":"https://github.com/caseys/hear-say#readme","engines":{"node":">=18"},"os":["darwin"],"dependencies":{"@xenova/transformers":"^2.17.2","phonetics":"^1.0.5","stopwords-en":"^0.3.0","syllable":"^5.0.1"},"devDependencies":{"@eslint/js":"^9.39.2","@types/node":"^20.0.0","eslint":"^9.39.2","eslint-plugin-unicorn":"^62.0.0","knip":"^5.76.1","tsx":"^4.21.0","typescript":"^5.0.0","typescript-eslint":"^8.50.0"},"_id":"@caseys-npm/hear-say@0.4.0","gitHead":"b266f3b0bf0485e31c721b318f10860edd7661c0","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-rQXuWaCM2iAUkvHVGHCyKYMhnGPHweYifqZB7qPgQqIHPdcY2sFPpkBSqQ/qyarue64NrNoIDb/SgLSsWv8rLQ==","shasum":"d339110e223bd1e8663c0717b9e8a4f07dc867fe","tarball":"https://registry.npmjs.org/@caseys-npm/hear-say/-/hear-say-0.4.0.tgz","fileCount":47,"unpackedSize":138239,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFwEwh1g0AaG1hs7mUYpmhICPY8/L8un+LR2tDoz5yNqAiBYvF1q3nJ5BC8BIV6lVU7UPT+sVdkp5EycUKA7kPnh4A=="}]},"_npmUser":{"name":"caseys-npm","email":"casey.spain@gmail.com"},"directories":{},"maintainers":[{"name":"caseys-npm","email":"casey.spain@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hear-say_0.4.0_1769279955379_0.8053357503202034"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-24T18:39:15.261Z","0.4.0":"2026-01-24T18:39:15.527Z","modified":"2026-01-24T18:39:15.758Z"},"maintainers":[{"name":"caseys-npm","email":"casey.spain@gmail.com"}],"description":"macOS text-to-speech and speech-to-text library wrapping say and hear CLI","homepage":"https://github.com/caseys/hear-say#readme","keywords":["macos","tts","stt","speech","voice","say","hear","text-to-speech","speech-to-text"],"repository":{"type":"git","url":"git+https://github.com/caseys/hear-say.git"},"author":{"name":"Casey Kolderup"},"bugs":{"url":"https://github.com/caseys/hear-say/issues"},"license":"MIT","readme":"# hear-say\n\nMinimal macOS TypeScript glue on top of Apple’s `say` (TTS) and the [`hear`](https://sveinbjorn.org/hear) CLI (STT).\n\n## Limits:\n\n- **MacOS only.** Uses Apple binaries (`say`) and the macOS-only `hear` CLI.\n- **Minimal speech-driven interruption** Interrupt via keyboard or inbetween said phrases.\n\n## Vibe Code Warning\n\nClaude did most of the work here - it's a bit messy, but solid and fast.\n\n## Hack Warning\n\nThis project leans on Apple’s built‑in STT/TTS stack—30+ years of MacinTalk heritage, fast, tiny, and surprisingly good on older hardware. The library is a pragmatic “hack on top” of the `say` CLI and the `hear` CLI, with a small queue, tags, and glue to make them feel like an API.\n\nCredit: `hear` is by Sveinbjörn Þórðarson (see https://sveinbjorn.org/hear).\n\n## Features\n\n- **Say queue** with automatic rate control as the queue grows.\n- **Interrupt modes** for `say`: polite interrupt, clear queue, rude cut‑off, “latest wins.”\n- **Brief gaps** between queue items for turn‑taking (helps `hear` capture speech).\n- **`[[...]]` tags** (classic MacinTalk) pass through for rate/volume/pitch control.\n- **STT streaming + dictionary correction** for names and domain terms.\n\n## Install\n\n```bash\nbrew install hear\nnpm install @caseys-npm/hear-say\n```\n\nRequires Node.js 18+ and macOS.\n\n## Usage\n\n```ts\nimport { say, hear, loopback, setDictionary } from '@caseys-npm/hear-say';\n\n// say(): queued TTS\nawait say('Hello');\nsay('Next up', { interrupt: true });\n\n// hear(): streaming STT\nhear((text, stop, final) => {\n  if (final) console.log('Final:', text);\n});\n\n// loopback(): speak and re-hear (useful for tuning)\nconst heard = await loopback('Test phrase');\n\n// dictionary: help STT with names\nsetDictionary(['Kerbin', 'Minmus']);\n```\n\n## Dictionary + Heuristics\n\nWhen a dictionary is provided, recognized words are scored against it using phonetic and textual similarity (Double Metaphone + edit distance), with small bonuses for prefix/syllable matches. This is aimed at names and domain terms. See `use-dictionary.md` for details.\n\n## Future:\n\nSupport other minimal, low‑resource engines with similar ergonomics:\n\n- Windows: `System.Speech` and `Windows.Media.Speech*`\n- iOS/macOS: `AVSpeechSynthesizer`\n- Cross‑platform: `Pocket‑TTS` (https://github.com/kyutai-labs/pocket-tts)\n\n## Why\n\nI created this to use with an MCP service for Kerbal Space Program... to get that 2001-Hal-like experience.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-54272481f1b183375838e89e1004ec50"}