Skip to content

A port of the emacspeak python server to swift

License

Notifications You must be signed in to change notification settings

robertmeta/swiftmac

Repository files navigation

SwiftMac

Confirguration / Install

swiftmac.tar.gz (binaries)

Copy the extracted files to the $EMACSPEAK_DIR/servers and then add the swiftmac server to your emacs config, for more info see: Readme.emacspeak.org

source based

Otherwise see: Readme.emacspeak.org

Bonus configuration stuff

; control volume
; these are between 0.0 and 1.0
(setenv "SWIFTMAC_TONE_VOLUME" "0.1") 
(setenv "SWIFTMAC_SOUND_VOLUME" "0.1") 
(setenv "SWIFTMAC_VOICE_VOLUME" "1.0") 
; examples of messing with voices
(swiftmac-define-voice voice-bolden "[{voice en_US:Fred}] [[pitch 0.8]]")
(swiftmac-define-voice voice-animate "[{voice en-US:Kit}] [[pitch 1]]")
(swiftmac-define-voice voice-animate-extra "[{voice en-US:Kit}] [[pitch 1.5 ]]")
(swiftmac-define-voice voice-lighten "[{voice en-AU:Matilda}] [[pitch 1]]")
(swiftmac-define-voice voice-lighten-extra "[{voice en-AU:Matilda}] [[pitch 1.1]]")
(swiftmac-define-voice voice-smoothen "[{voice en-UK:Daniel}] [[pitch 1]]")
(swiftmac-define-voice voice-monotone "[{voice en-US:Eddy}] [[pitch 1]]")
(swiftmac-define-voice voice-monotone-extra "[{voice en-US:Eddy}] [[pitch 1.5]]")

Introduction

This is an emacspeak server written in swift intended to be as async as reasonable, fast and responsive.

Unless you are a developer or interested in becoming one, you probably want to use the version bundled with emacspeak, I keep that copy up to date with this one fairly consistently.

Hacking

The recommended workflow is to symlink the swiftmac binary under either .build/release/swiftmac or ./build/debug/swiftmac (depending which you are building) to your emacspeak servers directory.

then just

make

for debug or

make release

to build a fresh binary.

I will likely remove make install in the future, as it is a bit fidgety, but I will leave it in for now.

Having Trouble?

It emits warnings and notes

I am aware of the current warnings, it is a goal to get it to build completely clean but tthat is not a priority right now, getting to v2 is the priority.

Double-Speaking

If you are hearing stuff twice, ensure that mac-ignore-accessibility is set and your emacs version supports it. If that doesn’t work, you can use the VoiceOver Utility that comes with MacOS to create an activity for Emacs.app to turn off voiceover while in the Emacs window. This only works if you are using a windowed version of Emacs (not terminal version).

Design

The server intends to provide primitives to support all the features used by emacspeak and swiftmac-voices.el.

Supported Commands

These are the commands sent via stdin and on thier own line.

  • a: queue audio icon
  • c: queue code
  • d: dispatch queue
  • l: instant letter
  • p: instant audio icon
  • q: queue speech
  • s: stop all (confirm with list)_
  • sh: queue silence
  • t: queue tone
  • tts_pause: instant pause speech engine (should stop?)
  • tts_reset: queue reset (to defaults?)
  • tts_resume: instant resume speech engine
  • tts_say: instant say no additional tweaking
  • tts_set_character_scale: queue char scale change
  • tts_set_punctuations: queue punct change
  • tts_set_speech_rate: queue rate change
  • tts_split_caps: queue split caps change
  • tts_sync_state: [decomp] queue multiple settings change
  • version: [decomp] say tts version

Not Implemented yet:

  • set_next_lang:
  • set_previous_lang:
  • set_lang
  • set_preferred_lang

Engine Specific:

  • tts_exit: instant exit
  • tts_set_pitch_multiplier: .5 to 2 pitch multiplier
  • tts_set_sound_volume: 0 to 1 (1 being 100% sound volume)
  • tts_set_tone_volume: 0 to 1 (1 being 100% tone volume)
  • tts_set_voice: queue voice change
  • tts_set_voice_volume: 0 to 1 (1 being 100% voice volume)

Broken:

  • tts_allcaps_beep: queue caps beep change, setting only works on typing input

Supported Embeddings

These are converted by the preprocessor into tts_ commands.

  • [*] - queue silence in place of this

Goals

  1. The server should be as dumb as possible.
  2. Major decisions should be configurable in lisp.
  3. System should be “usable by default” meaing: once it builds, it works.
  4. Server will depend on only clearly defined and checked at compile time things. No secret deps on command line tools.