Text to Speech

approved

by Johannes Theiner

Hear your notes.

β˜… 124 stars↓ 49,921 downloadsUpdated 11mo agoGPL-3.0

πŸ—£οΈText to Speech

Plugin for Obsidian

GitHub manifest.json dynamic (path) libera manifesto

Features:

  • Start playback for note from statusbar and ribbon
  • Only speaking selected text in edit mode: Selection Demo
  • usable with other plugins (currently RSS Reader)

You can create language specific voices, the plugin will try to identify the language used. If it is not identified correctly you can overwrite this behaviour by having lang: {languageCode} in the Frontmatter. The language code can be seen in the settings and is a two letter ISO 639-1 code.

This plugin will NOT work on android due to this bug in the Webview.

Adding languages

This plugin uses the native API of your Operating System, to add a new language reference the documentation accordingly:

Windows

Obsidian can only use the voices Windows offers to apps, which are the ones listed under Settings > Time & language > Speech. Older SAPI5 voices, like IVONA voices, and the natural voices of Microsoft Edge are not available to Obsidian.

Linux

Linux has no voices by default. To get voices:

  1. Install speech-dispatcher and a speech engine, for example espeak-ng or piper. The package names depend on your distribution.
  2. Run spd-config -u to configure speech-dispatcher for your user, then log out and back in.
  3. Start Obsidian with the --enable-speech-dispatcher flag. If you installed Obsidian through Flatpak, the flag goes after the app id: flatpak run md.obsidian.Obsidian --enable-speech-dispatcher.

Check that spd-say "hello" works in a terminal first, Obsidian will not have voices if it does not.

Installing the plugin

  • Settings > Community plugins > Community plugins > Browse and search for Text to Speech

API

You can use this plugins API to add Text to Speech capabilities to your plugin.

This uses the @vanakat/plugin-api package.

You can find the API documentation here: API Documentation

const tts = pluginApi('tts');
await tts.say(title, text, language);//language is optional, use a ISO 639-1 code
tts.pause();
tts.resume();
tts.stop();
tts.isSpeaking();
tts.isPaused();

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.