yujinqiu
Committed by GitHub

Add language identification swiftui demo (#729)

@@ -48,6 +48,28 @@ func getBilingualStreamingZhEnParaformer() -> SherpaOnnxOnlineModelConfig { @@ -48,6 +48,28 @@ func getBilingualStreamingZhEnParaformer() -> SherpaOnnxOnlineModelConfig {
48 ) 48 )
49 } 49 }
50 50
  51 +// https://k2-fsa.github.io/sherpa/onnx/pretrained_models/whisper/tiny.en.html#tiny-en
  52 +//
  53 +func getLanguageIdentificationTiny() -> SherpaOnnxSpokenLanguageIdentificationConfig
  54 + {
  55 + let encoder = getResource("tiny-encoder.int8", "onnx")
  56 + let decoder = getResource("tiny-decoder.int8", "onnx")
  57 +
  58 + let whisperConfig = sherpaOnnxSpokenLanguageIdentificationWhisperConfig(
  59 + encoder: encoder,
  60 + decoder: decoder
  61 + )
  62 +
  63 + let config = sherpaOnnxSpokenLanguageIdentificationConfig(
  64 + whisper: whisperConfig,
  65 + numThreads: 1,
  66 + debug: 1,
  67 + provider: "cpu"
  68 + )
  69 + return config
  70 +}
  71 +
  72 +
