回答編集履歴

3

typo

2022/10/31 10:17

投稿

退会済みユーザー
test CHANGED
@@ -48,34 +48,34 @@
48
48
  OKの場合
49
49
 
50
50
  ```
51
- 2022-10-31 18:50:52.191816+0900 AVSpeachProduct[93332:970493] [asset] Failed to get sandbox extensions
52
- 2022-10-31 18:50:52.241814+0900 AVSpeachProduct[93332:970493] [catalog] Unable to list voice folder
53
- 2022-10-31 18:50:52.241833+0900 AVSpeachProduct[93332:970492] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
54
- 2022-10-31 18:50:52.252044+0900 AVSpeachProduct[93332:970492] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
55
- 2022-10-31 18:50:52.259001+0900 AVSpeachProduct[93332:970493] [catalog] Unable to list voice folder
56
- 2022-10-31 18:50:52.261602+0900 AVSpeachProduct[93332:970493] [catalog] Unable to list voice folder
57
- 2022-10-31 18:50:52.271545+0900 AVSpeachProduct[93332:970493] [catalog] Unable to list voice folder
58
- 2022-10-31 18:50:52.295957+0900 AVSpeachProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=\Man On the Moon III\b, message=unrecognized character follows \, characterPosition=1
59
- 2022-10-31 18:50:52.307970+0900 AVSpeachProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 11016 (Ruleset parse failed: Ignoring unknown option): option=/
60
- 2022-10-31 18:50:52.310365+0900 AVSpeachProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=, contentType=application/x-vocalizer-rettt+text, lhError=88602000
61
- 2022-10-31 18:50:52.350038+0900 AVSpeachProduct[93332:970493] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600000c341a0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
51
+ 2022-10-31 18:50:52.191816+0900 AVSpeechProduct[93332:970493] [asset] Failed to get sandbox extensions
52
+ 2022-10-31 18:50:52.241814+0900 AVSpeechProduct[93332:970493] [catalog] Unable to list voice folder
53
+ 2022-10-31 18:50:52.241833+0900 AVSpeechProduct[93332:970492] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
54
+ 2022-10-31 18:50:52.252044+0900 AVSpeechProduct[93332:970492] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
55
+ 2022-10-31 18:50:52.259001+0900 AVSpeechProduct[93332:970493] [catalog] Unable to list voice folder
56
+ 2022-10-31 18:50:52.261602+0900 AVSpeechProduct[93332:970493] [catalog] Unable to list voice folder
57
+ 2022-10-31 18:50:52.271545+0900 AVSpeechProduct[93332:970493] [catalog] Unable to list voice folder
58
+ 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
59
+ 2022-10-31 18:50:52.307970+0900 AVSpeechProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 11016 (Ruleset parse failed: Ignoring unknown option): option=/
60
+ 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
61
+ 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
62
62
  ```
63
63
 
64
64
  NGの場合
65
65
  (`let synthesizer = AVSpeechSynthesizer()`をメソッド内に記述)
66
66
 
