Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2023-11-23 21:38:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-11-23 21:38:32 +0800
Commit
94ef6929bbab7391e6f35c2a935efa54abdf6574
94ef6929
1 parent
2f22e6ed
Text-to-speech for iOS (#443)
显示空白字符变更
内嵌
并排对比
正在显示
12 个修改的文件
包含
614 行增加
和
2 行删除
.gitignore
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.pbxproj
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.xcworkspace/contents.xcworkspacedata
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/Assets.xcassets/AccentColor.colorset/Contents.json
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/Assets.xcassets/AppIcon.appiconset/Contents.json
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/Assets.xcassets/Contents.json
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/ContentView.swift
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/Preview Content/Preview Assets.xcassets/Contents.json
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/SherpaOnnxTtsApp.swift
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/ViewModel.swift
swift-api-examples/SherpaOnnx.swift
.gitignore
查看文件 @
94ef692
...
...
@@ -67,6 +67,13 @@ swift-api-examples/k2fsa-*
run-*.sh
two-pass-*.sh
build-*
## User settings
xcuserdata/
## Xcode 8 and earlier
*.xcscmblueprint
*.xccheckout
vits-vctk
vits-zh-aishell3
jslint.mjs
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.pbxproj
0 → 100644
查看文件 @
94ef692
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
C917B4E52B0EEF3B005245AC /* SherpaOnnxTtsApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C917B4E42B0EEF3B005245AC /* SherpaOnnxTtsApp.swift */; };
C917B4E72B0EEF3B005245AC /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C917B4E62B0EEF3B005245AC /* ContentView.swift */; };
C917B4E92B0EEF3C005245AC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C917B4E82B0EEF3C005245AC /* Assets.xcassets */; };
C917B4EC2B0EEF3C005245AC /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C917B4EB2B0EEF3C005245AC /* Preview Assets.xcassets */; };
C9FE9FE52B0F33CD009F1003 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9FE9FE42B0F33CD009F1003 /* ViewModel.swift */; };
C9FE9FE72B0F3620009F1003 /* SherpaOnnx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9FE9FE62B0F3620009F1003 /* SherpaOnnx.swift */; };
C9FE9FEA2B0F3754009F1003 /* sherpa-onnx.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9FE9FE92B0F3754009F1003 /* sherpa-onnx.xcframework */; };
C9FE9FEF2B0F3EFB009F1003 /* onnxruntime.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9FE9FEB2B0F3785009F1003 /* onnxruntime.xcframework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
C917B4E12B0EEF3B005245AC /* SherpaOnnxTts.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SherpaOnnxTts.app; sourceTree = BUILT_PRODUCTS_DIR; };
C917B4E42B0EEF3B005245AC /* SherpaOnnxTtsApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SherpaOnnxTtsApp.swift; sourceTree = "<group>"; };
C917B4E62B0EEF3B005245AC /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
C917B4E82B0EEF3C005245AC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
C917B4EB2B0EEF3C005245AC /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
C9FE9FE42B0F33CD009F1003 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = "<group>"; };
C9FE9FE62B0F3620009F1003 /* SherpaOnnx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SherpaOnnx.swift; path = "../../../swift-api-examples/SherpaOnnx.swift"; sourceTree = "<group>"; };
C9FE9FE92B0F3754009F1003 /* sherpa-onnx.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "sherpa-onnx.xcframework"; path = "../../build-ios/sherpa-onnx.xcframework"; sourceTree = "<group>"; };
C9FE9FEB2B0F3785009F1003 /* onnxruntime.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = onnxruntime.xcframework; path = "../../build-ios/ios-onnxruntime/1.16.2/onnxruntime.xcframework"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
C917B4DE2B0EEF3B005245AC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C9FE9FEF2B0F3EFB009F1003 /* onnxruntime.xcframework in Frameworks */,
C9FE9FEA2B0F3754009F1003 /* sherpa-onnx.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
C917B4D82B0EEF3B005245AC = {
isa = PBXGroup;
children = (
C917B4E32B0EEF3B005245AC /* SherpaOnnxTts */,
C917B4E22B0EEF3B005245AC /* Products */,
C9FE9FE82B0F3754009F1003 /* Frameworks */,
);
sourceTree = "<group>";
};
C917B4E22B0EEF3B005245AC /* Products */ = {
isa = PBXGroup;
children = (
C917B4E12B0EEF3B005245AC /* SherpaOnnxTts.app */,
);
name = Products;
sourceTree = "<group>";
};
C917B4E32B0EEF3B005245AC /* SherpaOnnxTts */ = {
isa = PBXGroup;
children = (
C9FE9FE62B0F3620009F1003 /* SherpaOnnx.swift */,
C9FE9FE42B0F33CD009F1003 /* ViewModel.swift */,
C917B4E42B0EEF3B005245AC /* SherpaOnnxTtsApp.swift */,
C917B4E62B0EEF3B005245AC /* ContentView.swift */,
C917B4E82B0EEF3C005245AC /* Assets.xcassets */,
C917B4EA2B0EEF3C005245AC /* Preview Content */,
);
path = SherpaOnnxTts;
sourceTree = "<group>";
};
C917B4EA2B0EEF3C005245AC /* Preview Content */ = {
isa = PBXGroup;
children = (
C917B4EB2B0EEF3C005245AC /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
C9FE9FE82B0F3754009F1003 /* Frameworks */ = {
isa = PBXGroup;
children = (
C9FE9FEB2B0F3785009F1003 /* onnxruntime.xcframework */,
C9FE9FE92B0F3754009F1003 /* sherpa-onnx.xcframework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
C917B4E02B0EEF3B005245AC /* SherpaOnnxTts */ = {
isa = PBXNativeTarget;
buildConfigurationList = C917B4EF2B0EEF3C005245AC /* Build configuration list for PBXNativeTarget "SherpaOnnxTts" */;
buildPhases = (
C917B4DD2B0EEF3B005245AC /* Sources */,
C917B4DE2B0EEF3B005245AC /* Frameworks */,
C917B4DF2B0EEF3B005245AC /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = SherpaOnnxTts;
productName = SherpaOnnxTts;
productReference = C917B4E12B0EEF3B005245AC /* SherpaOnnxTts.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
C917B4D92B0EEF3B005245AC /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1420;
LastUpgradeCheck = 1420;
TargetAttributes = {
C917B4E02B0EEF3B005245AC = {
CreatedOnToolsVersion = 14.2;
};
};
};
buildConfigurationList = C917B4DC2B0EEF3B005245AC /* Build configuration list for PBXProject "SherpaOnnxTts" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = C917B4D82B0EEF3B005245AC;
productRefGroup = C917B4E22B0EEF3B005245AC /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
C917B4E02B0EEF3B005245AC /* SherpaOnnxTts */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
C917B4DF2B0EEF3B005245AC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C917B4EC2B0EEF3C005245AC /* Preview Assets.xcassets in Resources */,
C917B4E92B0EEF3C005245AC /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
C917B4DD2B0EEF3B005245AC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C917B4E72B0EEF3B005245AC /* ContentView.swift in Sources */,
C9FE9FE72B0F3620009F1003 /* SherpaOnnx.swift in Sources */,
C9FE9FE52B0F33CD009F1003 /* ViewModel.swift in Sources */,
C917B4E52B0EEF3B005245AC /* SherpaOnnxTtsApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
C917B4ED2B0EEF3C005245AC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
C917B4EE2B0EEF3C005245AC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
C917B4F02B0EEF3C005245AC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SherpaOnnxTts/Preview Content\"";
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios";
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios/sherpa-onnx.xcframework/Headers";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
OTHER_LDFLAGS = "-lc++";
PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxTts";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "${PROJECT_DIR}/../../swift-api-examples/SherpaOnnx-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
C917B4F12B0EEF3C005245AC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SherpaOnnxTts/Preview Content\"";
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios";
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios/sherpa-onnx.xcframework/Headers";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
OTHER_LDFLAGS = "-lc++";
PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxTts";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "${PROJECT_DIR}/../../swift-api-examples/SherpaOnnx-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C917B4DC2B0EEF3B005245AC /* Build configuration list for PBXProject "SherpaOnnxTts" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C917B4ED2B0EEF3C005245AC /* Debug */,
C917B4EE2B0EEF3C005245AC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C917B4EF2B0EEF3C005245AC /* Build configuration list for PBXNativeTarget "SherpaOnnxTts" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C917B4F02B0EEF3C005245AC /* Debug */,
C917B4F12B0EEF3C005245AC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = C917B4D92B0EEF3B005245AC /* Project object */;
}
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.xcworkspace/contents.xcworkspacedata
0 → 100644
查看文件 @
94ef692
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version =
"1.0"
>
<FileRef
location =
"self:"
>
</FileRef>
</Workspace>
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
0 → 100644
查看文件 @
94ef692
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
IDEDidComputeMac32BitWarning
</key>
<true/>
</dict>
</plist>
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/Assets.xcassets/AccentColor.colorset/Contents.json
0 → 100644
查看文件 @
94ef692
{
"colors"
:
[
{
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/Assets.xcassets/AppIcon.appiconset/Contents.json
0 → 100644
查看文件 @
94ef692
{
"images"
:
[
{
"idiom"
:
"universal"
,
"platform"
:
"ios"
,
"size"
:
"1024x1024"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/Assets.xcassets/Contents.json
0 → 100644
查看文件 @
94ef692
{
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/ContentView.swift
0 → 100644
查看文件 @
94ef692
//
// ContentView.swift
// SherpaOnnxTts
//
// Created by fangjun on 2023/11/23.
//
// Speech-to-text with Next-gen Kaldi on iOS without Internet connection
import
SwiftUI
import
AVFoundation
struct
ContentView
:
View
{
@State
private
var
sid
=
"0"
@State
private
var
speed
=
1.0
@State
private
var
text
=
""
@State
private
var
showAlert
=
false
@State
var
filename
:
URL
=
NSURL
()
as
URL
@State
var
audioPlayer
:
AVAudioPlayer
!
private
var
tts
=
createOfflineTts
()
var
body
:
some
View
{
VStack
(
alignment
:
.
leading
)
{
HStack
{
Spacer
()
Text
(
"Next-gen Kaldi: TTS"
)
.
font
(
.
title
)
Spacer
()
}
HStack
{
Text
(
"Speaker ID"
)
TextField
(
"Please input a speaker ID"
,
text
:
$
sid
)
.
textFieldStyle
(
.
roundedBorder
)
.
keyboardType
(
.
numberPad
)
}
HStack
{
Text
(
"Speed
\(
String
(
format
:
"%.1f"
,
speed
)
)
"
)
.
padding
(
.
trailing
)
Slider
(
value
:
$
speed
,
in
:
0.5
...
2.0
,
step
:
0.1
)
{
Text
(
"Speech speed"
)
}
}
Text
(
"Please input your text below"
)
.
padding
([
.
trailing
,
.
top
,
.
bottom
])
TextEditor
(
text
:
$
text
)
.
font
(
.
body
)
.
opacity
(
self
.
text
.
isEmpty
?
0.25
:
1
)
.
disableAutocorrection
(
true
)
.
border
(
Color
.
black
)
Spacer
()
HStack
{
Spacer
()
Button
(
action
:
{
let
speakerId
=
Int
(
self
.
sid
)
??
0
let
t
=
self
.
text
.
trimmingCharacters
(
in
:
.
whitespacesAndNewlines
)
if
t
.
isEmpty
{
self
.
showAlert
=
true
return
}
let
audio
=
tts
.
generate
(
text
:
t
,
sid
:
speakerId
,
speed
:
Float
(
self
.
speed
))
if
self
.
filename
.
absoluteString
.
isEmpty
{
let
tempDirectoryURL
=
NSURL
.
fileURL
(
withPath
:
NSTemporaryDirectory
(),
isDirectory
:
true
)
self
.
filename
=
tempDirectoryURL
.
appendingPathComponent
(
"test.wav"
)
}
let
ret
=
audio
.
save
(
filename
:
filename
.
path
)
self
.
audioPlayer
=
try!
AVAudioPlayer
(
contentsOf
:
filename
)
self
.
audioPlayer
.
play
()
})
{
Text
(
"Generate"
)
}
.
alert
(
isPresented
:
$
showAlert
)
{
Alert
(
title
:
Text
(
"Empty text"
),
message
:
Text
(
"Please input your text before clicking the Generate button"
))
}
Spacer
()
Button
(
action
:
{
self
.
audioPlayer
.
play
()
})
{
Text
(
"Play"
)
}
.
disabled
(
filename
.
absoluteString
.
isEmpty
)
Spacer
()
}
Spacer
()
}
.
padding
()
}
}
struct
ContentView_Previews
:
PreviewProvider
{
static
var
previews
:
some
View
{
ContentView
()
}
}
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/Preview Content/Preview Assets.xcassets/Contents.json
0 → 100644
查看文件 @
94ef692
{
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/SherpaOnnxTtsApp.swift
0 → 100644
查看文件 @
94ef692
//
// SherpaOnnxTtsApp.swift
// SherpaOnnxTts
//
// Created by fangjun on 2023/11/23.
//
import
SwiftUI
@main
struct
SherpaOnnxTtsApp
:
App
{
var
body
:
some
Scene
{
WindowGroup
{
ContentView
()
}
}
}
...
...
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/ViewModel.swift
0 → 100644
查看文件 @
94ef692
//
// ViewModel.swift
// SherpaOnnxTts
//
// Created by fangjun on 2023/11/23.
//
import
Foundation
func
getResource
(
_
forResource
:
String
,
_
ofType
:
String
)
->
String
{
let
path
=
Bundle
.
main
.
path
(
forResource
:
forResource
,
ofType
:
ofType
)
precondition
(
path
!=
nil
,
"
\(
forResource
)
.
\(
ofType
)
does not exist!
\n
"
+
"Remember to change
\n
"
+
" Build Phases -> Copy Bundle Resources
\n
"
+
"to add it!"
)
return
path
!
}
/// Please refer to
/// https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/index.html
/// to download pre-trained models
func
getTtsForVCTK
()
->
SherpaOnnxOfflineTtsWrapper
{
// See the following link
// https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/vits.html#vctk-english-multi-speaker-109-speakers
// vits-vctk.onnx
let
model
=
getResource
(
"vits-vctk"
,
"onnx"
)
// lexicon.txt
let
lexicon
=
getResource
(
"lexicon"
,
"txt"
)
// tokens.txt
let
tokens
=
getResource
(
"tokens"
,
"txt"
)
let
vits
=
sherpaOnnxOfflineTtsVitsModelConfig
(
model
:
model
,
lexicon
:
lexicon
,
tokens
:
tokens
)
let
modelConfig
=
sherpaOnnxOfflineTtsModelConfig
(
vits
:
vits
)
var
config
=
sherpaOnnxOfflineTtsConfig
(
model
:
modelConfig
)
return
SherpaOnnxOfflineTtsWrapper
(
config
:
&
config
)
}
func
getTtsForAishell3
()
->
SherpaOnnxOfflineTtsWrapper
{
// See the following link
// https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/vits.html#vits-model-aishell3
// vits-vctk.onnx
let
model
=
getResource
(
"vits-aishell3"
,
"onnx"
)
// lexicon.txt
let
lexicon
=
getResource
(
"lexicon"
,
"txt"
)
// tokens.txt
let
tokens
=
getResource
(
"tokens"
,
"txt"
)
let
vits
=
sherpaOnnxOfflineTtsVitsModelConfig
(
model
:
model
,
lexicon
:
lexicon
,
tokens
:
tokens
)
let
modelConfig
=
sherpaOnnxOfflineTtsModelConfig
(
vits
:
vits
)
var
config
=
sherpaOnnxOfflineTtsConfig
(
model
:
modelConfig
)
return
SherpaOnnxOfflineTtsWrapper
(
config
:
&
config
)
}
func
createOfflineTts
()
->
SherpaOnnxOfflineTtsWrapper
{
return
getTtsForVCTK
()
// return getTtsForAishell3()
// please add more models on need by following the above two examples
}
...
...
swift-api-examples/SherpaOnnx.swift
查看文件 @
94ef692
...
...
@@ -650,8 +650,8 @@ class SherpaOnnxGeneratedAudioWrapper {
}
}
func
save
(
filename
:
String
)
{
SherpaOnnxWriteWave
(
audio
.
pointee
.
samples
,
n
,
sampleRate
,
toCPointer
(
filename
))
func
save
(
filename
:
String
)
->
Int32
{
return
SherpaOnnxWriteWave
(
audio
.
pointee
.
samples
,
n
,
sampleRate
,
toCPointer
(
filename
))
}
}
...
...
请
注册
或
登录
后发表评论