51 /// Please refer to 73 /// Please refer to
52 /// https://k2-fsa.github.io/sherpa/onnx/pretrained_models/index.html 74 /// https://k2-fsa.github.io/sherpa/onnx/pretrained_models/index.html
53 /// to add more models if you need 75 /// to add more models if you need
  1 +// !$*UTF8*$!
  2 +{
  3 + archiveVersion = 1;
  4 + classes = {
  5 + };
  6 + objectVersion = 56;
  7 + objects = {
  8 +
  9 +/* Begin PBXBuildFile section */
  10 + DEBB2D762BBAAA3500864EF5 /* SherpaOnnxLangIDApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB2D752BBAAA3500864EF5 /* SherpaOnnxLangIDApp.swift */; };
  11 + DEBB2D782BBAAA3500864EF5 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB2D772BBAAA3500864EF5 /* ContentView.swift */; };
  12 + DEBB2D7A2BBAAA3600864EF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DEBB2D792BBAAA3600864EF5 /* Assets.xcassets */; };
  13 + DEBB2D7D2BBAAA3600864EF5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DEBB2D7C2BBAAA3600864EF5 /* Preview Assets.xcassets */; };
  14 + DEBB2D872BBAAA3600864EF5 /* SherpaOnnxLangIDTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB2D862BBAAA3600864EF5 /* SherpaOnnxLangIDTests.swift */; };
  15 + DEBB2D912BBAAA3600864EF5 /* SherpaOnnxLangIDUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB2D902BBAAA3600864EF5 /* SherpaOnnxLangIDUITests.swift */; };
  16 + DEBB2D932BBAAA3600864EF5 /* SherpaOnnxLangIDUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB2D922BBAAA3600864EF5 /* SherpaOnnxLangIDUITestsLaunchTests.swift */; };
  17 + DEBB2DA12BBAAAD800864EF5 /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB2DA02BBAAAD800864EF5 /* Extension.swift */; };
  18 + DEBB2DA32BBAAAE700864EF5 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB2DA22BBAAAE700864EF5 /* Model.swift */; };
  19 + DEBB2DA52BBAAAFD00864EF5 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB2DA42BBAAAFD00864EF5 /* ViewModel.swift */; };
  20 + DEBB2DAC2BBAAC6200864EF5 /* onnxruntime.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEBB2DAB2BBAAC6200864EF5 /* onnxruntime.xcframework */; };
  21 + DEBB2DAD2BBAAC6200864EF5 /* onnxruntime.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DEBB2DAB2BBAAC6200864EF5 /* onnxruntime.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
  22 + DEBB2DAF2BBAAC6400864EF5 /* sherpa-onnx.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEBB2DA72BBAAC4D00864EF5 /* sherpa-onnx.xcframework */; };
  23 + DEBB2DB02BBAAC6400864EF5 /* sherpa-onnx.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DEBB2DA72BBAAC4D00864EF5 /* sherpa-onnx.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
  24 + DEBB2DB22BBAAD0000864EF5 /* SherpaOnnx.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB2DB12BBAAD0000864EF5 /* SherpaOnnx.swift */; };
  25 + DEBB2DB42BBAB02E00864EF5 /* tiny-decoder.int8.onnx in Resources */ = {isa = PBXBuildFile; fileRef = DEBB2DB32BBAB02E00864EF5 /* tiny-decoder.int8.onnx */; };
  26 + DEBB2DB62BBAB03400864EF5 /* tiny-encoder.int8.onnx in Resources */ = {isa = PBXBuildFile; fileRef = DEBB2DB52BBAB03400864EF5 /* tiny-encoder.int8.onnx */; };
  27 +/* End PBXBuildFile section */
  28 +
  29 +/* Begin PBXContainerItemProxy section */
  30 + DEBB2D832BBAAA3600864EF5 /* PBXContainerItemProxy */ = {
  31 + isa = PBXContainerItemProxy;
  32 + containerPortal = DEBB2D6A2BBAAA3500864EF5 /* Project object */;
  33 + proxyType = 1;
  34 + remoteGlobalIDString = DEBB2D712BBAAA3500864EF5;
  35 + remoteInfo = SherpaOnnxLangID;
  36 + };
  37 + DEBB2D8D2BBAAA3600864EF5 /* PBXContainerItemProxy */ = {
  38 + isa = PBXContainerItemProxy;
  39 + containerPortal = DEBB2D6A2BBAAA3500864EF5 /* Project object */;
  40 + proxyType = 1;
  41 + remoteGlobalIDString = DEBB2D712BBAAA3500864EF5;
  42 + remoteInfo = SherpaOnnxLangID;
  43 + };
  44 +/* End PBXContainerItemProxy section */
  45 +
  46 +/* Begin PBXCopyFilesBuildPhase section */
  47 + DEBB2DAE2BBAAC6200864EF5 /* Embed Frameworks */ = {
  48 + isa = PBXCopyFilesBuildPhase;
  49 + buildActionMask = 2147483647;
  50 + dstPath = "";
  51 + dstSubfolderSpec = 10;
  52 + files = (
  53 + DEBB2DAD2BBAAC6200864EF5 /* onnxruntime.xcframework in Embed Frameworks */,
  54 + DEBB2DB02BBAAC6400864EF5 /* sherpa-onnx.xcframework in Embed Frameworks */,
  55 + );
  56 + name = "Embed Frameworks";
  57 + runOnlyForDeploymentPostprocessing = 0;
  58 + };
  59 +/* End PBXCopyFilesBuildPhase section */
  60 +
  61 +/* Begin PBXFileReference section */
  62 + DEBB2D722BBAAA3500864EF5 /* SherpaOnnxLangID.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SherpaOnnxLangID.app; sourceTree = BUILT_PRODUCTS_DIR; };
  63 + DEBB2D752BBAAA3500864EF5 /* SherpaOnnxLangIDApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SherpaOnnxLangIDApp.swift; sourceTree = "<group>"; };
  64 + DEBB2D772BBAAA3500864EF5 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
  65 + DEBB2D792BBAAA3600864EF5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
  66 + DEBB2D7C2BBAAA3600864EF5 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
  67 + DEBB2D822BBAAA3600864EF5 /* SherpaOnnxLangIDTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SherpaOnnxLangIDTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
  68 + DEBB2D862BBAAA3600864EF5 /* SherpaOnnxLangIDTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SherpaOnnxLangIDTests.swift; sourceTree = "<group>"; };
  69 + DEBB2D8C2BBAAA3600864EF5 /* SherpaOnnxLangIDUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SherpaOnnxLangIDUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
  70 + DEBB2D902BBAAA3600864EF5 /* SherpaOnnxLangIDUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SherpaOnnxLangIDUITests.swift; sourceTree = "<group>"; };
  71 + DEBB2D922BBAAA3600864EF5 /* SherpaOnnxLangIDUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SherpaOnnxLangIDUITestsLaunchTests.swift; sourceTree = "<group>"; };
  72 + DEBB2D9F2BBAAACD00864EF5 /* SherpaOnnx-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "SherpaOnnx-Bridging-Header.h"; path = "../../../swift-api-examples/SherpaOnnx-Bridging-Header.h"; sourceTree = "<group>"; };
  73 + DEBB2DA02BBAAAD800864EF5 /* Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Extension.swift; path = ../../SherpaOnnx/SherpaOnnx/Extension.swift; sourceTree = "<group>"; };
  74 + DEBB2DA22BBAAAE700864EF5 /* Model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Model.swift; path = ../../SherpaOnnx/SherpaOnnx/Model.swift; sourceTree = "<group>"; };
  75 + DEBB2DA42BBAAAFD00864EF5 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = "<group>"; };
  76 + DEBB2DA72BBAAC4D00864EF5 /* sherpa-onnx.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "sherpa-onnx.xcframework"; path = "../../build-ios/sherpa-onnx.xcframework"; sourceTree = "<group>"; };
  77 + DEBB2DAB2BBAAC6200864EF5 /* onnxruntime.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = onnxruntime.xcframework; path = "../../build-ios/ios-onnxruntime/1.17.1/onnxruntime.xcframework"; sourceTree = "<group>"; };
  78 + DEBB2DB12BBAAD0000864EF5 /* SherpaOnnx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SherpaOnnx.swift; path = "../../../swift-api-examples/SherpaOnnx.swift"; sourceTree = "<group>"; };
  79 + DEBB2DB32BBAB02E00864EF5 /* tiny-decoder.int8.onnx */ = {isa = PBXFileReference; lastKnownFileType = file; path = "tiny-decoder.int8.onnx"; sourceTree = "<group>"; };
  80 + DEBB2DB52BBAB03400864EF5 /* tiny-encoder.int8.onnx */ = {isa = PBXFileReference; lastKnownFileType = file; path = "tiny-encoder.int8.onnx"; sourceTree = "<group>"; };
  81 +/* End PBXFileReference section */
  82 +
  83 +/* Begin PBXFrameworksBuildPhase section */
  84 + DEBB2D6F2BBAAA3500864EF5 /* Frameworks */ = {
  85 + isa = PBXFrameworksBuildPhase;
  86 + buildActionMask = 2147483647;
  87 + files = (
  88 + DEBB2DAC2BBAAC6200864EF5 /* onnxruntime.xcframework in Frameworks */,
  89 + DEBB2DAF2BBAAC6400864EF5 /* sherpa-onnx.xcframework in Frameworks */,
  90 + );
  91 + runOnlyForDeploymentPostprocessing = 0;
  92 + };
  93 + DEBB2D7F2BBAAA3600864EF5 /* Frameworks */ = {
  94 + isa = PBXFrameworksBuildPhase;
  95 + buildActionMask = 2147483647;
  96 + files = (
  97 + );
  98 + runOnlyForDeploymentPostprocessing = 0;
  99 + };
  100 + DEBB2D892BBAAA3600864EF5 /* Frameworks */ = {
  101 + isa = PBXFrameworksBuildPhase;
  102 + buildActionMask = 2147483647;
  103 + files = (
  104 + );
  105 + runOnlyForDeploymentPostprocessing = 0;
  106 + };
  107 +/* End PBXFrameworksBuildPhase section */
  108 +
  109 +/* Begin PBXGroup section */
  110 + DEBB2D692BBAAA3500864EF5 = {
  111 + isa = PBXGroup;
  112 + children = (
  113 + DEBB2D742BBAAA3500864EF5 /* SherpaOnnxLangID */,
  114 + DEBB2D852BBAAA3600864EF5 /* SherpaOnnxLangIDTests */,
  115 + DEBB2D8F2BBAAA3600864EF5 /* SherpaOnnxLangIDUITests */,
  116 + DEBB2D732BBAAA3500864EF5 /* Products */,
  117 + DEBB2DA62BBAAC4D00864EF5 /* Frameworks */,
  118 + );
  119 + sourceTree = "<group>";
  120 + };
  121 + DEBB2D732BBAAA3500864EF5 /* Products */ = {
  122 + isa = PBXGroup;
  123 + children = (
  124 + DEBB2D722BBAAA3500864EF5 /* SherpaOnnxLangID.app */,
  125 + DEBB2D822BBAAA3600864EF5 /* SherpaOnnxLangIDTests.xctest */,
  126 + DEBB2D8C2BBAAA3600864EF5 /* SherpaOnnxLangIDUITests.xctest */,
  127 + );
  128 + name = Products;
  129 + sourceTree = "<group>";
  130 + };
  131 + DEBB2D742BBAAA3500864EF5 /* SherpaOnnxLangID */ = {
  132 + isa = PBXGroup;
  133 + children = (
  134 + DEBB2DB32BBAB02E00864EF5 /* tiny-decoder.int8.onnx */,
  135 + DEBB2D752BBAAA3500864EF5 /* SherpaOnnxLangIDApp.swift */,
  136 + DEBB2DB52BBAB03400864EF5 /* tiny-encoder.int8.onnx */,
  137 + DEBB2D772BBAAA3500864EF5 /* ContentView.swift */,
  138 + DEBB2DA42BBAAAFD00864EF5 /* ViewModel.swift */,
  139 + DEBB2D9F2BBAAACD00864EF5 /* SherpaOnnx-Bridging-Header.h */,
  140 + DEBB2DB12BBAAD0000864EF5 /* SherpaOnnx.swift */,
  141 + DEBB2DA02BBAAAD800864EF5 /* Extension.swift */,
  142 + DEBB2DA22BBAAAE700864EF5 /* Model.swift */,
  143 + DEBB2D792BBAAA3600864EF5 /* Assets.xcassets */,
  144 + DEBB2D7B2BBAAA3600864EF5 /* Preview Content */,
  145 + );
  146 + path = SherpaOnnxLangID;
  147 + sourceTree = "<group>";
  148 + };
  149 + DEBB2D7B2BBAAA3600864EF5 /* Preview Content */ = {
  150 + isa = PBXGroup;
  151 + children = (
  152 + DEBB2D7C2BBAAA3600864EF5 /* Preview Assets.xcassets */,
  153 + );
  154 + path = "Preview Content";
  155 + sourceTree = "<group>";
  156 + };
  157 + DEBB2D852BBAAA3600864EF5 /* SherpaOnnxLangIDTests */ = {
  158 + isa = PBXGroup;
  159 + children = (
  160 + DEBB2D862BBAAA3600864EF5 /* SherpaOnnxLangIDTests.swift */,
  161 + );
  162 + path = SherpaOnnxLangIDTests;
  163 + sourceTree = "<group>";
  164 + };
  165 + DEBB2D8F2BBAAA3600864EF5 /* SherpaOnnxLangIDUITests */ = {
  166 + isa = PBXGroup;
  167 + children = (
  168 + DEBB2D902BBAAA3600864EF5 /* SherpaOnnxLangIDUITests.swift */,
  169 + DEBB2D922BBAAA3600864EF5 /* SherpaOnnxLangIDUITestsLaunchTests.swift */,
  170 + );
  171 + path = SherpaOnnxLangIDUITests;
  172 + sourceTree = "<group>";
  173 + };
  174 + DEBB2DA62BBAAC4D00864EF5 /* Frameworks */ = {
  175 + isa = PBXGroup;
  176 + children = (
  177 + DEBB2DAB2BBAAC6200864EF5 /* onnxruntime.xcframework */,
  178 + DEBB2DA72BBAAC4D00864EF5 /* sherpa-onnx.xcframework */,
  179 + );
  180 + name = Frameworks;
  181 + sourceTree = "<group>";
  182 + };
  183 +/* End PBXGroup section */
  184 +
  185 +/* Begin PBXNativeTarget section */
  186 + DEBB2D712BBAAA3500864EF5 /* SherpaOnnxLangID */ = {
  187 + isa = PBXNativeTarget;
  188 + buildConfigurationList = DEBB2D962BBAAA3600864EF5 /* Build configuration list for PBXNativeTarget "SherpaOnnxLangID" */;
  189 + buildPhases = (
  190 + DEBB2D6E2BBAAA3500864EF5 /* Sources */,
  191 + DEBB2D6F2BBAAA3500864EF5 /* Frameworks */,
  192 + DEBB2D702BBAAA3500864EF5 /* Resources */,
  193 + DEBB2DAE2BBAAC6200864EF5 /* Embed Frameworks */,
  194 + );
  195 + buildRules = (
  196 + );
  197 + dependencies = (
  198 + );
  199 + name = SherpaOnnxLangID;
  200 + productName = SherpaOnnxLangID;
  201 + productReference = DEBB2D722BBAAA3500864EF5 /* SherpaOnnxLangID.app */;
  202 + productType = "com.apple.product-type.application";
  203 + };
  204 + DEBB2D812BBAAA3600864EF5 /* SherpaOnnxLangIDTests */ = {
  205 + isa = PBXNativeTarget;
  206 + buildConfigurationList = DEBB2D992BBAAA3600864EF5 /* Build configuration list for PBXNativeTarget "SherpaOnnxLangIDTests" */;
  207 + buildPhases = (
  208 + DEBB2D7E2BBAAA3600864EF5 /* Sources */,
  209 + DEBB2D7F2BBAAA3600864EF5 /* Frameworks */,
  210 + DEBB2D802BBAAA3600864EF5 /* Resources */,
  211 + );
  212 + buildRules = (
  213 + );
  214 + dependencies = (
  215 + DEBB2D842BBAAA3600864EF5 /* PBXTargetDependency */,
  216 + );
  217 + name = SherpaOnnxLangIDTests;
  218 + productName = SherpaOnnxLangIDTests;
  219 + productReference = DEBB2D822BBAAA3600864EF5 /* SherpaOnnxLangIDTests.xctest */;
  220 + productType = "com.apple.product-type.bundle.unit-test";
  221 + };
  222 + DEBB2D8B2BBAAA3600864EF5 /* SherpaOnnxLangIDUITests */ = {
  223 + isa = PBXNativeTarget;
  224 + buildConfigurationList = DEBB2D9C2BBAAA3600864EF5 /* Build configuration list for PBXNativeTarget "SherpaOnnxLangIDUITests" */;
  225 + buildPhases = (
  226 + DEBB2D882BBAAA3600864EF5 /* Sources */,
  227 + DEBB2D892BBAAA3600864EF5 /* Frameworks */,
  228 + DEBB2D8A2BBAAA3600864EF5 /* Resources */,
  229 + );
  230 + buildRules = (
  231 + );
  232 + dependencies = (
  233 + DEBB2D8E2BBAAA3600864EF5 /* PBXTargetDependency */,
  234 + );
  235 + name = SherpaOnnxLangIDUITests;
  236 + productName = SherpaOnnxLangIDUITests;
  237 + productReference = DEBB2D8C2BBAAA3600864EF5 /* SherpaOnnxLangIDUITests.xctest */;
  238 + productType = "com.apple.product-type.bundle.ui-testing";
  239 + };
  240 +/* End PBXNativeTarget section */
  241 +
  242 +/* Begin PBXProject section */
  243 + DEBB2D6A2BBAAA3500864EF5 /* Project object */ = {
  244 + isa = PBXProject;
  245 + attributes = {
  246 + BuildIndependentTargetsInParallel = 1;
  247 + LastSwiftUpdateCheck = 1530;
  248 + LastUpgradeCheck = 1530;
  249 + TargetAttributes = {
  250 + DEBB2D712BBAAA3500864EF5 = {
  251 + CreatedOnToolsVersion = 15.3;
  252 + };
  253 + DEBB2D812BBAAA3600864EF5 = {
  254 + CreatedOnToolsVersion = 15.3;
  255 + TestTargetID = DEBB2D712BBAAA3500864EF5;
  256 + };
  257 + DEBB2D8B2BBAAA3600864EF5 = {
  258 + CreatedOnToolsVersion = 15.3;
  259 + TestTargetID = DEBB2D712BBAAA3500864EF5;
  260 + };
  261 + };
  262 + };
  263 + buildConfigurationList = DEBB2D6D2BBAAA3500864EF5 /* Build configuration list for PBXProject "SherpaOnnxLangID" */;
  264 + compatibilityVersion = "Xcode 14.0";
  265 + developmentRegion = en;
  266 + hasScannedForEncodings = 0;
  267 + knownRegions = (
  268 + en,
  269 + Base,
  270 + );
  271 + mainGroup = DEBB2D692BBAAA3500864EF5;
  272 + productRefGroup = DEBB2D732BBAAA3500864EF5 /* Products */;
  273 + projectDirPath = "";
  274 + projectRoot = "";
  275 + targets = (
  276 + DEBB2D712BBAAA3500864EF5 /* SherpaOnnxLangID */,
  277 + DEBB2D812BBAAA3600864EF5 /* SherpaOnnxLangIDTests */,
  278 + DEBB2D8B2BBAAA3600864EF5 /* SherpaOnnxLangIDUITests */,
  279 + );
  280 + };
  281 +/* End PBXProject section */
  282 +
  283 +/* Begin PBXResourcesBuildPhase section */
  284 + DEBB2D702BBAAA3500864EF5 /* Resources */ = {
  285 + isa = PBXResourcesBuildPhase;
  286 + buildActionMask = 2147483647;
  287 + files = (
  288 + DEBB2D7D2BBAAA3600864EF5 /* Preview Assets.xcassets in Resources */,
  289 + DEBB2DB62BBAB03400864EF5 /* tiny-encoder.int8.onnx in Resources */,
  290 + DEBB2DB42BBAB02E00864EF5 /* tiny-decoder.int8.onnx in Resources */,
  291 + DEBB2D7A2BBAAA3600864EF5 /* Assets.xcassets in Resources */,
  292 + );
  293 + runOnlyForDeploymentPostprocessing = 0;
  294 + };
  295 + DEBB2D802BBAAA3600864EF5 /* Resources */ = {
  296 + isa = PBXResourcesBuildPhase;
  297 + buildActionMask = 2147483647;
  298 + files = (
  299 + );
  300 + runOnlyForDeploymentPostprocessing = 0;
  301 + };
  302 + DEBB2D8A2BBAAA3600864EF5 /* Resources */ = {
  303 + isa = PBXResourcesBuildPhase;
  304 + buildActionMask = 2147483647;
  305 + files = (
  306 + );
  307 + runOnlyForDeploymentPostprocessing = 0;
  308 + };
  309 +/* End PBXResourcesBuildPhase section */
  310 +
  311 +/* Begin PBXSourcesBuildPhase section */
  312 + DEBB2D6E2BBAAA3500864EF5 /* Sources */ = {
  313 + isa = PBXSourcesBuildPhase;
  314 + buildActionMask = 2147483647;
  315 + files = (
  316 + DEBB2DA52BBAAAFD00864EF5 /* ViewModel.swift in Sources */,
  317 + DEBB2DB22BBAAD0000864EF5 /* SherpaOnnx.swift in Sources */,
  318 + DEBB2DA12BBAAAD800864EF5 /* Extension.swift in Sources */,
  319 + DEBB2D782BBAAA3500864EF5 /* ContentView.swift in Sources */,
  320 + DEBB2D762BBAAA3500864EF5 /* SherpaOnnxLangIDApp.swift in Sources */,
  321 + DEBB2DA32BBAAAE700864EF5 /* Model.swift in Sources */,
  322 + );
  323 + runOnlyForDeploymentPostprocessing = 0;
  324 + };
  325 + DEBB2D7E2BBAAA3600864EF5 /* Sources */ = {
  326 + isa = PBXSourcesBuildPhase;
  327 + buildActionMask = 2147483647;
  328 + files = (
  329 + DEBB2D872BBAAA3600864EF5 /* SherpaOnnxLangIDTests.swift in Sources */,
  330 + );
  331 + runOnlyForDeploymentPostprocessing = 0;
  332 + };
  333 + DEBB2D882BBAAA3600864EF5 /* Sources */ = {
  334 + isa = PBXSourcesBuildPhase;
  335 + buildActionMask = 2147483647;
  336 + files = (
  337 + DEBB2D912BBAAA3600864EF5 /* SherpaOnnxLangIDUITests.swift in Sources */,
  338 + DEBB2D932BBAAA3600864EF5 /* SherpaOnnxLangIDUITestsLaunchTests.swift in Sources */,
  339 + );
  340 + runOnlyForDeploymentPostprocessing = 0;
  341 + };
  342 +/* End PBXSourcesBuildPhase section */
  343 +
  344 +/* Begin PBXTargetDependency section */
  345 + DEBB2D842BBAAA3600864EF5 /* PBXTargetDependency */ = {
  346 + isa = PBXTargetDependency;
  347 + target = DEBB2D712BBAAA3500864EF5 /* SherpaOnnxLangID */;
  348 + targetProxy = DEBB2D832BBAAA3600864EF5 /* PBXContainerItemProxy */;
  349 + };
  350 + DEBB2D8E2BBAAA3600864EF5 /* PBXTargetDependency */ = {
  351 + isa = PBXTargetDependency;
  352 + target = DEBB2D712BBAAA3500864EF5 /* SherpaOnnxLangID */;
  353 + targetProxy = DEBB2D8D2BBAAA3600864EF5 /* PBXContainerItemProxy */;
  354 + };
  355 +/* End PBXTargetDependency section */
  356 +
  357 +/* Begin XCBuildConfiguration section */
  358 + DEBB2D942BBAAA3600864EF5 /* Debug */ = {
  359 + isa = XCBuildConfiguration;
  360 + buildSettings = {
  361 + ALWAYS_SEARCH_USER_PATHS = NO;
  362 + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
  363 + CLANG_ANALYZER_NONNULL = YES;
  364 + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
  365 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
  366 + CLANG_ENABLE_MODULES = YES;
  367 + CLANG_ENABLE_OBJC_ARC = YES;
  368 + CLANG_ENABLE_OBJC_WEAK = YES;
  369 + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
  370 + CLANG_WARN_BOOL_CONVERSION = YES;
  371 + CLANG_WARN_COMMA = YES;
  372 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  373 + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
  374 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  375 + CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
  376 + CLANG_WARN_EMPTY_BODY = YES;
  377 + CLANG_WARN_ENUM_CONVERSION = YES;
  378 + CLANG_WARN_INFINITE_RECURSION = YES;
  379 + CLANG_WARN_INT_CONVERSION = YES;
  380 + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
  381 + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
  382 + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
  383 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  384 + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
  385 + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
  386 + CLANG_WARN_STRICT_PROTOTYPES = YES;
  387 + CLANG_WARN_SUSPICIOUS_MOVE = YES;
  388 + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
  389 + CLANG_WARN_UNREACHABLE_CODE = YES;
  390 + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
  391 + COPY_PHASE_STRIP = NO;
  392 + DEBUG_INFORMATION_FORMAT = dwarf;
  393 + ENABLE_STRICT_OBJC_MSGSEND = YES;
  394 + ENABLE_TESTABILITY = YES;
  395 + ENABLE_USER_SCRIPT_SANDBOXING = YES;
  396 + GCC_C_LANGUAGE_STANDARD = gnu17;
  397 + GCC_DYNAMIC_NO_PIC = NO;
  398 + GCC_NO_COMMON_BLOCKS = YES;
  399 + GCC_OPTIMIZATION_LEVEL = 0;
  400 + GCC_PREPROCESSOR_DEFINITIONS = (
  401 + "DEBUG=1",
  402 + "$(inherited)",
  403 + );
  404 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  405 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  406 + GCC_WARN_UNDECLARED_SELECTOR = YES;
  407 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  408 + GCC_WARN_UNUSED_FUNCTION = YES;
  409 + GCC_WARN_UNUSED_VARIABLE = YES;
  410 + IPHONEOS_DEPLOYMENT_TARGET = 16.0;
  411 + LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
  412 + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
  413 + MTL_FAST_MATH = YES;
  414 + ONLY_ACTIVE_ARCH = YES;
  415 + SDKROOT = iphoneos;
  416 + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
  417 + SWIFT_OPTIMIZATION_LEVEL = "-Onone";
  418 + };
  419 + name = Debug;
  420 + };
  421 + DEBB2D952BBAAA3600864EF5 /* Release */ = {
  422 + isa = XCBuildConfiguration;
  423 + buildSettings = {
  424 + ALWAYS_SEARCH_USER_PATHS = NO;
  425 + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
  426 + CLANG_ANALYZER_NONNULL = YES;
  427 + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
  428 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
  429 + CLANG_ENABLE_MODULES = YES;
  430 + CLANG_ENABLE_OBJC_ARC = YES;
  431 + CLANG_ENABLE_OBJC_WEAK = YES;
  432 + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
  433 + CLANG_WARN_BOOL_CONVERSION = YES;
  434 + CLANG_WARN_COMMA = YES;
  435 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  436 + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
  437 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  438 + CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
  439 + CLANG_WARN_EMPTY_BODY = YES;
  440 + CLANG_WARN_ENUM_CONVERSION = YES;
  441 + CLANG_WARN_INFINITE_RECURSION = YES;
  442 + CLANG_WARN_INT_CONVERSION = YES;
  443 + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
  444 + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
  445 + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
  446 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  447 + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
  448 + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
  449 + CLANG_WARN_STRICT_PROTOTYPES = YES;
  450 + CLANG_WARN_SUSPICIOUS_MOVE = YES;
  451 + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
  452 + CLANG_WARN_UNREACHABLE_CODE = YES;
  453 + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
  454 + COPY_PHASE_STRIP = NO;
  455 + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  456 + ENABLE_NS_ASSERTIONS = NO;
  457 + ENABLE_STRICT_OBJC_MSGSEND = YES;
  458 + ENABLE_USER_SCRIPT_SANDBOXING = YES;
  459 + GCC_C_LANGUAGE_STANDARD = gnu17;
  460 + GCC_NO_COMMON_BLOCKS = YES;
  461 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  462 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  463 + GCC_WARN_UNDECLARED_SELECTOR = YES;
  464 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  465 + GCC_WARN_UNUSED_FUNCTION = YES;
  466 + GCC_WARN_UNUSED_VARIABLE = YES;
  467 + IPHONEOS_DEPLOYMENT_TARGET = 16.0;
  468 + LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
  469 + MTL_ENABLE_DEBUG_INFO = NO;
  470 + MTL_FAST_MATH = YES;
  471 + SDKROOT = iphoneos;
  472 + SWIFT_COMPILATION_MODE = wholemodule;
  473 + VALIDATE_PRODUCT = YES;
  474 + };
  475 + name = Release;
  476 + };
  477 + DEBB2D972BBAAA3600864EF5 /* Debug */ = {
  478 + isa = XCBuildConfiguration;
  479 + buildSettings = {
  480 + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  481 + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
  482 + CODE_SIGN_IDENTITY = "Apple Development";
  483 + CODE_SIGN_STYLE = Automatic;
  484 + CURRENT_PROJECT_VERSION = 1;
  485 + DEVELOPMENT_ASSET_PATHS = "\"SherpaOnnxLangID/Preview Content\"";
  486 + DEVELOPMENT_TEAM = "";
  487 + ENABLE_PREVIEWS = YES;
  488 + GENERATE_INFOPLIST_FILE = YES;
  489 + HEADER_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios/sherpa-onnx.xcframework/Headers/";
  490 + INFOPLIST_KEY_NSMicrophoneUsageDescription = "Use microphone to record voice";
  491 + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
  492 + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
  493 + INFOPLIST_KEY_UILaunchScreen_Generation = YES;
  494 + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
  495 + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
  496 + IPHONEOS_DEPLOYMENT_TARGET = 16.0;
  497 + LD_RUNPATH_SEARCH_PATHS = (
  498 + "$(inherited)",
  499 + "@executable_path/Frameworks",
  500 + );
  501 + MARKETING_VERSION = 1.0;
  502 + OTHER_LDFLAGS = "-lc++";
  503 + PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxLangID";
  504 + PRODUCT_NAME = "$(TARGET_NAME)";
  505 + PROVISIONING_PROFILE_SPECIFIER = "";
  506 + SWIFT_EMIT_LOC_STRINGS = YES;
  507 + SWIFT_OBJC_BRIDGING_HEADER = "${PROJECT_DIR}/../../swift-api-examples/SherpaOnnx-Bridging-Header.h";
  508 + SWIFT_VERSION = 5.0;
  509 + TARGETED_DEVICE_FAMILY = "1,2";
  510 + };
  511 + name = Debug;
  512 + };
  513 + DEBB2D982BBAAA3600864EF5 /* Release */ = {
  514 + isa = XCBuildConfiguration;
  515 + buildSettings = {
  516 + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  517 + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
  518 + CODE_SIGN_IDENTITY = "Apple Development";
  519 + CODE_SIGN_STYLE = Automatic;
  520 + CURRENT_PROJECT_VERSION = 1;
  521 + DEVELOPMENT_ASSET_PATHS = "\"SherpaOnnxLangID/Preview Content\"";
  522 + DEVELOPMENT_TEAM = "";
  523 + ENABLE_PREVIEWS = YES;
  524 + GENERATE_INFOPLIST_FILE = YES;
  525 + HEADER_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios/sherpa-onnx.xcframework/Headers/";
  526 + INFOPLIST_KEY_NSMicrophoneUsageDescription = "Use microphone to record voice";
  527 + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
  528 + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
  529 + INFOPLIST_KEY_UILaunchScreen_Generation = YES;
  530 + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
  531 + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
  532 + IPHONEOS_DEPLOYMENT_TARGET = 16.0;
  533 + LD_RUNPATH_SEARCH_PATHS = (
  534 + "$(inherited)",
  535 + "@executable_path/Frameworks",
  536 + );
  537 + MARKETING_VERSION = 1.0;
  538 + OTHER_LDFLAGS = "-lc++";
  539 + PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxLangID";
  540 + PRODUCT_NAME = "$(TARGET_NAME)";
  541 + PROVISIONING_PROFILE_SPECIFIER = "";
  542 + SWIFT_EMIT_LOC_STRINGS = YES;
  543 + SWIFT_OBJC_BRIDGING_HEADER = "${PROJECT_DIR}/../../swift-api-examples/SherpaOnnx-Bridging-Header.h";
  544 + SWIFT_VERSION = 5.0;
  545 + TARGETED_DEVICE_FAMILY = "1,2";
  546 + };
  547 + name = Release;
  548 + };
  549 + DEBB2D9A2BBAAA3600864EF5 /* Debug */ = {
  550 + isa = XCBuildConfiguration;
  551 + buildSettings = {
  552 + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
  553 + BUNDLE_LOADER = "$(TEST_HOST)";
  554 + CODE_SIGN_STYLE = Automatic;
  555 + CURRENT_PROJECT_VERSION = 1;
  556 + DEVELOPMENT_TEAM = 896WS4KUPV;
  557 + GENERATE_INFOPLIST_FILE = YES;
  558 + IPHONEOS_DEPLOYMENT_TARGET = 17.4;
  559 + MARKETING_VERSION = 1.0;
  560 + PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxLangIDTests";
  561 + PRODUCT_NAME = "$(TARGET_NAME)";
  562 + SWIFT_EMIT_LOC_STRINGS = NO;
  563 + SWIFT_VERSION = 5.0;
  564 + TARGETED_DEVICE_FAMILY = "1,2";
  565 + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SherpaOnnxLangID.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SherpaOnnxLangID";
  566 + };
  567 + name = Debug;
  568 + };
  569 + DEBB2D9B2BBAAA3600864EF5 /* Release */ = {
  570 + isa = XCBuildConfiguration;
  571 + buildSettings = {
  572 + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
  573 + BUNDLE_LOADER = "$(TEST_HOST)";
  574 + CODE_SIGN_STYLE = Automatic;
  575 + CURRENT_PROJECT_VERSION = 1;
  576 + DEVELOPMENT_TEAM = 896WS4KUPV;
  577 + GENERATE_INFOPLIST_FILE = YES;
  578 + IPHONEOS_DEPLOYMENT_TARGET = 17.4;
  579 + MARKETING_VERSION = 1.0;
  580 + PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxLangIDTests";
  581 + PRODUCT_NAME = "$(TARGET_NAME)";
  582 + SWIFT_EMIT_LOC_STRINGS = NO;
  583 + SWIFT_VERSION = 5.0;
  584 + TARGETED_DEVICE_FAMILY = "1,2";
  585 + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SherpaOnnxLangID.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SherpaOnnxLangID";
  586 + };
  587 + name = Release;
  588 + };
  589 + DEBB2D9D2BBAAA3600864EF5 /* Debug */ = {
  590 + isa = XCBuildConfiguration;
  591 + buildSettings = {
  592 + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
  593 + CODE_SIGN_STYLE = Automatic;
  594 + CURRENT_PROJECT_VERSION = 1;
  595 + DEVELOPMENT_TEAM = 896WS4KUPV;
  596 + GENERATE_INFOPLIST_FILE = YES;
  597 + MARKETING_VERSION = 1.0;
  598 + PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxLangIDUITests";
  599 + PRODUCT_NAME = "$(TARGET_NAME)";
  600 + SWIFT_EMIT_LOC_STRINGS = NO;
  601 + SWIFT_VERSION = 5.0;
  602 + TARGETED_DEVICE_FAMILY = "1,2";
  603 + TEST_TARGET_NAME = SherpaOnnxLangID;
  604 + };
  605 + name = Debug;
  606 + };
  607 + DEBB2D9E2BBAAA3600864EF5 /* Release */ = {
  608 + isa = XCBuildConfiguration;
  609 + buildSettings = {
  610 + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
  611 + CODE_SIGN_STYLE = Automatic;
  612 + CURRENT_PROJECT_VERSION = 1;
  613 + DEVELOPMENT_TEAM = 896WS4KUPV;
  614 + GENERATE_INFOPLIST_FILE = YES;
  615 + MARKETING_VERSION = 1.0;
  616 + PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxLangIDUITests";
  617 + PRODUCT_NAME = "$(TARGET_NAME)";
  618 + SWIFT_EMIT_LOC_STRINGS = NO;
  619 + SWIFT_VERSION = 5.0;
  620 + TARGETED_DEVICE_FAMILY = "1,2";
  621 + TEST_TARGET_NAME = SherpaOnnxLangID;
  622 + };
  623 + name = Release;
  624 + };
  625 +/* End XCBuildConfiguration section */
  626 +
  627 +/* Begin XCConfigurationList section */
  628 + DEBB2D6D2BBAAA3500864EF5 /* Build configuration list for PBXProject "SherpaOnnxLangID" */ = {
  629 + isa = XCConfigurationList;
  630 + buildConfigurations = (
  631 + DEBB2D942BBAAA3600864EF5 /* Debug */,
  632 + DEBB2D952BBAAA3600864EF5 /* Release */,
  633 + );
  634 + defaultConfigurationIsVisible = 0;
  635 + defaultConfigurationName = Release;
  636 + };
  637 + DEBB2D962BBAAA3600864EF5 /* Build configuration list for PBXNativeTarget "SherpaOnnxLangID" */ = {
  638 + isa = XCConfigurationList;
  639 + buildConfigurations = (
  640 + DEBB2D972BBAAA3600864EF5 /* Debug */,
  641 + DEBB2D982BBAAA3600864EF5 /* Release */,
  642 + );
  643 + defaultConfigurationIsVisible = 0;
  644 + defaultConfigurationName = Release;
  645 + };
  646 + DEBB2D992BBAAA3600864EF5 /* Build configuration list for PBXNativeTarget "SherpaOnnxLangIDTests" */ = {
  647 + isa = XCConfigurationList;
  648 + buildConfigurations = (
  649 + DEBB2D9A2BBAAA3600864EF5 /* Debug */,
  650 + DEBB2D9B2BBAAA3600864EF5 /* Release */,
  651 + );
  652 + defaultConfigurationIsVisible = 0;
  653 + defaultConfigurationName = Release;
  654 + };
  655 + DEBB2D9C2BBAAA3600864EF5 /* Build configuration list for PBXNativeTarget "SherpaOnnxLangIDUITests" */ = {
  656 + isa = XCConfigurationList;
  657 + buildConfigurations = (
  658 + DEBB2D9D2BBAAA3600864EF5 /* Debug */,
  659 + DEBB2D9E2BBAAA3600864EF5 /* Release */,
  660 + );
  661 + defaultConfigurationIsVisible = 0;
  662 + defaultConfigurationName = Release;
  663 + };
  664 +/* End XCConfigurationList section */
  665 + };
  666 + rootObject = DEBB2D6A2BBAAA3500864EF5 /* Project object */;
  667 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Workspace
  3 + version = "1.0">
  4 + <FileRef
  5 + location = "self:">
  6 + </FileRef>
  7 +</Workspace>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>IDEDidComputeMac32BitWarning</key>
  6 + <true/>
  7 +</dict>
  8 +</plist>
  1 +{
  2 + "colors" : [
  3 + {
  4 + "idiom" : "universal"
  5 + }
  6 + ],
  7 + "info" : {
  8 + "author" : "xcode",
  9 + "version" : 1
  10 + }
  11 +}
  1 +{
  2 + "images" : [
  3 + {
  4 + "filename" : "k2-1024x1024.png",
  5 + "idiom" : "universal",
  6 + "platform" : "ios",
  7 + "size" : "1024x1024"
  8 + }
  9 + ],
  10 + "info" : {
  11 + "author" : "xcode",
  12 + "version" : 1
  13 + }
  14 +}
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "platform" : "ios",
  6 + "size" : "1024x1024"
  7 + }
  8 + ],
  9 + "info" : {
  10 + "author" : "xcode",
  11 + "version" : 1
  12 + }
  13 +}
  1 +{
  2 + "info" : {
  3 + "author" : "xcode",
  4 + "version" : 1
  5 + }
  6 +}
  1 +//
  2 +// ContentView.swift
  3 +// SherpaOnnxLangID
  4 +//
  5 +// Created by knight on 2024/4/1.
  6 +//
  7 +
  8 +import SwiftUI
  9 +
  10 +struct ContentView: View {
  11 + @StateObject var viewModel = ViewModel()
  12 +
  13 + var body: some View {
  14 + VStack {
  15 + Text("ASR with Next-gen Kaldi")
  16 + .font(.title)
  17 + if viewModel.status == .stop {
  18 + Text("See https://github.com/k2-fsa/sherpa-onnx")
  19 + Text("Press the Start button to run!")
  20 + }
  21 + if viewModel.status == .recording {
  22 + Text("Stop will show recording language.")
  23 + }
  24 + Spacer()
  25 + Text("Recording language is: \(viewModel.language)")
  26 + .frame(maxWidth: .infinity)
  27 + Spacer()
  28 + Button {
  29 + toggleRecorder()
  30 + } label: {
  31 + Text(viewModel.status == .stop ? "Start" : "Stop")
  32 + }
  33 + }
  34 + .padding()
  35 + }
  36 +
  37 + private func toggleRecorder() {
  38 + Task {
  39 + await viewModel.toggleRecorder()
  40 + }
  41 + }
  42 +}
  43 +
  44 +#Preview {
  45 + ContentView()
  46 +}
  1 +{
  2 + "info" : {
  3 + "author" : "xcode",
  4 + "version" : 1
  5 + }
  6 +}
  1 +//
  2 +// SherpaOnnxLangIDApp.swift
  3 +// SherpaOnnxLangID
  4 +//
  5 +// Created by knight on 2024/4/1.
  6 +//
  7 +
  8 +import SwiftUI
  9 +
  10 +@main
  11 +struct SherpaOnnxLangIDApp: App {
  12 + var body: some Scene {
  13 + WindowGroup {
  14 + ContentView()
  15 + }
  16 + }
  17 +}
  1 +//
  2 +// ViewModel.swift
  3 +// SherpaOnnxLangID
  4 +//
  5 +// Created by knight on 2024/4/1.
  6 +//
  7 +
  8 +import SwiftUI
  9 +import AVFoundation
  10 +
  11 +enum Status {
  12 + case stop
  13 + case recording
  14 +}
  15 +
  16 +@MainActor
  17 +class ViewModel:ObservableObject {
  18 + @Published var status: Status = .stop
  19 +
  20 + @Published var language: String = ""
  21 +
  22 + var languageIdentifier: SherpaOnnxSpokenLanguageIdentificationWrapper? = nil
  23 + var audioEngine: AVAudioEngine? = nil
  24 +
  25 + var voices: [Float] = []
  26 +
  27 + init() {
  28 + initRecorder()
  29 + initRecognizer()
  30 + }
  31 +
  32 + private func initRecognizer() {
  33 + var config = getLanguageIdentificationTiny()
  34 + self.languageIdentifier = SherpaOnnxSpokenLanguageIdentificationWrapper(config: &config)
  35 + }
  36 +
  37 + private func initRecorder() {
  38 + print("init recorder")
  39 + audioEngine = AVAudioEngine()
  40 + let inputNode = self.audioEngine?.inputNode
  41 + let bus = 0
  42 + let inputFormat = inputNode?.outputFormat(forBus: bus)
  43 + let outputFormat = AVAudioFormat(
  44 + commonFormat: .pcmFormatFloat32,
  45 + sampleRate: 16000, channels: 1,
  46 + interleaved: false)!
  47 +
  48 + let converter = AVAudioConverter(from: inputFormat!, to: outputFormat)!
  49 +
  50 + inputNode!.installTap(
  51 + onBus: bus,
  52 + bufferSize: 1024,
  53 + format: inputFormat
  54 + ) {
  55 + (buffer: AVAudioPCMBuffer, when: AVAudioTime) in
  56 + var newBufferAvailable = true
  57 +
  58 + let inputCallback: AVAudioConverterInputBlock = {
  59 + inNumPackets, outStatus in
  60 + if newBufferAvailable {
  61 + outStatus.pointee = .haveData
  62 + newBufferAvailable = false
  63 +
  64 + return buffer
  65 + } else {
  66 + outStatus.pointee = .noDataNow
  67 + return nil
  68 + }
  69 + }
  70 +
  71 + let convertedBuffer = AVAudioPCMBuffer(
  72 + pcmFormat: outputFormat,
  73 + frameCapacity:
  74 + AVAudioFrameCount(outputFormat.sampleRate)
  75 + * buffer.frameLength
  76 + / AVAudioFrameCount(buffer.format.sampleRate))!
  77 +
  78 + var error: NSError?
  79 + let _ = converter.convert(
  80 + to: convertedBuffer,
  81 + error: &error, withInputFrom: inputCallback)
  82 +
  83 + // TODO(fangjun): Handle status != haveData
  84 +
  85 + let array = convertedBuffer.array()
  86 + if !array.isEmpty {
  87 + self.voices.append(contentsOf: array)
  88 + }
  89 + }
  90 + }
  91 +
  92 + public func toggleRecorder() async{
  93 + if status == .stop {
  94 + await startRecorder()
  95 + } else {
  96 + await stopRecorder()
  97 + }
  98 + }
  99 +
  100 + private func startRecorder() async {
  101 + await MainActor.run {
  102 + self.language = ""
  103 + }
  104 + if !self.voices.isEmpty {
  105 + self.voices = []
  106 + }
  107 + do {
  108 + try self.audioEngine?.start()
  109 + status = .recording
  110 + print("started")
  111 + } catch let error as NSError {
  112 + print("Got an error starting audioEngine: \(error.domain), \(error)")
  113 + }
  114 + }
  115 +
  116 + private func stopRecorder() async {
  117 + audioEngine?.stop()
  118 + print("stopped, and begin identify language")
  119 + await self.identify()
  120 + status = .stop
  121 + }
  122 +
  123 + private func identify() async {
  124 + let result = self.languageIdentifier? .decode(samples: self.voices)
  125 + if let language = result?.lang {
  126 + await MainActor.run {
  127 + self.language = language
  128 + }
  129 + }
  130 + }
  131 +}
  1 +//
  2 +// SherpaOnnxLangIDTests.swift
  3 +// SherpaOnnxLangIDTests
  4 +//
  5 +// Created by knight on 2024/4/1.
  6 +//
  7 +
  8 +import XCTest
  9 +@testable import SherpaOnnxLangID
  10 +
  11 +final class SherpaOnnxLangIDTests: XCTestCase {
  12 +
  13 + override func setUpWithError() throws {
  14 + // Put setup code here. This method is called before the invocation of each test method in the class.
  15 + }
  16 +
  17 + override func tearDownWithError() throws {
  18 + // Put teardown code here. This method is called after the invocation of each test method in the class.
  19 + }
  20 +
  21 + func testExample() throws {
  22 + // This is an example of a functional test case.
  23 + // Use XCTAssert and related functions to verify your tests produce the correct results.
  24 + // Any test you write for XCTest can be annotated as throws and async.
  25 + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
  26 + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
  27 + }
  28 +
  29 + func testPerformanceExample() throws {
  30 + // This is an example of a performance test case.
  31 + self.measure {
  32 + // Put the code you want to measure the time of here.
  33 + }
  34 + }
  35 +
  36 +}
  1 +//
  2 +// SherpaOnnxLangIDUITests.swift
  3 +// SherpaOnnxLangIDUITests
  4 +//
  5 +// Created by knight on 2024/4/1.
  6 +//
  7 +
  8 +import XCTest
  9 +
  10 +final class SherpaOnnxLangIDUITests: XCTestCase {
  11 +
  12 + override func setUpWithError() throws {
  13 + // Put setup code here. This method is called before the invocation of each test method in the class.
  14 +
  15 + // In UI tests it is usually best to stop immediately when a failure occurs.
  16 + continueAfterFailure = false
  17 +
  18 + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
  19 + }
  20 +
  21 + override func tearDownWithError() throws {
  22 + // Put teardown code here. This method is called after the invocation of each test method in the class.
  23 + }
  24 +
  25 + func testExample() throws {
  26 + // UI tests must launch the application that they test.
  27 + let app = XCUIApplication()
  28 + app.launch()
  29 +
  30 + // Use XCTAssert and related functions to verify your tests produce the correct results.
  31 + }
  32 +
  33 + func testLaunchPerformance() throws {
  34 + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
  35 + // This measures how long it takes to launch your application.
  36 + measure(metrics: [XCTApplicationLaunchMetric()]) {
  37 + XCUIApplication().launch()
  38 + }
  39 + }
  40 + }
  41 +}
  1 +//
  2 +// SherpaOnnxLangIDUITestsLaunchTests.swift
  3 +// SherpaOnnxLangIDUITests
  4 +//
  5 +// Created by knight on 2024/4/1.
  6 +//
  7 +
  8 +import XCTest
  9 +
  10 +final class SherpaOnnxLangIDUITestsLaunchTests: XCTestCase {
  11 +
  12 + override class var runsForEachTargetApplicationUIConfiguration: Bool {
  13 + true
  14 + }
  15 +
  16 + override func setUpWithError() throws {
  17 + continueAfterFailure = false
  18 + }
  19 +
  20 + func testLaunch() throws {
  21 + let app = XCUIApplication()
  22 + app.launch()
  23 +
  24 + // Insert steps here to perform after app launch but before taking a screenshot,
  25 + // such as logging into a test account or navigating somewhere in the app
  26 +
  27 + let attachment = XCTAttachment(screenshot: app.screenshot())
  28 + attachment.name = "Launch Screen"
  29 + attachment.lifetime = .keepAlways
  30 + add(attachment)
  31 + }
  32 +}