67
67
  ```
68
- 2022-10-31 18:52:35.346536+0900 AVSpeachProduct[93405:972878] [asset] Failed to get sandbox extensions
69
- 2022-10-31 18:52:35.387313+0900 AVSpeachProduct[93405:972878] [catalog] Unable to list voice folder
70
- 2022-10-31 18:52:35.404685+0900 AVSpeachProduct[93405:972878] [catalog] Unable to list voice folder
71
- 2022-10-31 18:52:35.407498+0900 AVSpeachProduct[93405:972878] [catalog] Unable to list voice folder
72
- 2022-10-31 18:52:35.417734+0900 AVSpeachProduct[93405:972878] [catalog] Unable to list voice folder
73
- 2022-10-31 18:52:35.418257+0900 AVSpeachProduct[93405:972882] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
74
- 2022-10-31 18:52:35.420116+0900 AVSpeachProduct[93405:972882] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
75
- 2022-10-31 18:52:35.465714+0900 AVSpeachProduct[93405:972934] [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=\Man On the Moon III\b, message=unrecognized character follows \, characterPosition=1
76
- 2022-10-31 18:52:35.478539+0900 AVSpeachProduct[93405:972934] [AXTTSCommon] MauiVocalizer: 11016 (Ruleset parse failed: Ignoring unknown option): option=/
77
- 2022-10-31 18:52:35.483518+0900 AVSpeachProduct[93405:972934] [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=, contentType=application/x-vocalizer-rettt+text, lhError=88602000
78
- 2022-10-31 18:52:35.511815+0900 AVSpeachProduct[93405:972880] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600001078500> F8BB1C28-BAE8-11D6-9C31-00039315CD46
68
+ 2022-10-31 18:52:35.346536+0900 AVSpeechProduct[93405:972878] [asset] Failed to get sandbox extensions
69
+ 2022-10-31 18:52:35.387313+0900 AVSpeechProduct[93405:972878] [catalog] Unable to list voice folder
70
+ 2022-10-31 18:52:35.404685+0900 AVSpeechProduct[93405:972878] [catalog] Unable to list voice folder
71
+ 2022-10-31 18:52:35.407498+0900 AVSpeechProduct[93405:972878] [catalog] Unable to list voice folder
72
+ 2022-10-31 18:52:35.417734+0900 AVSpeechProduct[93405:972878] [catalog] Unable to list voice folder
73
+ 2022-10-31 18:52:35.418257+0900 AVSpeechProduct[93405:972882] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
74
+ 2022-10-31 18:52:35.420116+0900 AVSpeechProduct[93405:972882] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
75
+ 2022-10-31 18:52:35.465714+0900 AVSpeechProduct[93405:972934] [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=\Man On the Moon III\b, message=unrecognized character follows \, characterPosition=1
76
+ 2022-10-31 18:52:35.478539+0900 AVSpeechProduct[93405:972934] [AXTTSCommon] MauiVocalizer: 11016 (Ruleset parse failed: Ignoring unknown option): option=/
77
+ 2022-10-31 18:52:35.483518+0900 AVSpeechProduct[93405:972934] [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=, contentType=application/x-vocalizer-rettt+text, lhError=88602000
78
+ 2022-10-31 18:52:35.511815+0900 AVSpeechProduct[93405:972880] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600001078500> F8BB1C28-BAE8-11D6-9C31-00039315CD46
79
79
  ```
80
80
 
81
81
  手元の環境は次の通りです。

2

手元の環境におけるログなどを追記しました。

2022/10/31 10:13

投稿

退会済みユーザー
test CHANGED
@@ -25,3 +25,72 @@
25
25
 
26
26
  このような修正をしても解消しないでしょうか?
27
27
 
