From 71764e9068826f6fa988da24afea0fa67c964b3d Mon Sep 17 00:00:00 2001 From: kxxt Date: Thu, 29 Jun 2023 08:39:06 +0800 Subject: [PATCH] release: v6.0.0 Close #78 Close #71 Close #66 --- CHANGELOG.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 19 ++++++++++++++--- 4 files changed, 76 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b83de3..978fc8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,63 @@ # aspeak Changelog +# v6.0.0 + +aspeak v6.0 is finally released๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰! This is a major release with some breaking changes. Please read the following carefully. + +## Generic + +- GitHub branches: The main branch has been deleted. The default branch is now `v5` and it will change to `v6` when v6 is released. +- Upgrade dependencies (Solves security alert #77) +- Internal refactor + +## For CLI users + +- Now the CLI uses the REST API instead of the WebSocket API by default. + - You can use the `--mode websocket` flag to use the WebSocket API. + - You can also set the `mode` field to `websocket` in the auth section in your profile to use the WebSocket API by default. +- When the TTS API returns empty audio, aspeak no longer reports an cryptic "Unrecognized format" error. + - It will now report a warning in this case: "Got empty audio buffer, nothing to play" +- Now the voice listing command no longer fails with this API endpoint: https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list +- Performance improvement: eliminate unnecessary memory copy + +## For Rust crate users + +There are a lots of breaking changes: + +- Some fields of the `Voice` struct is now optional. +- We now uses an [modular approach for error handling](https://sabrinajewson.org/blog/errors) instead of using a big enum for all errors. (#66) +- Now there are two synthesizers: `RestSynthesizer` for the REST API and `WebSocketSynthesizer` for the WebSocket API. (#71) + - The REST synthesizer has two extra methods that returns the underlying `Bytes` object instead of `Vec`. +- There is a `UnifiedSynthesizer` trait that provides a unified interface for both synthesizers. +- Some methods are renamed. For example, `Synthesizer::connect` is now `Synthesizer::connect_websocket`. +- Four new feature flags of this crate: + - `rest-synthesizer`: Enable the `RestSynthesizer` struct. + - `websocket-synthesizer`: Enable the `WebSocketSynthesizer` struct. + - `unified-synthesizer`: Enable the `UnifiedSynthesizer` trait. + - `synthesizers`: Enable all synthesizers. + - `synthesizers` feature are enabled by default. + - Disabling `websocket-synthesizer` feature will save you a bunch of dependencies. (`aspeak.rlib` is ~0.8MB smaller in release mode) +- Improved doc comments. +- Support TLS feature flags: By default, this crate uses `native-tls`. To use other TLS implementations, you can use the following feature flags: + - `native-tls-vendored`: Use the vendored version of `native-tls`. + - `rustls-tls-native-roots` + - `rustls-tls-webpki-roots` +- Add 4 examples for quick reference: + - [Simple usage of RestSynthesizer](https://github.com/kxxt/aspeak/blob/v6/examples/03-rest-synthesizer-simple.rs) + - [Simple usage of WebsocketSynthesizer](https://github.com/kxxt/aspeak/blob/v6/examples/04-websocket-synthesizer-simple.rs) + - [Synthesize all txt files in a given directory](https://github.com/kxxt/aspeak/blob/v6/examples/01-synthesize-txt-files.rs) + - [Read-Synthesize-Speak-Loop: Read text from stdin line by line and speak it](https://github.com/kxxt/aspeak/blob/v6/examples/02-rssl.rs) + +## For Python binding users + +- The `SpeechService` now automatically connect when it is constructed and it is using the websocket API. The `connect` method is removed. +- It now uses the REST API by default. +- New keyword argument for the constructor of `SpeechService`: + - mode: `rest` or `websocket`. Default is `rest`. +- Improved error messages of the python binding +- Enable abi3 wheels so that we do not need to build for every python version. +- Now type hints are provided. You will get better completion in your IDE. (#78) + # v6.0.0-rc.1 Changes after v6.0.0-beta.3: diff --git a/Cargo.lock b/Cargo.lock index 67fb871..0a9cf39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -126,7 +126,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "aspeak" -version = "6.0.0-rc.1" +version = "6.0.0" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index e641b74..60236ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aspeak" -version = "6.0.0-rc.1" +version = "6.0.0" edition = "2021" authors = ["kxxt "] description = "A simple text-to-speech client for Azure TTS API." diff --git a/README.md b/README.md index c428458..3443e05 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![GitHub stars](https://img.shields.io/github/stars/kxxt/aspeak)](https://github.com/kxxt/aspeak/stargazers) [![GitHub issues](https://img.shields.io/github/issues/kxxt/aspeak)](https://github.com/kxxt/aspeak/issues) [![GitHub forks](https://img.shields.io/github/forks/kxxt/aspeak)](https://github.com/kxxt/aspeak/network) -[![GitHub license](https://img.shields.io/github/license/kxxt/aspeak)](https://github.com/kxxt/aspeak/blob/main/LICENSE) +[![GitHub license](https://img.shields.io/github/license/kxxt/aspeak)](https://github.com/kxxt/aspeak/blob/v6/LICENSE) @@ -16,6 +16,9 @@ A simple text-to-speech client for Azure TTS API. :laughing: ## Note +Starting from version 6.0.0, `aspeak` by default uses the RESTful API of Azure TTS. If you want to use the WebSocket API, +you can specify `--mode websocket` when invoking `aspeak` or set `mode = "websocket"` in the `auth` section of your profile. + Starting from version 4.0.0, `aspeak` is rewritten in rust. The old python version is available at the `python` branch. You can sign up for an Azure account and then @@ -43,7 +46,7 @@ From v4.1.0, You can install `aspeak-bin` from AUR. Installing from PyPI will also install the python binding of `aspeak` for you. Check [Library Usage#Python](#Python) for more information on using the python binding. ```bash -pip install -U aspeak==5.2.0 +pip install -U aspeak==6.0.0 ``` Now the prebuilt wheels are only available for x86_64 architecture. @@ -98,7 +101,7 @@ an official endpoint designated by a region, run the following command: ```sh -$ aspeak --region --key text "Hello World" +$ aspeak --region --key text "Hello World" ``` If you are using a custom endpoint, you can use the `--endpoint` option instead of `--region`. @@ -176,6 +179,9 @@ verbosity = 0 # Alternatively, you can specify the region if you are using official endpoints # region = "eastus" +# Synthesizer Mode, "rest" or "websocket" +# mode = "rest" + # Azure Subscription Key # key = "YOUR_KEY" @@ -565,3 +571,10 @@ $ cargo add aspeak ``` Then follow the [documentation](https://docs.rs/aspeak) of `aspeak` crate. + +There are 4 examples for quick reference: + +- [Simple usage of RestSynthesizer](https://github.com/kxxt/aspeak/blob/v6/examples/03-rest-synthesizer-simple.rs) +- [Simple usage of WebsocketSynthesizer](https://github.com/kxxt/aspeak/blob/v6/examples/04-websocket-synthesizer-simple.rs) +- [Synthesize all txt files in a given directory](https://github.com/kxxt/aspeak/blob/v6/examples/01-synthesize-txt-files.rs) +- [Read-Synthesize-Speak-Loop: Read text from stdin line by line and speak it](https://github.com/kxxt/aspeak/blob/v6/examples/02-rssl.rs)