Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

语音voice出问题error #509

Open
MewoTrix opened this issue Oct 18, 2024 · 12 comments
Open

语音voice出问题error #509

MewoTrix opened this issue Oct 18, 2024 · 12 comments

Comments

@MewoTrix
Copy link

2024-10-19 05:04:54.170 | INFO | app.services.voice:azure_tts_v1:1057 - start, voice name: zh-CN-shaanxi-XiaoniNeural, try: 1

2024-10-19 05:04:55.217 | ERROR | app.services.voice:azure_tts_v1:1080 - failed, error: 403, message='Invalid response status', url=URL('wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4&ConnectionId=f72db19c54a740b5964bd008ac84f41a')

2024-10-19 05:04:55.218 | INFO | app.services.voice:azure_tts_v1:1057 - start, voice name: zh-CN-shaanxi-XiaoniNeural, try: 2

2024-10-19 05:04:56.168 | ERROR | app.services.voice:azure_tts_v1:1080 - failed, error: 403, message='Invalid response status', url=URL('wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4&ConnectionId=12337f903da44184a919235f1d24a518')

2024-10-19 05:04:56.169 | INFO | app.services.voice:azure_tts_v1:1057 - start, voice name: zh-CN-shaanxi-XiaoniNeural, try: 3

2024-10-19 05:04:57.148 | ERROR | app.services.voice:azure_tts_v1:1080 - failed, error: 403, message='Invalid response status', url=URL('wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4&ConnectionId=22ffe06c3fa1464dbcd1f7d2a98c3c2a')

2024-10-19 05:04:57.149 | ERROR | app.services.task:generate_audio:85 - failed to generate audio:

  1. check if the language of the voice matches the language of the video script.
  2. check if the network is available. If you are in China, it is recommended to use a VPN and enable the global traffic mode.
@xushijie
Copy link

我遇到了同样的问题, 是这个方法里面的'communicate.stream()' 这个方法抛出来:

  def azure_tts_v1(text: str, voice_name: str, voice_file: str) -> [SubMaker, None]:
      voice_name = parse_voice_name(voice_name)
      text = text.strip()
      for i in range(3):
          try:
              logger.info(f"start, voice name: {voice_name}, try: {i + 1}")
  
              async def _do() -> SubMaker:
                  communicate = edge_tts.Communicate(text, voice_name)
                  sub_maker = edge_tts.SubMaker()
                  with open(voice_file, "wb") as file:
                      async for chunk in communicate.stream():
                          if chunk["type"] == "audio":
                              file.write(chunk["data"])
                          elif chunk["type"] == "WordBoundary":
                              sub_maker.create_sub((chunk["offset"], chunk["duration"]), chunk["text"])
                  return sub_maker
  
              sub_maker = asyncio.run(_do())
              if not sub_maker or not sub_maker.subs:
                  logger.warning(f"failed, sub_maker is None or sub_maker.subs is None")
                  continue
  
              logger.info(f"completed, output file: {voice_file}")
              return sub_maker
          except Exception as e:
              logger.error(f"failed, error: {str(e)}")
      return None

之前是能工作的,然后这两天就不行了。 怀疑是:TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4 但是不知道这个是怎么来的。

@xushijie
Copy link

please upgrade edge_tts to 6.1.13.

@9ihbd2DZSMjtsf7vecXjz
Copy link

9ihbd2DZSMjtsf7vecXjz commented Oct 19, 2024

please upgrade edge_tts to 6.1.13.

请教要用什么方法升级,pip install edge-tts 这种方法升级完,还是合成语音403, 求指点

2024-10-20 00:41:00.203 | DEBUG | app.services.task:generate_terms:52 - video terms: [
"stargazing",
"starry night",
"stars and moon",
"night sky",
"astronomy"
]

2024-10-20 00:41:00.295 | INFO | app.services.task:generate_audio:75 -

generating audio

2024-10-20 00:41:00.299 | INFO | app.services.voice:azure_tts_v1:1057 - start, voice name: zh-CN-XiaoxiaoNeural, try: 1

2024-10-20 00:41:01.732 | ERROR | app.services.voice:azure_tts_v1:1080 - failed, error: 403, message='Invalid response status', url=URL('wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4&ConnectionId=0d725972364d4128a03afdb8a6332bb5')

2024-10-20 00:41:01.740 | INFO | app.services.voice:azure_tts_v1:1057 - start, voice name: zh-CN-XiaoxiaoNeural, try: 2

2024-10-20 00:41:03.368 | ERROR | app.services.voice:azure_tts_v1:1080 - failed, error: 403, message='Invalid response status', url=URL('wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4&ConnectionId=9ab51e6a30b64dcea81dbfce3ba233f1')

2024-10-20 00:41:03.377 | INFO | app.services.voice:azure_tts_v1:1057 - start, voice name: zh-CN-XiaoxiaoNeural, try: 3

2024-10-20 00:41:04.804 | ERROR | app.services.voice:azure_tts_v1:1080 - failed, error: 403, message='Invalid response status', url=URL('wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4&ConnectionId=e79414d188c1457d84459b2eab4194c2')

2024-10-20 00:41:04.813 | ERROR | app.services.task:generate_audio:85 - failed to generate audio:

  1. check if the language of the voice matches the language of the video script.
  2. check if the network is available. If you are in China, it is recommended to use a VPN and enable the global traffic mode.

@MewoTrix
Copy link
Author

please upgrade edge_tts to 6.1.13.

感谢提供思路,将edge_tts换到最新版之后软件开始工作了,但不知道为什么不自动调用本地全局设置的site-packages文件夹,而是用它自己软件目录下的,这就导致需要把更新好的库般进去软件目录下的site-packages文件夹XD

@9ihbd2DZSMjtsf7vecXjz
Copy link

please upgrade edge_tts to 6.1.13.

感谢提供思路,将edge_tts换到最新版之后软件开始工作了,但不知道为什么不自动调用本地全局设置的site-packages文件夹,而是用它自己软件目录下的,这就导致需要把更新好的库般进去软件目录下的site-packages文件夹XD

请问通过什么方法升级?

@MewoTrix
Copy link
Author

please upgrade edge_tts to 6.1.13.

感谢提供思路,将edge_tts换到最新版之后软件开始工作了,但不知道为什么不自动调用本地全局设置的site-packages文件夹,而是用它自己软件目录下的,这就导致需要把更新好的库般进去软件目录下的site-packages文件夹XD

请问通过什么方法升级?

pip指令

@DevinBlake
Copy link

升级完还是不行,依然是403

@02qbx
Copy link

02qbx commented Oct 28, 2024

这几天又不行了

@9ihbd2DZSMjtsf7vecXjz
Copy link

找到问题了, 你必须使用自己开通的azure的配音key才可以用,

@yxh1065494705yxh
Copy link

找到问题了, 你必须使用自己开通的azure的配音key才可以用,

那我们岂不是要开通会员了?

@493226363
Copy link

找到问题了, 你必须使用自己开通的azure的配音key才可以用,

请问这个再哪里开通?在哪里替换自己的配音key

@zyz913614263
Copy link

找到问题了, 你必须使用自己开通的azure的配音key才可以用,

请问这个再哪里开通?在哪里替换自己的配音key

[azure]
speech_key = ""
speech_region = ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants