Remove pitch option as it no longer has any effect

* Most likely Microsoft started ignoring it along with the custom SSML
  purge
This commit is contained in:
rany2
2023-01-05 03:12:48 +02:00
parent 01c87b7e1c
commit 4862ec8517
3 changed files with 9 additions and 19 deletions

View File

@@ -63,17 +63,18 @@ You must first check the available voices with the `--list-voices` option:
Support for custom SSML has been removed since 5.0.0 because Microsoft has taken the initiative to prevent it from working. You cannot use custom SSML anymore.
### Changing pitch, rate, volume, etc.
### Changing rate, volume, etc.
It is possible to make minor changes to the generated speech.
$ edge-tts --pitch=-10Hz --text "Hello, world!" --write-media hello_with_pitch_down.mp3
$ edge-tts --rate=-50% --text "Hello, world!" --write-media hello_with_rate_halved.mp3
$ edge-tts --volume=-50% --text "Hello, world!" --write-media hello_with_volume_halved.mp3
Keep in mind that the `--pitch`, `--rate`, `--volume`, etc. options are applied to the entire SSML document.
Keep in mind that the `--rate`, `--volume`, etc. options are applied to the entire SSML document.
In addition, it is required to use `--pitch=-10Hz` instead of `--pitch -10Hz` otherwise the `-10Hz` would be interpreted as just another argument.
In addition, it is required to use `--rate=-50%` instead of `--pitch -50%` otherwise the `-50%` would be interpreted as just another argument.
**NOTE**: `--pitch` was removed in 6.0.3 as it no longer appears to have any effect.
### Note on the `edge-playback` command

View File

@@ -133,7 +133,7 @@ def split_text_by_byte_length(text: Union[str, bytes], byte_length: int) -> List
def mkssml(
text: Union[str, bytes], voice: str, pitch: str, rate: str, volume: str
text: Union[str, bytes], voice: str, rate: str, volume: str
) -> str:
"""
Creates a SSML string from the given parameters.
@@ -146,7 +146,7 @@ def mkssml(
ssml = (
"<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'>"
f"<voice name='{voice}'><prosody pitch='{pitch}' rate='{rate}' volume='{volume}'>"
f"<voice name='{voice}'><prosody pitch='+0Hz' rate='{rate}' volume='{volume}'>"
f"{text}</prosody></voice></speak>"
)
return ssml
@@ -197,7 +197,6 @@ class Communicate:
text: str,
voice: str = "Microsoft Server Speech Text to Speech Voice (en-US, AriaNeural)",
*,
pitch: str = "+0Hz",
rate: str = "+0%",
volume: str = "+0%",
proxy: Optional[str] = None,
@@ -231,10 +230,6 @@ class Communicate:
):
raise ValueError(f"Invalid voice '{voice}'.")
if re.match(r"^[+-]?\d+Hz$", pitch) is None:
raise ValueError(f"Invalid pitch '{pitch}'.")
self.pitch: str = pitch
if re.match(r"^[+-]?\d+%$", rate) is None:
raise ValueError(f"Invalid rate '{rate}'.")
self.rate: str = rate
@@ -254,7 +249,7 @@ class Communicate:
ssml_headers_plus_data(
connect_id(),
date_to_string(),
mkssml("", self.voice, self.pitch, self.rate, self.volume),
mkssml("", self.voice, self.rate, self.volume),
)
)
+ 50 # margin of error
@@ -321,7 +316,7 @@ class Communicate:
connect_id(),
date,
mkssml(
text, self.voice, self.pitch, self.rate, self.volume
text, self.voice, self.rate, self.volume
),
)
)

View File

@@ -83,12 +83,6 @@ async def _async_main() -> None:
help="lists available voices",
action="store_true",
)
parser.add_argument(
"-p",
"--pitch",
help="set TTS pitch. Default +0Hz, For more info check https://bit.ly/3eAE5Nx",
default="+0Hz",
)
parser.add_argument(
"-r",
"--rate",