28
+ ### 2つ目の追記です。
29
+
30
+ コメントありがとうございます。
31
+
32
+ > 今回の関数「func Remaining_time_announcement(comment:String)」の外側に「let synthesizer = AVSpeechSynthesizer()」を記述することで良いでしょうか。
33
+
34
+ メソッドが入れ子になっていないのであればそれで大丈夫だと思います。
35
+
36
+ > ちなみにリンク先のログと同じような内容のログを出力しておりますが、3行目の『識別子の音声が見つかりません。:(null)』が気になります。
37
+ > utterance.voice = AVSpeechSynthesisVoice(language: "ja-JP")が効いていないのでしょうか。
38
+
39
+ コード側の問題ではなさそうな気がしますが、このエラーは原因を表していそうですね。
40
+
41
+ ---
42
+
43
+ 実は、手元の環境で試してみたところ、ボイスをロードしなくても喋ってくれました。
44
+ その際にログが出力されていたのですが、次のような感じでした。
45
+ *OKの場合もNGの場合もあまり違いはありませんでした
46
+ *NGの場合でも「Could not find voice for identifier: (null)」のような出力はありませんでした
47
+
48
+ OKの場合
49
+
50
+ ```
51
+ 2022-10-31 18:50:52.191816+0900 AVSpeachProduct[93332:970493] [asset] Failed to get sandbox extensions
52
+ 2022-10-31 18:50:52.241814+0900 AVSpeachProduct[93332:970493] [catalog] Unable to list voice folder
53
+ 2022-10-31 18:50:52.241833+0900 AVSpeachProduct[93332:970492] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
54
+ 2022-10-31 18:50:52.252044+0900 AVSpeachProduct[93332:970492] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
55
+ 2022-10-31 18:50:52.259001+0900 AVSpeachProduct[93332:970493] [catalog] Unable to list voice folder
56
+ 2022-10-31 18:50:52.261602+0900 AVSpeachProduct[93332:970493] [catalog] Unable to list voice folder
57
+ 2022-10-31 18:50:52.271545+0900 AVSpeachProduct[93332:970493] [catalog] Unable to list voice folder
58
+ 2022-10-31 18:50:52.295957+0900 AVSpeachProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=\Man On the Moon III\b, message=unrecognized character follows \, characterPosition=1
59
+ 2022-10-31 18:50:52.307970+0900 AVSpeachProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 11016 (Ruleset parse failed: Ignoring unknown option): option=/
60
+ 2022-10-31 18:50:52.310365+0900 AVSpeachProduct[93332:970547] [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=, contentType=application/x-vocalizer-rettt+text, lhError=88602000
61
+ 2022-10-31 18:50:52.350038+0900 AVSpeachProduct[93332:970493] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600000c341a0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
62
+ ```
63
+
64
+ NGの場合
65
+ (`let synthesizer = AVSpeechSynthesizer()`をメソッド内に記述)
66
+
67
+ ```
68
+ 2022-10-31 18:52:35.346536+0900 AVSpeachProduct[93405:972878] [asset] Failed to get sandbox extensions
69
+ 2022-10-31 18:52:35.387313+0900 AVSpeachProduct[93405:972878] [catalog] Unable to list voice folder
70
+ 2022-10-31 18:52:35.404685+0900 AVSpeachProduct[93405:972878] [catalog] Unable to list voice folder
71
+ 2022-10-31 18:52:35.407498+0900 AVSpeachProduct[93405:972878] [catalog] Unable to list voice folder
72
+ 2022-10-31 18:52:35.417734+0900 AVSpeachProduct[93405:972878] [catalog] Unable to list voice folder
73
+ 2022-10-31 18:52:35.418257+0900 AVSpeachProduct[93405:972882] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
74
+ 2022-10-31 18:52:35.420116+0900 AVSpeachProduct[93405:972882] [catalog] Query for com.apple.MobileAsset.VoiceServices.VoiceResources failed: 2
75
+ 2022-10-31 18:52:35.465714+0900 AVSpeachProduct[93405:972934] [AXTTSCommon] MauiVocalizer: 11006 (Can't compile rule): regularExpression=\Man On the Moon III\b, message=unrecognized character follows \, characterPosition=1
76
+ 2022-10-31 18:52:35.478539+0900 AVSpeachProduct[93405:972934] [AXTTSCommon] MauiVocalizer: 11016 (Ruleset parse failed: Ignoring unknown option): option=/
77
+ 2022-10-31 18:52:35.483518+0900 AVSpeachProduct[93405:972934] [AXTTSCommon] MauiVocalizer: 16038 (Resource load failed): component=ttt/re, uri=, contentType=application/x-vocalizer-rettt+text, lhError=88602000
78
+ 2022-10-31 18:52:35.511815+0900 AVSpeachProduct[93405:972880] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600001078500> F8BB1C28-BAE8-11D6-9C31-00039315CD46
79
+ ```
80
+
81
+ 手元の環境は次の通りです。
82
+ * macOS Ventura 13.0
83
+ * Xcode 14.0
84
+ * SwiftUIプロジェクトで一から作成
85
+
86
+ 一度シミュレータのメニューから、
87
+ Devide - Erase All Content and Settings...
88
+ をしても解消されないでしょうか。
89
+
90
+ あとは、
91
+ 質問の内容から、以前のバージョンから作成されたプロジェクトだと思うのですが、
92
+ 新しいXcodeで新たにプロジェクトを作成して、
93
+ 質問欄のコードを一から実装してみたら何か変わるでしょうか?
94
+ (`let synthesizer = AVSpeechSynthesizer()`はメソッドの外側に)
95
+ *macOSやXcodeやシミュレータの設定の問題か、プロジェクトの設定の問題か、切り分けできるのかなと思います
96
+

1

AVSpeechSynthesizerを使用した場合について追記しました。

2022/10/31 08:20

投稿

退会済みユーザー
test CHANGED
@@ -10,3 +10,18 @@
10
10
  「Settings/Accessibility/Spoken Content Speak Selection」は日本語だと
11
11
  「設定アプリ - アクセシビリティ - 読み上げコンテンツ」でしょうか。
12
12
 
13
+ ### 追記です。
14
+
15
+ コメントありがとうございます。
16
+
17
+ > AVSpeechSynthesizerを使用した関数APでは残念ながら発話しませんでした。
18
+
19
+ リンク先の回答には
20
+ 次の行をクラス直下に移動して(メソッド内ではなく)、
21
+ クラスの定数ストアドプロパティとして扱うように、
22
+ という記載もあるようでした。
23
+
24
+ `let synthesizer = AVSpeechSynthesizer()`
25
+
26
+ このような修正をしても解消しないでしょうか?
27
+