正在显示
10 个修改的文件
包含
106 行增加
和
6 行删除
| @@ -79,9 +79,23 @@ with the following APIs | @@ -79,9 +79,23 @@ with the following APIs | ||
| 79 | 79 | ||
| 80 | ### Links for pre-built Flutter APPs | 80 | ### Links for pre-built Flutter APPs |
| 81 | 81 | ||
| 82 | -| Description | URL | 中国用户 | | ||
| 83 | -|--------------------------------|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------| | ||
| 84 | -| Streaming speech recognition | [Address](https://k2-fsa.github.io/sherpa/onnx/flutter/asr/app.html) | [点此](https://k2-fsa.github.io/sherpa/onnx/flutter/asr/app-cn.html) | | 82 | +#### Real-time speech recognition |
| 83 | + | ||
| 84 | +| Description | URL | 中国用户 | | ||
| 85 | +|--------------------------------|---------------------------------------------------------------------|---------------------------------------------------------------------| | ||
| 86 | +| Streaming speech recognition | [Address](https://k2-fsa.github.io/sherpa/onnx/flutter/asr/app.html)| [点此](https://k2-fsa.github.io/sherpa/onnx/flutter/asr/app-cn.html)| | ||
| 87 | + | ||
| 88 | +#### Text-to-speech | ||
| 89 | + | ||
| 90 | +| Description | URL | 中国用户 | | ||
| 91 | +|--------------------------------|--------------------------------------------------------------|-----------------------------------------------------------------------------| | ||
| 92 | +| Android (arm64-v8a, armeabi-v7a, x86_64) | [Address](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-android.html) | [点此](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-android-cn.html)| | ||
| 93 | +| Linux (x64) | [Address](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-linux.html) | [点此](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-linux-cn.html) | | ||
| 94 | +| macOS (x64) | [Address](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-macos-x64.html) | [点此](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-macos-x64-cn.html) | | ||
| 95 | +| macOS (arm64) | [Address](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-macos-arm64.html) | [点此](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-macos-arm64-cn.html)| | ||
| 96 | +| Windows (x64) | [Address](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-win.html) | [点此](https://k2-fsa.github.io/sherpa/onnx/flutter/tts-win-cn.html) | | ||
| 97 | + | ||
| 98 | +> Note: You need to build from source for iOS. | ||
| 85 | 99 | ||
| 86 | ### Links for pre-trained models | 100 | ### Links for pre-trained models |
| 87 | 101 |
| @@ -10,6 +10,12 @@ It works on the following platforms: | @@ -10,6 +10,12 @@ It works on the following platforms: | ||
| 10 | - macOS (both arm64 and x86_64 are supported) | 10 | - macOS (both arm64 and x86_64 are supported) |
| 11 | - Windows | 11 | - Windows |
| 12 | 12 | ||
| 13 | +Screenshots are given below: | ||
| 14 | + | ||
| 15 | +|Android|iOS|Linux|macOS|Windows| | ||
| 16 | +|-------|---|-----|-----|-------| | ||
| 17 | +|||||| | ||
| 18 | + | ||
| 13 | ## How to build | 19 | ## How to build |
| 14 | 20 | ||
| 15 | Before you run `flutter build`, you have to select a TTS model and change | 21 | Before you run `flutter build`, you have to select a TTS model and change |
| @@ -108,8 +114,75 @@ flutter build apk --split-per-abi | @@ -108,8 +114,75 @@ flutter build apk --split-per-abi | ||
| 108 | 114 | ||
| 109 | - 5. For iOS | 115 | - 5. For iOS |
| 110 | 116 | ||
| 117 | +First, connect your iPhone to your computer and use `flutter devices` to show | ||
| 118 | +available devices. You will see something like below: | ||
| 119 | + | ||
| 120 | +``` | ||
| 121 | +Found 3 connected devices: | ||
| 122 | + iPhone (mobile) • 00008030-001064212E85802E • ios • iOS 16.3 20D47 | ||
| 123 | + macOS (desktop) • macos • darwin-x64 • macOS 13.1 22C65 darwin-x64 | ||
| 124 | + Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.127 | ||
| 125 | + | ||
| 126 | +No wireless devices were found. | ||
| 127 | + | ||
| 128 | +Run "flutter emulators" to list and start any available device emulators. | ||
| 129 | + | ||
| 130 | +If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips. | ||
| 131 | +``` | ||
| 132 | + | ||
| 133 | +Then you can use | ||
| 134 | +``` | ||
| 135 | +flutter run -d 00008030-001064212E85802E --release | ||
| 136 | +``` | ||
| 137 | + | ||
| 138 | +You would see something like below: | ||
| 139 | +``` | ||
| 140 | +Launching lib/main.dart on iPhone in release mode... | ||
| 141 | +Automatically signing iOS for device deployment using specified development team in Xcode project: N5ZH3Z63A6 | ||
| 142 | +Running pod install... 1,773ms | ||
| 143 | +Running Xcode build... | ||
| 144 | +Xcode build done. 7.9s | ||
| 145 | +Failed to build iOS app | ||
| 146 | +Could not build the precompiled application for the device. | ||
| 147 | +Error (Xcode): No profiles for 'com.k2fsa.sherpa.onnx.tts' were found: Xcode couldn't find any iOS App Development provisioning profiles matching | ||
| 148 | +'com.k2fsa.sherpa.onnx.tts'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass | ||
| 149 | +-allowProvisioningUpdates to xcodebuild. | ||
| 150 | +/Users/fangjun/open-source/sherpa-onnx/flutter-examples/tts/ios/Runner.xcodeproj | ||
| 151 | + | ||
| 152 | + | ||
| 153 | + | ||
| 154 | +It appears that there was a problem signing your application prior to installation on the device. | ||
| 155 | + | ||
| 156 | +Verify that the Bundle Identifier in your project is your signing id in Xcode | ||
| 157 | + open ios/Runner.xcworkspace | ||
| 158 | + | ||
| 159 | +Also try selecting 'Product > Build' to fix the problem. | ||
| 160 | + | ||
| 161 | +Error running application on iPhone. | ||
| 162 | +``` | ||
| 163 | + | ||
| 164 | +After you have followed the instructions in the above log, run gain | ||
| 165 | + | ||
| 166 | +> Note: I have run `open ios/Runner.xcworkspace` and click `Product -> Build`. | ||
| 167 | + | ||
| 168 | +``` | ||
| 169 | +flutter run -d 00008030-001064212E85802E --release | ||
| 170 | +``` | ||
| 171 | + | ||
| 172 | +Finally, it will show something like below: | ||
| 173 | + | ||
| 111 | ``` | 174 | ``` |
| 112 | -flutter build ios | 175 | +Launching lib/main.dart on iPhone in release mode... |
| 176 | +Automatically signing iOS for device deployment using specified development team in Xcode project: N5ZH3Z63A6 | ||
| 177 | +Running Xcode build... | ||
| 178 | + └─Compiling, linking and signing... 6.5s | ||
| 179 | +Xcode build done. 18.3s | ||
| 180 | +Installing and launching... 22.9s | ||
| 181 | + | ||
| 182 | +Flutter run key commands. | ||
| 183 | +h List all available interactive commands. | ||
| 184 | +c Clear the screen | ||
| 185 | +q Quit (terminate the application on the device). | ||
| 113 | ``` | 186 | ``` |
| 114 | 187 | ||
| 115 | ## Fix for Linux | 188 | ## Fix for Linux |
flutter-examples/tts/android.jpg
0 → 100644
175.0 KB
flutter-examples/tts/ios.jpg
0 → 100644
189.2 KB
| @@ -373,6 +373,7 @@ | @@ -373,6 +373,7 @@ | ||
| 373 | PRODUCT_NAME = "$(TARGET_NAME)"; | 373 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 374 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | 374 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| 375 | SWIFT_VERSION = 5.0; | 375 | SWIFT_VERSION = 5.0; |
| 376 | + OTHER_LDFLAGS = "-lc++"; | ||
| 376 | VERSIONING_SYSTEM = "apple-generic"; | 377 | VERSIONING_SYSTEM = "apple-generic"; |
| 377 | }; | 378 | }; |
| 378 | name = Profile; | 379 | name = Profile; |
| @@ -390,6 +391,7 @@ | @@ -390,6 +391,7 @@ | ||
| 390 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; | 391 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; |
| 391 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | 392 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; |
| 392 | SWIFT_VERSION = 5.0; | 393 | SWIFT_VERSION = 5.0; |
| 394 | + OTHER_LDFLAGS = "-lc++"; | ||
| 393 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; | 395 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; |
| 394 | }; | 396 | }; |
| 395 | name = Debug; | 397 | name = Debug; |
| @@ -405,6 +407,7 @@ | @@ -405,6 +407,7 @@ | ||
| 405 | PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; | 407 | PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; |
| 406 | PRODUCT_NAME = "$(TARGET_NAME)"; | 408 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 407 | SWIFT_VERSION = 5.0; | 409 | SWIFT_VERSION = 5.0; |
| 410 | + OTHER_LDFLAGS = "-lc++"; | ||
| 408 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; | 411 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; |
| 409 | }; | 412 | }; |
| 410 | name = Release; | 413 | name = Release; |
| @@ -420,6 +423,7 @@ | @@ -420,6 +423,7 @@ | ||
| 420 | PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; | 423 | PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; |
| 421 | PRODUCT_NAME = "$(TARGET_NAME)"; | 424 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 422 | SWIFT_VERSION = 5.0; | 425 | SWIFT_VERSION = 5.0; |
| 426 | + OTHER_LDFLAGS = "-lc++"; | ||
| 423 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; | 427 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; |
| 424 | }; | 428 | }; |
| 425 | name = Profile; | 429 | name = Profile; |
| @@ -554,6 +558,7 @@ | @@ -554,6 +558,7 @@ | ||
| 554 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | 558 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| 555 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | 559 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; |
| 556 | SWIFT_VERSION = 5.0; | 560 | SWIFT_VERSION = 5.0; |
| 561 | + OTHER_LDFLAGS = "-lc++"; | ||
| 557 | VERSIONING_SYSTEM = "apple-generic"; | 562 | VERSIONING_SYSTEM = "apple-generic"; |
| 558 | }; | 563 | }; |
| 559 | name = Debug; | 564 | name = Debug; |
| @@ -576,6 +581,7 @@ | @@ -576,6 +581,7 @@ | ||
| 576 | PRODUCT_NAME = "$(TARGET_NAME)"; | 581 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 577 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | 582 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| 578 | SWIFT_VERSION = 5.0; | 583 | SWIFT_VERSION = 5.0; |
| 584 | + OTHER_LDFLAGS = "-lc++"; | ||
| 579 | VERSIONING_SYSTEM = "apple-generic"; | 585 | VERSIONING_SYSTEM = "apple-generic"; |
| 580 | }; | 586 | }; |
| 581 | name = Release; | 587 | name = Release; |
| @@ -91,7 +91,7 @@ Future<sherpa_onnx.OfflineTts> createOfflineTts() async { | @@ -91,7 +91,7 @@ Future<sherpa_onnx.OfflineTts> createOfflineTts() async { | ||
| 91 | final all = ruleFsts.split(','); | 91 | final all = ruleFsts.split(','); |
| 92 | var tmp = <String>[]; | 92 | var tmp = <String>[]; |
| 93 | for (final f in all) { | 93 | for (final f in all) { |
| 94 | - tmp.add(p.join(directory.path, modelDir, f)); | 94 | + tmp.add(p.join(directory.path, f)); |
| 95 | } | 95 | } |
| 96 | ruleFsts = tmp.join(','); | 96 | ruleFsts = tmp.join(','); |
| 97 | } | 97 | } |
| @@ -106,7 +106,7 @@ Future<sherpa_onnx.OfflineTts> createOfflineTts() async { | @@ -106,7 +106,7 @@ Future<sherpa_onnx.OfflineTts> createOfflineTts() async { | ||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | if (lexicon != '') { | 108 | if (lexicon != '') { |
| 109 | - lexicon = p.join(directory.path, lexicon); | 109 | + lexicon = p.join(directory.path, modelDir, lexicon); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | if (dataDir != '') { | 112 | if (dataDir != '') { |
| @@ -37,6 +37,7 @@ class _TtsScreenState extends State<TtsScreen> { | @@ -37,6 +37,7 @@ class _TtsScreenState extends State<TtsScreen> { | ||
| 37 | _controller_text_input = TextEditingController(); | 37 | _controller_text_input = TextEditingController(); |
| 38 | _controller_hint = TextEditingController(); | 38 | _controller_hint = TextEditingController(); |
| 39 | _controller_sid = TextEditingController(text: '0'); | 39 | _controller_sid = TextEditingController(text: '0'); |
| 40 | + | ||
| 40 | super.initState(); | 41 | super.initState(); |
| 41 | } | 42 | } |
| 42 | 43 | ||
| @@ -73,6 +74,9 @@ class _TtsScreenState extends State<TtsScreen> { | @@ -73,6 +74,9 @@ class _TtsScreenState extends State<TtsScreen> { | ||
| 73 | keyboardType: TextInputType.number, | 74 | keyboardType: TextInputType.number, |
| 74 | maxLines: 1, | 75 | maxLines: 1, |
| 75 | controller: _controller_sid, | 76 | controller: _controller_sid, |
| 77 | + onTapOutside: (PointerDownEvent event) { | ||
| 78 | + FocusManager.instance.primaryFocus?.unfocus(); | ||
| 79 | + }, | ||
| 76 | inputFormatters: <TextInputFormatter>[ | 80 | inputFormatters: <TextInputFormatter>[ |
| 77 | FilteringTextInputFormatter.digitsOnly | 81 | FilteringTextInputFormatter.digitsOnly |
| 78 | ]), | 82 | ]), |
| @@ -99,6 +103,9 @@ class _TtsScreenState extends State<TtsScreen> { | @@ -99,6 +103,9 @@ class _TtsScreenState extends State<TtsScreen> { | ||
| 99 | ), | 103 | ), |
| 100 | maxLines: 5, | 104 | maxLines: 5, |
| 101 | controller: _controller_text_input, | 105 | controller: _controller_text_input, |
| 106 | + onTapOutside: (PointerDownEvent event) { | ||
| 107 | + FocusManager.instance.primaryFocus?.unfocus(); | ||
| 108 | + }, | ||
| 102 | ), | 109 | ), |
| 103 | const SizedBox(height: 5), | 110 | const SizedBox(height: 5), |
| 104 | Row( | 111 | Row( |
flutter-examples/tts/macos.jpg
0 → 100644
159.9 KB
flutter-examples/tts/ubuntu.jpg
0 → 100644
147.1 KB
flutter-examples/tts/windows.jpg
0 → 100644
226.0 KB
-
请 注册 或 登录 后发表评论