The settings that Rohit describes worked for me on the iOS 16 simulator. Apparently the iOS 16 simulators are not loaded with any voices by default. The exact sequence was as follows on the simulated device itself:
Settings/Accessibility/Spoken Content Must turn on Speak Selection. That will list Voices. Touch that. Select your language. Pick a voice. Click the download button. Wait. When done, you can back out and turn off Speak Selection on the way if you want. Turning it on is necessary to be able to select and download a voice.
(機械翻訳)Rohitが説明する設定は、iOS 16のシミュレータで私には機能しました。どうやらiOS 16のシミュレータはデフォルトでボイスがロードされていないようです。正確には、シミュレータ本体で以下のような手順でした。
Settings/Accessibility/Spoken Content Speak Selectionをオンにする必要があります。そうするとVoicesがリストアップされる。それをタッチします。言語を選択します。音声を選びます。ダウンロードボタンをクリックします。待つ。終了したら、途中でバックアウトしてSpeak Selectionをオフにしてもかまいません。オンにすると、音声の選択とダウンロードができるようになります。 https://stackoverflow.com/questions/73706115/avspeechsynthesizer-isnt-working-under-ios16-anymore
実は、手元の環境で試してみたところ、ボイスをロードしなくても喋ってくれました。
その際にログが出力されていたのですが、次のような感じでした。
*OKの場合もNGの場合もあまり違いはありませんでした
*NGの場合でも「Could not find voice for identifier: (null)」のような出力はありませんでした
OKの場合
2022-10-31 18:50:52.191816+0900 AVSpeechProduct[93332:970493] [asset] Failed to get sandbox extensions
2022-10-31 18:50:52.241814+0900 AVSpeechProduct[93332:970493] [catalog] Unable to list voice folder
2022-10-31 18:50:52.241833+0900 AVSpeechProduct[93332:970492] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
2022-10-31 18:50:52.252044+0900 AVSpeechProduct[93332:970492] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
2022-10-31 18:50:52.259001+0900 AVSpeechProduct[93332:970493] [catalog] Unable to list voice folder
2022-10-31 18:50:52.261602+0900 AVSpeechProduct[93332:970493] [catalog] Unable to list voice folder
2022-10-31 18:50:52.271545+0900 AVSpeechProduct[93332:970493] [catalog] Unable to list voice folder
2022-10-31 18:50:52.295957+0900 AVSpeechProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=\Man On the Moon III\b, message=unrecognized character follows \, characterPosition=1
2022-10-31 18:50:52.307970+0900 AVSpeechProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 11016 (Ruleset parse failed: Ignoring unknown option): option=/
2022-10-31 18:50:52.310365+0900 AVSpeechProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=, contentType=application/x-vocalizer-rettt+text, lhError=88602000
2022-10-31 18:50:52.350038+0900 AVSpeechProduct[93332:970493] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600000c341a0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
”次の行をクラス直下”とは、今回の関数「func Remaining_time_announcement(comment:String)」の外側に「let synthesizer = AVSpeechSynthesizer()」を記述することで良いでしょうか。
実施してみましたが発話しませんでした。
ちなみにリンク先のログと同じような内容のログを出力しておりますが、3行目の『識別子の音声が見つかりません。:(null)』が気になります。
utterance.voice = AVSpeechSynthesisVoice(language: "ja-JP")が効いていないのでしょうか。
[asset] Failed to get sandbox extensions
[catalog] Unable to list voice folder
[AXTTSCommon] Could not find voice for identifier: (null)
[AXTTSCommon] File did not exist at content path: (null) (null). Attempting to fallback to default voice for language: (null)
[AXTTSCommon] Error: Unable to speak. No speech service: voice: (null) identifier: (null), language: (null), resource: (null)
よろしくお願いします。
当方の環境は、以下の通りです。
macOS Monterey 12.6.1
Xcode 14.0.1
教えていただいたシュミレータのDevide - Erase All Content and Settings...では解消出来ませんでした。
また、上記の環境での新規プロジェクト作成でも解消できませんでした。
なお、新規プロジェクト実行のログで以下のようなログがありました。
objc[1012]: Class SBFCARendererImageRepresentation is implemented in both
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/SpringBoardFoundation.framework/SpringBoardFoundation (0x10ce2c028)
and
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/PaperBoardUI.framework/PaperBoardUI (0x1090cc218).
One of the two will be used. Which one is undefined.
また、試験的にもう1台の以下のような環境下で上記のプロジェクトをコピーしましたが、作成したXcodeの違いで実施できませんでした。
これが、以前のバージョンで作成したものとの事なのでしょうな。
そこで、この環境下で新規に作成してみましたが、こちらでは発話を確認できました。
macOS Big Sur 11.7.1
Xcode 13.2.1
よろしくお願いします。
退会済みユーザー
2022/11/01 06:24
コメントありがとうございます。
> 当方の環境は、以下の通りです。
環境は私と逆なのですね・・
*macOSが新しいか、Xcodeが新しいか
> 教えていただいたシュミレータのDevide - Erase All Content and Settings...では解消出来ませんでした。
> また、上記の環境での新規プロジェクト作成でも解消できませんでした。
ダメでしたか・・
Xcode 14.0.1の新規プロジェクトでも変わらないのであれば、プロジェクトの設定はあまり関係ないのかもしれませんね。
---
```
[AXTTSCommon] File did not exist at content path: (null) (null). Attempting to fallback to default voice for language: (null)
[AXTTSCommon] Error: Unable to speak. No speech service: voice: (null) identifier: (null), language: (null), resource: (null)
```
stackoverflowの質問と、今回の質問で共通するのはこのエラーだと思います。
このエラーはボイスをダウンロードすることで解消しているっぽいですので、このあたりを中心にもう少し調査をしてみると良いのかもしれませんね。
*少し前にダウンロードしたのは日本語でしょうか?そうであれば英語などの言語でも試してみるのも良いかもしれませんね
*手元の環境では同じ問題を再現できませんでしたので・・もうあまりお力になれないかもしれません・・
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/10/31 03:57
2022/10/31 09:16
2022/11/01 03:03
退会済みユーザー
2022/11/01 06:24
2022/11/01 13:39