Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/litomore/mac-say
The macOS built-in `say` interface for JavaScript
https://github.com/litomore/mac-say
macos say speech spoken-content text-to-speech
Last synced: about 2 months ago
JSON representation
The macOS built-in `say` interface for JavaScript
- Host: GitHub
- URL: https://github.com/litomore/mac-say
- Owner: LitoMore
- License: mit
- Created: 2024-05-13T03:30:49.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-27T08:08:27.000Z (2 months ago)
- Last Synced: 2024-10-27T08:11:09.636Z (2 months ago)
- Topics: macos, say, speech, spoken-content, text-to-speech
- Language: TypeScript
- Homepage:
- Size: 44.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# mac-say
The macOS built-in `say` CLI for JavaScript
## Install
```shell
npm i mac-say
```## Usage
```javascript
import { say } from "mac-say";await say("Hello, world!");
await say("Hello! My name is Cellos.", { voice: "Cellos" });
```## API
### say(text, options?)
#### text
Type: `string`
The content to be converted to audible speech.
#### options
Type: `SayOptions`
Optional. All available options are listed below:
```typescript
type SayOptions = {
voice?: string;
rate?: number;
audioDevice?: string;
quality?: number;
inputFile?: string;
outputFile?: string;
networkSend?: string;
channels?: number;
skipRunningCheck?: boolean;
};
```Please refer to [`man say`](https://www.unix.com/man-page/osx/1/say/) for usage of all options.
### getAudioDevices()
To obtain a list of audio output devices.
Returns a [`Promise`][types].
### getDataFormats(fileFormat)
To obtain a list of audio data formats for a file format specified explicitly or by file name.
Returns a [`Promise`][types].
#### fileForamt
Type: `string`
Formats other than linear PCM are specified by giving their format identifiers (aac, alac).
### getFileFormats()
To obtain a list of writable file formats.
Returns a [`Promise`][types].
### getVoices()
To obtain a list of voices installed in the system.
Returns a [`Promise`][types].
### checkIfSayIsRunning()
To obtain the information of the `say` process.
Returns a [`Promise`](https://github.com/sindresorhus/ps-list/blob/46f7d16920ed12c2866ddacc5044df7f8f87b179/index.d.ts#L13-L38).
### killRunningSay()
To kill the say process if it's running.
## Related
- [Say - Spoken Content](https://raycast.com/litomore/say) - macOS built-in Spoken Content interface
## License
MIT
[types]: https://github.com/LitoMore/mac-say/blob/main/source/types.ts