Code Monkey home page Code Monkey logo

oevoice's Introduction

OEVoice Logo

Swift Compatibility Platform Compatibility License - MIT Version GitHub last commit Mastodon Twitter

Overview

AVSpeechSynthesis for Old English with IPA pronunciations.

OEVoiceExample

Check out the example app to see how you can use this package in your iOS app.

Installation

  1. In Xcode go to File -> Add Packages
  2. Paste in the repo's url: https://github.com/ryanlintott/OEVoice and select by version.

Usage

Import the package using import OEVoice

Platforms

This package is compatible with iOS 14 or later.

Is this Production-Ready?

Really it's up to you. I currently use this package in my own Old English Wordhord app.

Support

If you like this package, buy me a coffee to say thanks!

ko-fi


Details

Use AVSpeechSynthesizerIPA instead of AVSpeechSynthesizer to access speakIPA(_ ipaString: String, voice: AVSpeechSynthesisVoice, willSpeak: ((String) -> Void)? = nil)

There are 3 options for initializing AVSpeechSynthesizerIPA

  1. AVSpeechSynthesizerIPA.oeSupported - Use this to ensure an OEVoice supported language is set.
  2. AVSpeechSynthesizerIPA.init(language: String) - Force a language of your choice.
  3. AVSpeechSynthesizerIPA.init?(languages: [String]) - Provide a list of language options.

Why must a language be provided?

Somewhere in the internals of AVspeechSynthesizer's speak() function, a language value is set the first time it's run. Instead of using the language supplied by AVSpeechSynthesisVoice used in AVSpeechUtterance, it accesses the user's preferred languages (probably via the UserDefaults key AppleLanguages. If the preferred language does not match the voice language, speech using IPA will not be at all accurate. Sounds will be mispronounced, some chatacters will be read as their character name instead of their sound, and some characters will be ignored.

I have reported this as a bug (FB9688443). Ideally speak() would only use the language of the supplied voice each time it's run and would not need to reference the user's preferred langauges.

The init for AVspeechSynthesizerIPA ensures the pronunciations are accurate even on devices with incompatible primary languages. If the user's first preferred language is incompatible, their preferred languages in UserDefaults will temporarily be changed to the desired language, speak() is run on an empty string, and the languages are changed back again.

oevoice's People

Contributors

ryanlintott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sheajules

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.