├── .gitignore ├── .vscode └── settings.json ├── README.md ├── deepspeech_flutter ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android │ ├── .gitignore │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── libs │ │ ├── arm64-v8a │ │ │ ├── libdeepspeech.so │ │ │ └── libdeepspeechlibc.so │ │ └── armeabi-v7a │ │ │ ├── libdeepspeech.so │ │ │ └── libdeepspeechlibc.so │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── com │ │ └── example │ │ └── deepspeech_flutter │ │ └── DeepspeechFlutterPlugin.kt ├── deepspeech_flutter.iml ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ └── res │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── assets │ │ ├── deepspeech-0.9.3-models.tflite │ │ └── new-home-in-the-stars-16k.wav │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── Runner-Bridging-Header.h │ ├── lib │ │ └── main.dart │ ├── pubspec.lock │ ├── pubspec.yaml │ └── test │ │ └── widget_test.dart ├── ios │ ├── .gitignore │ ├── Assets │ │ └── .gitkeep │ ├── Classes │ │ ├── DeepspeechFlutterPlugin.h │ │ ├── DeepspeechFlutterPlugin.m │ │ ├── SwiftDeepspeechFlutterPlugin.swift │ │ └── libc_deepspeech.h │ ├── Frameworks │ │ └── deepspeech_ios.framework │ │ │ └── deepspeech_ios │ ├── deepspeech_flutter.podspec │ └── libs │ │ └── arm64 │ │ └── libdeepspeechlibc.a ├── lib │ └── deepspeech_flutter.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── deepspeech_flutter_test.dart ├── libc_deepspeech ├── .gitignore ├── build │ ├── android │ │ └── CMakeLists.txt │ ├── bin │ │ ├── android │ │ │ ├── arm64-v8a │ │ │ │ └── libdeepspeechlibc.so │ │ │ └── armeabi-v7a │ │ │ │ └── libdeepspeechlibc.so │ │ └── ios │ │ │ └── Release-iphoneos │ │ │ └── libdeepspeechlibc.a │ └── ios │ │ ├── CMakeLists.txt │ │ └── ios.toolchain.cmake ├── libc_deepspeech.cpp └── libc_deepspeech.h └── libdeepspeech_0.9.3 ├── android ├── arm64-v8a │ └── libdeepspeech.so └── armeabi-v7a │ └── libdeepspeech.so ├── deepspeech.h └── deepspeech_ios.framework └── deepspeech_ios /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "libc_deepspeech.h": "c", 4 | "deepspeech.h": "c", 5 | "__bit_reference": "cpp", 6 | "__config": "cpp", 7 | "__debug": "cpp", 8 | "__errc": "cpp", 9 | "__functional_base": "cpp", 10 | "__hash_table": "cpp", 11 | "__locale": "cpp", 12 | "__mutex_base": "cpp", 13 | "__node_handle": "cpp", 14 | "__nullptr": "cpp", 15 | "__split_buffer": "cpp", 16 | "__string": "cpp", 17 | "__threading_support": "cpp", 18 | "__tuple": "cpp", 19 | "algorithm": "cpp", 20 | "array": "cpp", 21 | "atomic": "cpp", 22 | "bit": "cpp", 23 | "bitset": "cpp", 24 | "cctype": "cpp", 25 | "chrono": "cpp", 26 | "cmath": "cpp", 27 | "complex": "cpp", 28 | "cstdarg": "cpp", 29 | "cstddef": "cpp", 30 | "cstdint": "cpp", 31 | "cstdio": "cpp", 32 | "cstdlib": "cpp", 33 | "cstring": "cpp", 34 | "ctime": "cpp", 35 | "cwchar": "cpp", 36 | "cwctype": "cpp", 37 | "exception": "cpp", 38 | "functional": "cpp", 39 | "initializer_list": "cpp", 40 | "ios": "cpp", 41 | "iosfwd": "cpp", 42 | "iostream": "cpp", 43 | "istream": "cpp", 44 | "iterator": "cpp", 45 | "limits": "cpp", 46 | "locale": "cpp", 47 | "memory": "cpp", 48 | "mutex": "cpp", 49 | "new": "cpp", 50 | "optional": "cpp", 51 | "ostream": "cpp", 52 | "ratio": "cpp", 53 | "sstream": "cpp", 54 | "stdexcept": "cpp", 55 | "streambuf": "cpp", 56 | "string": "cpp", 57 | "string_view": "cpp", 58 | "system_error": "cpp", 59 | "tuple": "cpp", 60 | "type_traits": "cpp", 61 | "typeinfo": "cpp", 62 | "unordered_map": "cpp", 63 | "unordered_set": "cpp", 64 | "utility": "cpp", 65 | "vector": "cpp" 66 | } 67 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mozilla DeepSpeech Flutter 2 | 3 | This is an example repo for the article [Mozilla DeepSpeech Engine in Flutter Using Dart FFI](https://techblog.geekyants.com/mozilla-deepspeech-engine-in-flutter-using-dart-ffi) 4 | 5 | - [libdeepspeech_0.9.3](./libdeepspeech_0.9.3) contains android arm64-v8a and armeabi-v7a shared libraries and iOS static framework for DeepSpeech 0.9.3. 6 | 7 | - [libc_deepspeech](./libc_deepspeech) is the C library built for the flutter plugin. 8 | 9 | - [deepspeech_flutter](,.deepspeech_flutter) is the flutter plugin that integrates the above C library. 10 | 11 | 12 | **Note:** Please try the example app on *physical devices* only. Binaries for simulators are not present in example app. -------------------------------------------------------------------------------- /deepspeech_flutter/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | .idea/ -------------------------------------------------------------------------------- /deepspeech_flutter/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 9b2d32b605630f28625709ebd9d78ab3016b2bf6 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /deepspeech_flutter/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /deepspeech_flutter/LICENSE: -------------------------------------------------------------------------------- 1 | TODO: Add your license here. 2 | -------------------------------------------------------------------------------- /deepspeech_flutter/README.md: -------------------------------------------------------------------------------- 1 | # deepspeech_flutter 2 | 3 | A new flutter plugin project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter 8 | [plug-in package](https://flutter.dev/developing-packages/), 9 | a specialized package that includes platform-specific implementation code for 10 | Android and/or iOS. 11 | 12 | For help getting started with Flutter, view our 13 | [online documentation](https://flutter.dev/docs), which offers tutorials, 14 | samples, guidance on mobile development, and a full API reference. 15 | 16 | -------------------------------------------------------------------------------- /deepspeech_flutter/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /deepspeech_flutter/android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.example.deepspeech_flutter' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.3.50' 6 | repositories { 7 | google() 8 | jcenter() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.5.0' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | rootProject.allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | compileSdkVersion 29 29 | 30 | sourceSets { 31 | main.java.srcDirs += 'src/main/kotlin' 32 | main.jniLibs.srcDir "${project.projectDir.path}/libs" 33 | } 34 | defaultConfig { 35 | minSdkVersion 16 36 | } 37 | lintOptions { 38 | disable 'InvalidPackage' 39 | } 40 | } 41 | 42 | dependencies { 43 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 44 | } 45 | -------------------------------------------------------------------------------- /deepspeech_flutter/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /deepspeech_flutter/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 6 | -------------------------------------------------------------------------------- /deepspeech_flutter/android/libs/arm64-v8a/libdeepspeech.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/android/libs/arm64-v8a/libdeepspeech.so -------------------------------------------------------------------------------- /deepspeech_flutter/android/libs/arm64-v8a/libdeepspeechlibc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/android/libs/arm64-v8a/libdeepspeechlibc.so -------------------------------------------------------------------------------- /deepspeech_flutter/android/libs/armeabi-v7a/libdeepspeech.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/android/libs/armeabi-v7a/libdeepspeech.so -------------------------------------------------------------------------------- /deepspeech_flutter/android/libs/armeabi-v7a/libdeepspeechlibc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/android/libs/armeabi-v7a/libdeepspeechlibc.so -------------------------------------------------------------------------------- /deepspeech_flutter/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'deepspeech_flutter' 2 | -------------------------------------------------------------------------------- /deepspeech_flutter/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /deepspeech_flutter/android/src/main/kotlin/com/example/deepspeech_flutter/DeepspeechFlutterPlugin.kt: -------------------------------------------------------------------------------- 1 | package com.example.deepspeech_flutter 2 | 3 | import androidx.annotation.NonNull 4 | 5 | import io.flutter.embedding.engine.plugins.FlutterPlugin 6 | import io.flutter.plugin.common.MethodCall 7 | import io.flutter.plugin.common.MethodChannel 8 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 9 | import io.flutter.plugin.common.MethodChannel.Result 10 | import io.flutter.plugin.common.PluginRegistry.Registrar 11 | 12 | /** DeepspeechFlutterPlugin */ 13 | class DeepspeechFlutterPlugin: FlutterPlugin, MethodCallHandler { 14 | /// The MethodChannel that will the communication between Flutter and native Android 15 | /// 16 | /// This local reference serves to register the plugin with the Flutter Engine and unregister it 17 | /// when the Flutter Engine is detached from the Activity 18 | private lateinit var channel : MethodChannel 19 | 20 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 21 | channel = MethodChannel(flutterPluginBinding.binaryMessenger, "deepspeech_flutter") 22 | channel.setMethodCallHandler(this) 23 | } 24 | 25 | override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { 26 | if (call.method == "getPlatformVersion") { 27 | result.success("Android ${android.os.Build.VERSION.RELEASE}") 28 | } else { 29 | result.notImplemented() 30 | } 31 | } 32 | 33 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { 34 | channel.setMethodCallHandler(null) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /deepspeech_flutter/deepspeech_flutter.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 9b2d32b605630f28625709ebd9d78ab3016b2bf6 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/README.md: -------------------------------------------------------------------------------- 1 | # deepspeech_flutter_example 2 | 3 | Demonstrates how to use the deepspeech_flutter plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 29 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.deepspeech_flutter_example" 42 | minSdkVersion 16 43 | targetSdkVersion 29 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.21' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/assets/deepspeech-0.9.3-models.tflite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/assets/deepspeech-0.9.3-models.tflite -------------------------------------------------------------------------------- /deepspeech_flutter/example/assets/new-home-in-the-stars-16k.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/assets/new-home-in-the-stars-16k.wav -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - deepspeech_flutter (0.0.1): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | - path_provider (0.0.1): 6 | - Flutter 7 | 8 | DEPENDENCIES: 9 | - deepspeech_flutter (from `.symlinks/plugins/deepspeech_flutter/ios`) 10 | - Flutter (from `Flutter`) 11 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 12 | 13 | EXTERNAL SOURCES: 14 | deepspeech_flutter: 15 | :path: ".symlinks/plugins/deepspeech_flutter/ios" 16 | Flutter: 17 | :path: Flutter 18 | path_provider: 19 | :path: ".symlinks/plugins/path_provider/ios" 20 | 21 | SPEC CHECKSUMS: 22 | deepspeech_flutter: 90e704ba0b2ecd97eae34d736f13f2bbec162cec 23 | Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c 24 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c 25 | 26 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 27 | 28 | COCOAPODS: 1.10.1 29 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | F24AF12CFA5E1567B9EAC66C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2BEA051ECAC3BF741CE0A63 /* Pods_Runner.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 21 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 22 | 217BF6E5260FCC590047159E /* deepspeech_flutter.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = deepspeech_flutter.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 24 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 25 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 27 | 8FAD4B50907513527DA9D021 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 28 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 29 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 30 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 32 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 33 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 34 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 982686D7395160186AC95C4B /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 36 | A2BEA051ECAC3BF741CE0A63 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | B4B555429CAFA9B7D6145C19 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 38 | /* End PBXFileReference section */ 39 | 40 | /* Begin PBXFrameworksBuildPhase section */ 41 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | F24AF12CFA5E1567B9EAC66C /* Pods_Runner.framework in Frameworks */, 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXFrameworksBuildPhase section */ 50 | 51 | /* Begin PBXGroup section */ 52 | 7DE81B154F57E6A5BA8F82B7 /* Pods */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 982686D7395160186AC95C4B /* Pods-Runner.debug.xcconfig */, 56 | B4B555429CAFA9B7D6145C19 /* Pods-Runner.release.xcconfig */, 57 | 8FAD4B50907513527DA9D021 /* Pods-Runner.profile.xcconfig */, 58 | ); 59 | path = Pods; 60 | sourceTree = ""; 61 | }; 62 | 9740EEB11CF90186004384FC /* Flutter */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 66 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 67 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 68 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 69 | ); 70 | name = Flutter; 71 | sourceTree = ""; 72 | }; 73 | 97C146E51CF9000F007C117D = { 74 | isa = PBXGroup; 75 | children = ( 76 | 9740EEB11CF90186004384FC /* Flutter */, 77 | 97C146F01CF9000F007C117D /* Runner */, 78 | 97C146EF1CF9000F007C117D /* Products */, 79 | 7DE81B154F57E6A5BA8F82B7 /* Pods */, 80 | CFDFB32FDD20ECCC77C4966A /* Frameworks */, 81 | ); 82 | sourceTree = ""; 83 | }; 84 | 97C146EF1CF9000F007C117D /* Products */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 97C146EE1CF9000F007C117D /* Runner.app */, 88 | ); 89 | name = Products; 90 | sourceTree = ""; 91 | }; 92 | 97C146F01CF9000F007C117D /* Runner */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 96 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 98 | 97C147021CF9000F007C117D /* Info.plist */, 99 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 100 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 101 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 102 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 103 | ); 104 | path = Runner; 105 | sourceTree = ""; 106 | }; 107 | CFDFB32FDD20ECCC77C4966A /* Frameworks */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 217BF6E5260FCC590047159E /* deepspeech_flutter.framework */, 111 | A2BEA051ECAC3BF741CE0A63 /* Pods_Runner.framework */, 112 | ); 113 | name = Frameworks; 114 | sourceTree = ""; 115 | }; 116 | /* End PBXGroup section */ 117 | 118 | /* Begin PBXNativeTarget section */ 119 | 97C146ED1CF9000F007C117D /* Runner */ = { 120 | isa = PBXNativeTarget; 121 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 122 | buildPhases = ( 123 | 4D8FFEF3FFA6C2D30A685919 /* [CP] Check Pods Manifest.lock */, 124 | 9740EEB61CF901F6004384FC /* Run Script */, 125 | 97C146EA1CF9000F007C117D /* Sources */, 126 | 97C146EB1CF9000F007C117D /* Frameworks */, 127 | 97C146EC1CF9000F007C117D /* Resources */, 128 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 129 | 493A7E4B503662B4FEC9FB7F /* [CP] Embed Pods Frameworks */, 130 | ); 131 | buildRules = ( 132 | ); 133 | dependencies = ( 134 | ); 135 | name = Runner; 136 | productName = Runner; 137 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 138 | productType = "com.apple.product-type.application"; 139 | }; 140 | /* End PBXNativeTarget section */ 141 | 142 | /* Begin PBXProject section */ 143 | 97C146E61CF9000F007C117D /* Project object */ = { 144 | isa = PBXProject; 145 | attributes = { 146 | LastUpgradeCheck = 1020; 147 | ORGANIZATIONNAME = ""; 148 | TargetAttributes = { 149 | 97C146ED1CF9000F007C117D = { 150 | CreatedOnToolsVersion = 7.3.1; 151 | LastSwiftMigration = 1100; 152 | }; 153 | }; 154 | }; 155 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 156 | compatibilityVersion = "Xcode 9.3"; 157 | developmentRegion = en; 158 | hasScannedForEncodings = 0; 159 | knownRegions = ( 160 | en, 161 | Base, 162 | ); 163 | mainGroup = 97C146E51CF9000F007C117D; 164 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 165 | projectDirPath = ""; 166 | projectRoot = ""; 167 | targets = ( 168 | 97C146ED1CF9000F007C117D /* Runner */, 169 | ); 170 | }; 171 | /* End PBXProject section */ 172 | 173 | /* Begin PBXResourcesBuildPhase section */ 174 | 97C146EC1CF9000F007C117D /* Resources */ = { 175 | isa = PBXResourcesBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 179 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 180 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 181 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 182 | ); 183 | runOnlyForDeploymentPostprocessing = 0; 184 | }; 185 | /* End PBXResourcesBuildPhase section */ 186 | 187 | /* Begin PBXShellScriptBuildPhase section */ 188 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 189 | isa = PBXShellScriptBuildPhase; 190 | buildActionMask = 2147483647; 191 | files = ( 192 | ); 193 | inputPaths = ( 194 | ); 195 | name = "Thin Binary"; 196 | outputPaths = ( 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | shellPath = /bin/sh; 200 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 201 | }; 202 | 493A7E4B503662B4FEC9FB7F /* [CP] Embed Pods Frameworks */ = { 203 | isa = PBXShellScriptBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | ); 207 | inputFileListPaths = ( 208 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 209 | ); 210 | name = "[CP] Embed Pods Frameworks"; 211 | outputFileListPaths = ( 212 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | shellPath = /bin/sh; 216 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 217 | showEnvVarsInLog = 0; 218 | }; 219 | 4D8FFEF3FFA6C2D30A685919 /* [CP] Check Pods Manifest.lock */ = { 220 | isa = PBXShellScriptBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | inputFileListPaths = ( 225 | ); 226 | inputPaths = ( 227 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 228 | "${PODS_ROOT}/Manifest.lock", 229 | ); 230 | name = "[CP] Check Pods Manifest.lock"; 231 | outputFileListPaths = ( 232 | ); 233 | outputPaths = ( 234 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | shellPath = /bin/sh; 238 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 239 | showEnvVarsInLog = 0; 240 | }; 241 | 9740EEB61CF901F6004384FC /* Run Script */ = { 242 | isa = PBXShellScriptBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | inputPaths = ( 247 | ); 248 | name = "Run Script"; 249 | outputPaths = ( 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | shellPath = /bin/sh; 253 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 254 | }; 255 | /* End PBXShellScriptBuildPhase section */ 256 | 257 | /* Begin PBXSourcesBuildPhase section */ 258 | 97C146EA1CF9000F007C117D /* Sources */ = { 259 | isa = PBXSourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 263 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | /* End PBXSourcesBuildPhase section */ 268 | 269 | /* Begin PBXVariantGroup section */ 270 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 271 | isa = PBXVariantGroup; 272 | children = ( 273 | 97C146FB1CF9000F007C117D /* Base */, 274 | ); 275 | name = Main.storyboard; 276 | sourceTree = ""; 277 | }; 278 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 279 | isa = PBXVariantGroup; 280 | children = ( 281 | 97C147001CF9000F007C117D /* Base */, 282 | ); 283 | name = LaunchScreen.storyboard; 284 | sourceTree = ""; 285 | }; 286 | /* End PBXVariantGroup section */ 287 | 288 | /* Begin XCBuildConfiguration section */ 289 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ALWAYS_SEARCH_USER_PATHS = NO; 293 | CLANG_ANALYZER_NONNULL = YES; 294 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 295 | CLANG_CXX_LIBRARY = "libc++"; 296 | CLANG_ENABLE_MODULES = YES; 297 | CLANG_ENABLE_OBJC_ARC = YES; 298 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 299 | CLANG_WARN_BOOL_CONVERSION = YES; 300 | CLANG_WARN_COMMA = YES; 301 | CLANG_WARN_CONSTANT_CONVERSION = YES; 302 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 303 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 304 | CLANG_WARN_EMPTY_BODY = YES; 305 | CLANG_WARN_ENUM_CONVERSION = YES; 306 | CLANG_WARN_INFINITE_RECURSION = YES; 307 | CLANG_WARN_INT_CONVERSION = YES; 308 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 309 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 310 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 311 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 312 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 313 | CLANG_WARN_STRICT_PROTOTYPES = YES; 314 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 315 | CLANG_WARN_UNREACHABLE_CODE = YES; 316 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 317 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 318 | COPY_PHASE_STRIP = NO; 319 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 320 | ENABLE_NS_ASSERTIONS = NO; 321 | ENABLE_STRICT_OBJC_MSGSEND = YES; 322 | GCC_C_LANGUAGE_STANDARD = gnu99; 323 | GCC_NO_COMMON_BLOCKS = YES; 324 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 325 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 326 | GCC_WARN_UNDECLARED_SELECTOR = YES; 327 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 328 | GCC_WARN_UNUSED_FUNCTION = YES; 329 | GCC_WARN_UNUSED_VARIABLE = YES; 330 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 331 | MTL_ENABLE_DEBUG_INFO = NO; 332 | SDKROOT = iphoneos; 333 | SUPPORTED_PLATFORMS = iphoneos; 334 | TARGETED_DEVICE_FAMILY = "1,2"; 335 | VALIDATE_PRODUCT = YES; 336 | }; 337 | name = Profile; 338 | }; 339 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 340 | isa = XCBuildConfiguration; 341 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 342 | buildSettings = { 343 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 344 | CLANG_ENABLE_MODULES = YES; 345 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 346 | DEVELOPMENT_TEAM = 3F25347H8E; 347 | ENABLE_BITCODE = NO; 348 | FRAMEWORK_SEARCH_PATHS = ( 349 | "$(inherited)", 350 | "$(PROJECT_DIR)/Flutter", 351 | ); 352 | INFOPLIST_FILE = Runner/Info.plist; 353 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 354 | LD_RUNPATH_SEARCH_PATHS = ( 355 | "$(inherited)", 356 | "@executable_path/Frameworks", 357 | ); 358 | LIBRARY_SEARCH_PATHS = ( 359 | "$(inherited)", 360 | "$(PROJECT_DIR)/Flutter", 361 | ); 362 | PRODUCT_BUNDLE_IDENTIFIER = com.example.deepspeechFlutterExample; 363 | PRODUCT_NAME = "$(TARGET_NAME)"; 364 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 365 | SWIFT_VERSION = 5.0; 366 | VERSIONING_SYSTEM = "apple-generic"; 367 | }; 368 | name = Profile; 369 | }; 370 | 97C147031CF9000F007C117D /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ALWAYS_SEARCH_USER_PATHS = NO; 374 | CLANG_ANALYZER_NONNULL = YES; 375 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 376 | CLANG_CXX_LIBRARY = "libc++"; 377 | CLANG_ENABLE_MODULES = YES; 378 | CLANG_ENABLE_OBJC_ARC = YES; 379 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 380 | CLANG_WARN_BOOL_CONVERSION = YES; 381 | CLANG_WARN_COMMA = YES; 382 | CLANG_WARN_CONSTANT_CONVERSION = YES; 383 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 384 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 385 | CLANG_WARN_EMPTY_BODY = YES; 386 | CLANG_WARN_ENUM_CONVERSION = YES; 387 | CLANG_WARN_INFINITE_RECURSION = YES; 388 | CLANG_WARN_INT_CONVERSION = YES; 389 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 390 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 391 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 392 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 393 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 394 | CLANG_WARN_STRICT_PROTOTYPES = YES; 395 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 396 | CLANG_WARN_UNREACHABLE_CODE = YES; 397 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 398 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 399 | COPY_PHASE_STRIP = NO; 400 | DEBUG_INFORMATION_FORMAT = dwarf; 401 | ENABLE_STRICT_OBJC_MSGSEND = YES; 402 | ENABLE_TESTABILITY = YES; 403 | GCC_C_LANGUAGE_STANDARD = gnu99; 404 | GCC_DYNAMIC_NO_PIC = NO; 405 | GCC_NO_COMMON_BLOCKS = YES; 406 | GCC_OPTIMIZATION_LEVEL = 0; 407 | GCC_PREPROCESSOR_DEFINITIONS = ( 408 | "DEBUG=1", 409 | "$(inherited)", 410 | ); 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 418 | MTL_ENABLE_DEBUG_INFO = YES; 419 | ONLY_ACTIVE_ARCH = YES; 420 | SDKROOT = iphoneos; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | }; 423 | name = Debug; 424 | }; 425 | 97C147041CF9000F007C117D /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ALWAYS_SEARCH_USER_PATHS = NO; 429 | CLANG_ANALYZER_NONNULL = YES; 430 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 431 | CLANG_CXX_LIBRARY = "libc++"; 432 | CLANG_ENABLE_MODULES = YES; 433 | CLANG_ENABLE_OBJC_ARC = YES; 434 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 435 | CLANG_WARN_BOOL_CONVERSION = YES; 436 | CLANG_WARN_COMMA = YES; 437 | CLANG_WARN_CONSTANT_CONVERSION = YES; 438 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 439 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 440 | CLANG_WARN_EMPTY_BODY = YES; 441 | CLANG_WARN_ENUM_CONVERSION = YES; 442 | CLANG_WARN_INFINITE_RECURSION = YES; 443 | CLANG_WARN_INT_CONVERSION = YES; 444 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 445 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 446 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 447 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 448 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 449 | CLANG_WARN_STRICT_PROTOTYPES = YES; 450 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 451 | CLANG_WARN_UNREACHABLE_CODE = YES; 452 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 453 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 454 | COPY_PHASE_STRIP = NO; 455 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 456 | ENABLE_NS_ASSERTIONS = NO; 457 | ENABLE_STRICT_OBJC_MSGSEND = YES; 458 | GCC_C_LANGUAGE_STANDARD = gnu99; 459 | GCC_NO_COMMON_BLOCKS = YES; 460 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 461 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 462 | GCC_WARN_UNDECLARED_SELECTOR = YES; 463 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 464 | GCC_WARN_UNUSED_FUNCTION = YES; 465 | GCC_WARN_UNUSED_VARIABLE = YES; 466 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 467 | MTL_ENABLE_DEBUG_INFO = NO; 468 | SDKROOT = iphoneos; 469 | SUPPORTED_PLATFORMS = iphoneos; 470 | SWIFT_COMPILATION_MODE = wholemodule; 471 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 472 | TARGETED_DEVICE_FAMILY = "1,2"; 473 | VALIDATE_PRODUCT = YES; 474 | }; 475 | name = Release; 476 | }; 477 | 97C147061CF9000F007C117D /* Debug */ = { 478 | isa = XCBuildConfiguration; 479 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 480 | buildSettings = { 481 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 482 | CLANG_ENABLE_MODULES = YES; 483 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 484 | DEVELOPMENT_TEAM = 3F25347H8E; 485 | ENABLE_BITCODE = NO; 486 | FRAMEWORK_SEARCH_PATHS = ( 487 | "$(inherited)", 488 | "$(PROJECT_DIR)/Flutter", 489 | ); 490 | INFOPLIST_FILE = Runner/Info.plist; 491 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 492 | LD_RUNPATH_SEARCH_PATHS = ( 493 | "$(inherited)", 494 | "@executable_path/Frameworks", 495 | ); 496 | LIBRARY_SEARCH_PATHS = ( 497 | "$(inherited)", 498 | "$(PROJECT_DIR)/Flutter", 499 | ); 500 | PRODUCT_BUNDLE_IDENTIFIER = com.example.deepspeechFlutterExample; 501 | PRODUCT_NAME = "$(TARGET_NAME)"; 502 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 503 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 504 | SWIFT_VERSION = 5.0; 505 | VERSIONING_SYSTEM = "apple-generic"; 506 | }; 507 | name = Debug; 508 | }; 509 | 97C147071CF9000F007C117D /* Release */ = { 510 | isa = XCBuildConfiguration; 511 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 512 | buildSettings = { 513 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 514 | CLANG_ENABLE_MODULES = YES; 515 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 516 | DEVELOPMENT_TEAM = 3F25347H8E; 517 | ENABLE_BITCODE = NO; 518 | FRAMEWORK_SEARCH_PATHS = ( 519 | "$(inherited)", 520 | "$(PROJECT_DIR)/Flutter", 521 | ); 522 | INFOPLIST_FILE = Runner/Info.plist; 523 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 524 | LD_RUNPATH_SEARCH_PATHS = ( 525 | "$(inherited)", 526 | "@executable_path/Frameworks", 527 | ); 528 | LIBRARY_SEARCH_PATHS = ( 529 | "$(inherited)", 530 | "$(PROJECT_DIR)/Flutter", 531 | ); 532 | PRODUCT_BUNDLE_IDENTIFIER = com.example.deepspeechFlutterExample; 533 | PRODUCT_NAME = "$(TARGET_NAME)"; 534 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 535 | SWIFT_VERSION = 5.0; 536 | VERSIONING_SYSTEM = "apple-generic"; 537 | }; 538 | name = Release; 539 | }; 540 | /* End XCBuildConfiguration section */ 541 | 542 | /* Begin XCConfigurationList section */ 543 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 544 | isa = XCConfigurationList; 545 | buildConfigurations = ( 546 | 97C147031CF9000F007C117D /* Debug */, 547 | 97C147041CF9000F007C117D /* Release */, 548 | 249021D3217E4FDB00AE95B9 /* Profile */, 549 | ); 550 | defaultConfigurationIsVisible = 0; 551 | defaultConfigurationName = Release; 552 | }; 553 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 554 | isa = XCConfigurationList; 555 | buildConfigurations = ( 556 | 97C147061CF9000F007C117D /* Debug */, 557 | 97C147071CF9000F007C117D /* Release */, 558 | 249021D4217E4FDB00AE95B9 /* Profile */, 559 | ); 560 | defaultConfigurationIsVisible = 0; 561 | defaultConfigurationName = Release; 562 | }; 563 | /* End XCConfigurationList section */ 564 | }; 565 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 566 | } 567 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | deepspeech_flutter_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | import 'dart:typed_data'; 4 | 5 | import 'package:flutter/material.dart'; 6 | import 'package:deepspeech_flutter/deepspeech_flutter.dart'; 7 | import 'package:flutter/services.dart'; 8 | import 'package:path_provider/path_provider.dart'; 9 | 10 | void main() { 11 | runApp(MyApp()); 12 | } 13 | 14 | class MyApp extends StatefulWidget { 15 | @override 16 | _MyAppState createState() => _MyAppState(); 17 | } 18 | 19 | class _MyAppState extends State { 20 | final _deepspeech = DeepspeechFlutter(); 21 | int _sampleRate = 0; 22 | String? _processedText; 23 | Uint8List? _wavFile; 24 | bool _wavFileLoaded = false; 25 | 26 | @override 27 | void initState() { 28 | super.initState(); 29 | _loadModel(); 30 | } 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return MaterialApp( 35 | home: Scaffold( 36 | appBar: AppBar( 37 | title: const Text('Mozilla DeepSpeech Example'), 38 | ), 39 | body: Center( 40 | child: Column( 41 | crossAxisAlignment: CrossAxisAlignment.center, 42 | children: [ 43 | SizedBox(height: 40), 44 | Text('DeepSpeech Version: ${_deepspeech.getVersion()}', 45 | style: TextStyle(fontSize: 20)), 46 | SizedBox(height: 40), 47 | Text('Model Sample Rate: $_sampleRate', 48 | style: TextStyle(fontSize: 20)), 49 | SizedBox(height: 40), 50 | OutlinedButton( 51 | child: Text('Load WAV File'), 52 | onPressed: _loadWavFile, 53 | ), 54 | SizedBox(height: 40), 55 | if (_wavFileLoaded) ...[ 56 | Text('Loaded: new-home-in-the-stars-16k.wav'), 57 | SizedBox(height: 10), 58 | OutlinedButton( 59 | child: Text('Run Speech To Text'), 60 | onPressed: _runSpeechToText, 61 | ), 62 | ], 63 | SizedBox(height: 40), 64 | if (_processedText != null) ...[ 65 | Text( 66 | 'Converted Speech to Text:', 67 | style: TextStyle(fontSize: 20), 68 | ), 69 | // SizedBox(height: 30), 70 | Padding( 71 | padding: const EdgeInsets.all(20.0), 72 | child: Text(_processedText!, 73 | style: 74 | TextStyle(fontSize: 30, fontStyle: FontStyle.italic)), 75 | ), 76 | ], 77 | ], 78 | ), 79 | ), 80 | ), 81 | ); 82 | } 83 | 84 | // Load deepspeech english pre-trained model. 85 | Future _loadModel() async { 86 | final bytes = 87 | await rootBundle.load('assets/deepspeech-0.9.3-models.tflite'); 88 | final directory = (await getApplicationDocumentsDirectory()).path; 89 | final buffer = bytes.buffer; 90 | final path = '$directory/deepspeech-0.9.3-models.tflite'; 91 | await File(path).writeAsBytes( 92 | buffer.asUint8List(bytes.offsetInBytes, bytes.lengthInBytes)); 93 | 94 | _deepspeech.createModel(path); 95 | 96 | setState(() { 97 | _sampleRate = _deepspeech.getSampleRate(); 98 | }); 99 | } 100 | 101 | Future _loadWavFile() async { 102 | final bytes = await rootBundle.load('assets/new-home-in-the-stars-16k.wav'); 103 | _wavFile = bytes.buffer.asUint8List(); 104 | 105 | setState(() { 106 | _wavFileLoaded = true; 107 | }); 108 | } 109 | 110 | void _runSpeechToText() async { 111 | if (_wavFile != null) { 112 | final _result = _deepspeech.speechToText(_wavFile!); 113 | 114 | setState(() { 115 | _processedText = _result; 116 | }); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.8.2" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.0.4" 53 | deepspeech_flutter: 54 | dependency: "direct main" 55 | description: 56 | path: ".." 57 | relative: true 58 | source: path 59 | version: "0.0.1" 60 | fake_async: 61 | dependency: transitive 62 | description: 63 | name: fake_async 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.2.0" 67 | ffi: 68 | dependency: transitive 69 | description: 70 | name: ffi 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.2.1" 74 | file: 75 | dependency: transitive 76 | description: 77 | name: file 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "6.1.2" 81 | flutter: 82 | dependency: "direct main" 83 | description: flutter 84 | source: sdk 85 | version: "0.0.0" 86 | flutter_test: 87 | dependency: "direct dev" 88 | description: flutter 89 | source: sdk 90 | version: "0.0.0" 91 | matcher: 92 | dependency: transitive 93 | description: 94 | name: matcher 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "0.12.11" 98 | material_color_utilities: 99 | dependency: transitive 100 | description: 101 | name: material_color_utilities 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "0.1.3" 105 | meta: 106 | dependency: transitive 107 | description: 108 | name: meta 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.7.0" 112 | path: 113 | dependency: transitive 114 | description: 115 | name: path 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "1.8.0" 119 | path_provider: 120 | dependency: "direct main" 121 | description: 122 | name: path_provider 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "2.0.10" 126 | path_provider_android: 127 | dependency: transitive 128 | description: 129 | name: path_provider_android 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "2.0.14" 133 | path_provider_ios: 134 | dependency: transitive 135 | description: 136 | name: path_provider_ios 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "2.0.9" 140 | path_provider_linux: 141 | dependency: transitive 142 | description: 143 | name: path_provider_linux 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "2.1.6" 147 | path_provider_macos: 148 | dependency: transitive 149 | description: 150 | name: path_provider_macos 151 | url: "https://pub.dartlang.org" 152 | source: hosted 153 | version: "2.0.6" 154 | path_provider_platform_interface: 155 | dependency: transitive 156 | description: 157 | name: path_provider_platform_interface 158 | url: "https://pub.dartlang.org" 159 | source: hosted 160 | version: "2.0.4" 161 | path_provider_windows: 162 | dependency: transitive 163 | description: 164 | name: path_provider_windows 165 | url: "https://pub.dartlang.org" 166 | source: hosted 167 | version: "2.0.6" 168 | platform: 169 | dependency: transitive 170 | description: 171 | name: platform 172 | url: "https://pub.dartlang.org" 173 | source: hosted 174 | version: "3.1.0" 175 | plugin_platform_interface: 176 | dependency: transitive 177 | description: 178 | name: plugin_platform_interface 179 | url: "https://pub.dartlang.org" 180 | source: hosted 181 | version: "2.1.2" 182 | process: 183 | dependency: transitive 184 | description: 185 | name: process 186 | url: "https://pub.dartlang.org" 187 | source: hosted 188 | version: "4.2.4" 189 | sky_engine: 190 | dependency: transitive 191 | description: flutter 192 | source: sdk 193 | version: "0.0.99" 194 | source_span: 195 | dependency: transitive 196 | description: 197 | name: source_span 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "1.8.1" 201 | stack_trace: 202 | dependency: transitive 203 | description: 204 | name: stack_trace 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "1.10.0" 208 | stream_channel: 209 | dependency: transitive 210 | description: 211 | name: stream_channel 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "2.1.0" 215 | string_scanner: 216 | dependency: transitive 217 | description: 218 | name: string_scanner 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "1.1.0" 222 | term_glyph: 223 | dependency: transitive 224 | description: 225 | name: term_glyph 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "1.2.0" 229 | test_api: 230 | dependency: transitive 231 | description: 232 | name: test_api 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "0.4.8" 236 | typed_data: 237 | dependency: transitive 238 | description: 239 | name: typed_data 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "1.3.0" 243 | vector_math: 244 | dependency: transitive 245 | description: 246 | name: vector_math 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "2.1.1" 250 | win32: 251 | dependency: transitive 252 | description: 253 | name: win32 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "2.5.2" 257 | xdg_directories: 258 | dependency: transitive 259 | description: 260 | name: xdg_directories 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "0.2.0+1" 264 | sdks: 265 | dart: ">=2.15.0 <3.0.0" 266 | flutter: ">=2.8.1" 267 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: deepspeech_flutter_example 2 | description: Demonstrates how to use the deepspeech_flutter plugin. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 7 | 8 | environment: 9 | sdk: ">=2.12.0 <3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | path_provider: ^2.0.2 15 | 16 | deepspeech_flutter: 17 | # When depending on this package from a real application you should use: 18 | # deepspeech_flutter: ^x.y.z 19 | # See https://dart.dev/tools/pub/dependencies#version-constraints 20 | # The example app is bundled with the plugin so we use a path dependency on 21 | # the parent directory to use the current plugin's version. 22 | path: ../ 23 | 24 | # The following adds the Cupertino Icons font to your application. 25 | # Use with the CupertinoIcons class for iOS style icons. 26 | cupertino_icons: ^1.0.0 27 | 28 | dev_dependencies: 29 | flutter_test: 30 | sdk: flutter 31 | 32 | # For information on the generic Dart part of this file, see the 33 | # following page: https://dart.dev/tools/pub/pubspec 34 | 35 | # The following section is specific to Flutter. 36 | flutter: 37 | # The following line ensures that the Material Icons font is 38 | # included with your application, so that you can use the icons in 39 | # the material Icons class. 40 | uses-material-design: true 41 | 42 | # To add assets to your application, add an assets section, like this: 43 | assets: 44 | - assets/ 45 | 46 | # An image asset can refer to one or more resolution-specific "variants", see 47 | # https://flutter.dev/assets-and-images/#resolution-aware. 48 | 49 | # For details regarding adding assets from package dependencies, see 50 | # https://flutter.dev/assets-and-images/#from-packages 51 | 52 | # To add custom fonts to your application, add a fonts section here, 53 | # in this "flutter" section. Each entry in this list should have a 54 | # "family" key with the font family name, and a "fonts" key with a 55 | # list giving the asset and other descriptors for the font. For 56 | # example: 57 | # fonts: 58 | # - family: Schyler 59 | # fonts: 60 | # - asset: fonts/Schyler-Regular.ttf 61 | # - asset: fonts/Schyler-Italic.ttf 62 | # style: italic 63 | # - family: Trajan Pro 64 | # fonts: 65 | # - asset: fonts/TrajanPro.ttf 66 | # - asset: fonts/TrajanPro_Bold.ttf 67 | # weight: 700 68 | # 69 | # For details regarding fonts from package dependencies, 70 | # see https://flutter.dev/custom-fonts/#from-packages 71 | -------------------------------------------------------------------------------- /deepspeech_flutter/example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:deepspeech_flutter_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | // await tester.pumpWidget(MyApp()); 17 | 18 | // // Verify that platform version is retrieved. 19 | // expect( 20 | // find.byWidgetPredicate( 21 | // (Widget widget) => widget is Text && 22 | // widget.data.startsWith('Running on:'), 23 | // ), 24 | // findsOneWidget, 25 | // ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /deepspeech_flutter/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /deepspeech_flutter/ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /deepspeech_flutter/ios/Classes/DeepspeechFlutterPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface DeepspeechFlutterPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /deepspeech_flutter/ios/Classes/DeepspeechFlutterPlugin.m: -------------------------------------------------------------------------------- 1 | #import "DeepspeechFlutterPlugin.h" 2 | #if __has_include() 3 | #import 4 | #else 5 | // Support project import fallback if the generated compatibility header 6 | // is not copied when this plugin is created as a library. 7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 8 | #import "deepspeech_flutter-Swift.h" 9 | #endif 10 | 11 | @implementation DeepspeechFlutterPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftDeepspeechFlutterPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /deepspeech_flutter/ios/Classes/SwiftDeepspeechFlutterPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | public class SwiftDeepspeechFlutterPlugin: NSObject, FlutterPlugin { 5 | public static func register(with registrar: FlutterPluginRegistrar) { 6 | let channel = FlutterMethodChannel(name: "deepspeech_flutter", binaryMessenger: registrar.messenger()) 7 | let instance = SwiftDeepspeechFlutterPlugin() 8 | registrar.addMethodCallDelegate(instance, channel: channel) 9 | } 10 | 11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 12 | if (call.method == "temp") { 13 | let res = deepspeech_verison() 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /deepspeech_flutter/ios/Classes/libc_deepspeech.h: -------------------------------------------------------------------------------- 1 | // Include guard 2 | #pragma once 3 | 4 | // Tell compiler to retain function in object file, even if it is unreferenced. 5 | #define EXPORTED __attribute__((visibility("default"))) __attribute__((used)) 6 | 7 | // Disable name mangling for C functions. 8 | #ifdef __cplusplus 9 | extern "C" 10 | { 11 | #endif 12 | 13 | // Return the version of this library. 14 | EXPORTED char *deepspeech_verison(void); 15 | 16 | // Free string allocated by DeepSpeech library. 17 | EXPORTED void deepspeech_free_str(char *string); 18 | 19 | // Return pointer to loaded model state. 20 | EXPORTED void *create_model(char *model_path); 21 | 22 | // Free loaded model. 23 | EXPORTED void free_model(void *model_state); 24 | 25 | // Returns sample rate for loaded model 26 | EXPORTED uint64_t model_sample_rate(void *model_state); 27 | 28 | // Returns json output from speech to text engine. 29 | EXPORTED char *speech_to_text(void *model_state, char *buffer, uint64_t buffer_size); 30 | 31 | // Closing bracket for extern "C" 32 | #ifdef __cplusplus 33 | } 34 | #endif -------------------------------------------------------------------------------- /deepspeech_flutter/ios/Frameworks/deepspeech_ios.framework/deepspeech_ios: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/ios/Frameworks/deepspeech_ios.framework/deepspeech_ios -------------------------------------------------------------------------------- /deepspeech_flutter/ios/deepspeech_flutter.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint deepspeech_flutter.podspec' to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'deepspeech_flutter' 7 | s.version = '0.0.1' 8 | s.summary = 'A new flutter plugin project.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.public_header_files = 'Classes/**/*.h' 18 | s.dependency 'Flutter' 19 | s.platform = :ios, '8.0' 20 | 21 | s.ios.vendored_library = 'libs/arm64/libdeepspeechlibc.a' 22 | s.ios.vendored_frameworks = 'Frameworks/deepspeech_ios.framework' 23 | 24 | # Flutter.framework does not contain a i386 slice. 25 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386', 'OTHER_LDFLAGS' => '-lc++ -framework deepspeech_ios' } 26 | s.swift_version = '5.0' 27 | end 28 | -------------------------------------------------------------------------------- /deepspeech_flutter/ios/libs/arm64/libdeepspeechlibc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/deepspeech_flutter/ios/libs/arm64/libdeepspeechlibc.a -------------------------------------------------------------------------------- /deepspeech_flutter/lib/deepspeech_flutter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ffi'; 2 | import 'dart:io'; 3 | import 'dart:typed_data'; 4 | 5 | import 'package:ffi/ffi.dart'; 6 | 7 | typedef DSVersion = Pointer Function(); 8 | typedef DSNativeFreeStr = Void Function(Pointer); 9 | typedef DSFreeStr = void Function(Pointer); 10 | typedef CreateModel = Pointer Function(Pointer); 11 | typedef NativeFreeModel = Void Function(Pointer); 12 | typedef FreeModel = void Function(Pointer); 13 | typedef NativeModelSampleRate = Uint64 Function(Pointer); 14 | typedef ModelSampleRate = int Function(Pointer); 15 | typedef NativeSpeechToText = Pointer Function(Pointer, Pointer, Uint64); 16 | typedef SpeechToText = Pointer Function(Pointer, Pointer, int); 17 | typedef NativeEnableScorer = Int32 Function(Pointer, Pointer); 18 | typedef EnableScorer = int Function(Pointer, Pointer); 19 | typedef NativeDisableScorer = Int32 Function(Pointer); 20 | typedef DisableScorer = int Function(Pointer); 21 | typedef NativeSetScorerAlphaBeta = Int32 Function(Pointer, Float, Float); 22 | typedef SetScorerAlphaBeta = int Function(Pointer, double, double); 23 | 24 | class DeepspeechFlutter { 25 | factory DeepspeechFlutter() => _instance; 26 | static final DeepspeechFlutter _instance = DeepspeechFlutter._internal(); 27 | 28 | DeepspeechFlutter._internal() { 29 | _deepspeech = Platform.isAndroid ? DynamicLibrary.open("libdeepspeechlibc.so") : DynamicLibrary.process(); 30 | 31 | _dsVersion = _deepspeech.lookupFunction('deepspeech_verison'); 32 | _dsFreeStr = _deepspeech.lookupFunction('deepspeech_free_str'); 33 | _dsCreateModel = _deepspeech.lookupFunction('create_model'); 34 | _dsFreeModel = _deepspeech.lookupFunction('free_model'); 35 | _dsModelSampleRate = _deepspeech.lookupFunction('model_sample_rate'); 36 | _dsSpeechToText = _deepspeech.lookupFunction('speech_to_text'); 37 | _dsEnableScorer = _deepspeech.lookupFunction('enable_external_scorer'); 38 | _dsDisableScorer = _deepspeech.lookupFunction('disable_external_scorer'); 39 | _dsSetScorerAlphaBeta = 40 | _deepspeech.lookupFunction('set_scorer_alpha_beta'); 41 | } 42 | 43 | late final DynamicLibrary _deepspeech; 44 | 45 | // Reference to functions. 46 | late final DSVersion _dsVersion; 47 | late final DSFreeStr _dsFreeStr; 48 | late final CreateModel _dsCreateModel; 49 | late final FreeModel _dsFreeModel; 50 | late final ModelSampleRate _dsModelSampleRate; 51 | late final SpeechToText _dsSpeechToText; 52 | late final EnableScorer _dsEnableScorer; 53 | late final DisableScorer _dsDisableScorer; 54 | late final SetScorerAlphaBeta _dsSetScorerAlphaBeta; 55 | 56 | // Pointer to loaded model state 57 | Pointer? _modelCtxPointer; 58 | 59 | String getVersion() { 60 | Pointer _version = _dsVersion(); 61 | String value = _version.toDartString(); 62 | _dsFreeStr(_version); 63 | return value; 64 | } 65 | 66 | void createModel(String modelPath) { 67 | Pointer _modelPath = modelPath.toNativeUtf8(); 68 | _modelCtxPointer = _dsCreateModel(_modelPath); 69 | print('_modelCtxPointer: $_modelCtxPointer'); 70 | } 71 | 72 | int getSampleRate() { 73 | if (_modelCtxPointer == null || _modelCtxPointer == nullptr) { 74 | return -1; 75 | } 76 | 77 | int _sampleRate = _dsModelSampleRate(_modelCtxPointer!); 78 | return _sampleRate; 79 | } 80 | 81 | String speechToText(Uint8List samples) { 82 | Pointer samplePointer = calloc.call(samples.length); 83 | for (int index = 0; index < samples.length; index++) { 84 | samplePointer.elementAt(index).value = samples[index]; 85 | } 86 | 87 | Pointer _result = _dsSpeechToText(_modelCtxPointer!, samplePointer, samples.length); 88 | malloc.free(samplePointer); 89 | 90 | return _result.toDartString(); 91 | } 92 | 93 | int enableExternalScorer(String scorerFilePath) { 94 | Pointer _path = scorerFilePath.toNativeUtf8(); 95 | if (_modelCtxPointer == null || _modelCtxPointer == nullptr) { 96 | return -1; 97 | } 98 | 99 | int statusCode = _dsEnableScorer(_modelCtxPointer!, _path); 100 | return statusCode; 101 | } 102 | 103 | int disableExternalScorer() { 104 | if (_modelCtxPointer == null || _modelCtxPointer == nullptr) { 105 | return -1; 106 | } 107 | 108 | int statusCode = _dsDisableScorer(_modelCtxPointer!); 109 | return statusCode; 110 | } 111 | 112 | int setScorerAlphaBeta(double alpha, double beta) { 113 | if (_modelCtxPointer == null || _modelCtxPointer == nullptr) { 114 | return -1; 115 | } 116 | 117 | int statusCode = _dsSetScorerAlphaBeta(_modelCtxPointer!, alpha, beta); 118 | return statusCode; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /deepspeech_flutter/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.8.2" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.2.0" 53 | ffi: 54 | dependency: "direct main" 55 | description: 56 | name: ffi 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.1.2" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | matcher: 71 | dependency: transitive 72 | description: 73 | name: matcher 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "0.12.11" 77 | material_color_utilities: 78 | dependency: transitive 79 | description: 80 | name: material_color_utilities 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.1.3" 84 | meta: 85 | dependency: transitive 86 | description: 87 | name: meta 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.7.0" 91 | path: 92 | dependency: transitive 93 | description: 94 | name: path 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.8.0" 98 | sky_engine: 99 | dependency: transitive 100 | description: flutter 101 | source: sdk 102 | version: "0.0.99" 103 | source_span: 104 | dependency: transitive 105 | description: 106 | name: source_span 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.8.1" 110 | stack_trace: 111 | dependency: transitive 112 | description: 113 | name: stack_trace 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.10.0" 117 | stream_channel: 118 | dependency: transitive 119 | description: 120 | name: stream_channel 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "2.1.0" 124 | string_scanner: 125 | dependency: transitive 126 | description: 127 | name: string_scanner 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.1.0" 131 | term_glyph: 132 | dependency: transitive 133 | description: 134 | name: term_glyph 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.2.0" 138 | test_api: 139 | dependency: transitive 140 | description: 141 | name: test_api 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "0.4.8" 145 | typed_data: 146 | dependency: transitive 147 | description: 148 | name: typed_data 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.3.0" 152 | vector_math: 153 | dependency: transitive 154 | description: 155 | name: vector_math 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "2.1.1" 159 | sdks: 160 | dart: ">=2.14.0 <3.0.0" 161 | flutter: ">=1.20.0" 162 | -------------------------------------------------------------------------------- /deepspeech_flutter/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: deepspeech_flutter 2 | description: A new flutter plugin project. 3 | version: 0.0.1 4 | author: 5 | homepage: 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | flutter: ">=1.20.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | ffi: ^1.1.2 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | 20 | # For information on the generic Dart part of this file, see the 21 | # following page: https://dart.dev/tools/pub/pubspec 22 | 23 | # The following section is specific to Flutter. 24 | flutter: 25 | # This section identifies this Flutter project as a plugin project. 26 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily 27 | # be modified. They are used by the tooling to maintain consistency when 28 | # adding or updating assets for this project. 29 | plugin: 30 | platforms: 31 | android: 32 | package: com.example.deepspeech_flutter 33 | pluginClass: DeepspeechFlutterPlugin 34 | ios: 35 | pluginClass: DeepspeechFlutterPlugin 36 | 37 | # To add assets to your plugin package, add an assets section, like this: 38 | # assets: 39 | # - images/a_dot_burr.jpeg 40 | # - images/a_dot_ham.jpeg 41 | # 42 | # For details regarding assets in packages, see 43 | # https://flutter.dev/assets-and-images/#from-packages 44 | # 45 | # An image asset can refer to one or more resolution-specific "variants", see 46 | # https://flutter.dev/assets-and-images/#resolution-aware. 47 | 48 | # To add custom fonts to your plugin package, add a fonts section here, 49 | # in this "flutter" section. Each entry in this list should have a 50 | # "family" key with the font family name, and a "fonts" key with a 51 | # list giving the asset and other descriptors for the font. For 52 | # example: 53 | # fonts: 54 | # - family: Schyler 55 | # fonts: 56 | # - asset: fonts/Schyler-Regular.ttf 57 | # - asset: fonts/Schyler-Italic.ttf 58 | # style: italic 59 | # - family: Trajan Pro 60 | # fonts: 61 | # - asset: fonts/TrajanPro.ttf 62 | # - asset: fonts/TrajanPro_Bold.ttf 63 | # weight: 700 64 | # 65 | # For details regarding fonts in packages, see 66 | # https://flutter.dev/custom-fonts/#from-packages 67 | -------------------------------------------------------------------------------- /deepspeech_flutter/test/deepspeech_flutter_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:deepspeech_flutter/deepspeech_flutter.dart'; 4 | 5 | void main() { 6 | const MethodChannel channel = MethodChannel('deepspeech_flutter'); 7 | 8 | TestWidgetsFlutterBinding.ensureInitialized(); 9 | 10 | setUp(() { 11 | channel.setMockMethodCallHandler((MethodCall methodCall) async { 12 | return '42'; 13 | }); 14 | }); 15 | 16 | tearDown(() { 17 | channel.setMockMethodCallHandler(null); 18 | }); 19 | 20 | // test('getPlatformVersion', () async { 21 | // expect(await DeepspeechFlutter.platformVersion, '42'); 22 | // }); 23 | } 24 | -------------------------------------------------------------------------------- /libc_deepspeech/.gitignore: -------------------------------------------------------------------------------- 1 | CMakeFiles/ 2 | *.cmake 3 | CMakeCache.txt 4 | Makefile 5 | CmakeScripts/ 6 | Project.build 7 | Project.xcodeproj 8 | XCBuildData/ 9 | .ninja* 10 | *.ninja 11 | .DS_Store 12 | build_files/ 13 | 14 | !ios.toolchain.cmake -------------------------------------------------------------------------------- /libc_deepspeech/build/android/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -G Ninja -DANDROID_NDK=$ANDROID_NDK -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-29 -Sandroid -Bbin/android/arm64-v8a 2 | # cmake --build bin/android/arm64-v8a 3 | 4 | # cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -G Ninja -DANDROID_NDK=$ANDROID_NDK -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-29 -Sandroid -Bbin/android/armeabi-v7a 5 | # cmake --build bin/android/armeabi-v7a 6 | 7 | cmake_minimum_required(VERSION 3.4.1) 8 | 9 | # Library source files. 10 | FILE(GLOB SRC ../../*.cpp) 11 | 12 | # Add our own library, we will call it libcdeepspeech 13 | add_library(deepspeechlibc SHARED ${SRC}) 14 | include_directories(../../) 15 | 16 | # Include DeepSpeech 0.9.3 17 | add_library(libdeepspeech SHARED IMPORTED) 18 | 19 | # Get absolute path for desired architecture 20 | get_filename_component(ABI_LIB_PATH ../../../libdeepspeech_0.9.3/android/${ANDROID_ABI}/libdeepspeech.so ABSOLUTE) 21 | 22 | set_target_properties( libdeepspeech PROPERTIES IMPORTED_LOCATION ${ABI_LIB_PATH} ) 23 | include_directories( ../../../libdeepspeech_0.9.3/ ) 24 | 25 | # Link our library with deepspeech 0.9.3 library 26 | target_link_libraries( deepspeechlibc libdeepspeech ) 27 | -------------------------------------------------------------------------------- /libc_deepspeech/build/bin/android/arm64-v8a/libdeepspeechlibc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/libc_deepspeech/build/bin/android/arm64-v8a/libdeepspeechlibc.so -------------------------------------------------------------------------------- /libc_deepspeech/build/bin/android/armeabi-v7a/libdeepspeechlibc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/libc_deepspeech/build/bin/android/armeabi-v7a/libdeepspeechlibc.so -------------------------------------------------------------------------------- /libc_deepspeech/build/bin/ios/Release-iphoneos/libdeepspeechlibc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/libc_deepspeech/build/bin/ios/Release-iphoneos/libdeepspeechlibc.a -------------------------------------------------------------------------------- /libc_deepspeech/build/ios/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # cmake -Sios -Bbin/ios -G Xcode -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DPLATFORM=OS64 2 | # cmake --build bin/ios --config Release 3 | 4 | cmake_minimum_required(VERSION 3.4.1) 5 | 6 | # Library source files. 7 | FILE(GLOB SRC ../../*.cpp) 8 | 9 | add_library(deepspeechlibc STATIC ${SRC}) 10 | include_directories(../../) 11 | 12 | # Find DeepSpeech 0.9.3 framework 13 | find_library(DEEPSPEECH_LIB NAMES deepspeech_ios HINTS "../../../libdeepspeech_0.9.3") 14 | 15 | # Link our library with DeepSpeech 0.9.3 framework 16 | target_link_libraries(deepspeechlibc ${DEEPSPEECH_LIB}) 17 | -------------------------------------------------------------------------------- /libc_deepspeech/build/ios/ios.toolchain.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of the ios-cmake project. It was retrieved from 2 | # https://github.com/cristeab/ios-cmake.git, which is a fork of 3 | # https://code.google.com/p/ios-cmake/. Which in turn is based off of 4 | # the Platform/Darwin.cmake and Platform/UnixPaths.cmake files which 5 | # are included with CMake 2.8.4 6 | # 7 | # The ios-cmake project is licensed under the new BSD license. 8 | # 9 | # Copyright (c) 2014, Bogdan Cristea and LTE Engineering Software, 10 | # Kitware, Inc., Insight Software Consortium. All rights reserved. 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 17 | # 2. Redistributions in binary form must reproduce the above copyright 18 | # notice, this list of conditions and the following disclaimer in the 19 | # documentation and/or other materials provided with the distribution. 20 | # 21 | # 3. Neither the name of the copyright holder nor the names of its 22 | # contributors may be used to endorse or promote products derived from 23 | # this software without specific prior written permission. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 28 | # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 29 | # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 30 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 31 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | # POSSIBILITY OF SUCH DAMAGE. 37 | # 38 | # This file is based off of the Platform/Darwin.cmake and 39 | # Platform/UnixPaths.cmake files which are included with CMake 2.8.4 40 | # It has been altered for iOS development. 41 | # 42 | # Updated by Alex Stewart (alexs.mac@gmail.com) 43 | # 44 | # ***************************************************************************** 45 | # Now maintained by Alexander Widerberg (widerbergaren [at] gmail.com) 46 | # under the BSD-3-Clause license 47 | # https://github.com/leetal/ios-cmake 48 | # ***************************************************************************** 49 | # 50 | # INFORMATION / HELP 51 | # 52 | # The following arguments control the behaviour of this toolchain: 53 | # 54 | # PLATFORM: (default "OS") 55 | # OS = Build for iPhoneOS. 56 | # OS64 = Build for arm64 iphoneOS. 57 | # OS64COMBINED = Build for arm64 x86_64 iphoneOS. Combined into FAT STATIC lib (supported on 3.14+ of CMakewith "-G Xcode" argument ONLY) 58 | # SIMULATOR = Build for x86 i386 iphoneOS Simulator. 59 | # SIMULATOR64 = Build for x86_64 iphoneOS Simulator. 60 | # TVOS = Build for arm64 tvOS. 61 | # TVOSCOMBINED = Build for arm64 x86_64 tvOS. Combined into FAT STATIC lib (supported on 3.14+ of CMake with "-G Xcode" argument ONLY) 62 | # SIMULATOR_TVOS = Build for x86_64 tvOS Simulator. 63 | # WATCHOS = Build for armv7k arm64_32 for watchOS. 64 | # WATCHOSCOMBINED = Build for armv7k arm64_32 x86_64 watchOS. Combined into FAT STATIC lib (supported on 3.14+ of CMake with "-G Xcode" argument ONLY) 65 | # SIMULATOR_WATCHOS = Build for x86_64 for watchOS Simulator. 66 | # 67 | # CMAKE_OSX_SYSROOT: Path to the SDK to use. By default this is 68 | # automatically determined from PLATFORM and xcodebuild, but 69 | # can also be manually specified (although this should not be required). 70 | # 71 | # CMAKE_DEVELOPER_ROOT: Path to the Developer directory for the platform 72 | # being compiled for. By default this is automatically determined from 73 | # CMAKE_OSX_SYSROOT, but can also be manually specified (although this should 74 | # not be required). 75 | # 76 | # DEPLOYMENT_TARGET: Minimum SDK version to target. Default 2.0 on watchOS and 9.0 on tvOS+iOS 77 | # 78 | # ENABLE_BITCODE: (1|0) Enables or disables bitcode support. Default 1 (true) 79 | # 80 | # ENABLE_ARC: (1|0) Enables or disables ARC support. Default 1 (true, ARC enabled by default) 81 | # 82 | # ENABLE_VISIBILITY: (1|0) Enables or disables symbol visibility support. Default 0 (false, visibility hidden by default) 83 | # 84 | # ENABLE_STRICT_TRY_COMPILE: (1|0) Enables or disables strict try_compile() on all Check* directives (will run linker 85 | # to actually check if linking is possible). Default 0 (false, will set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY) 86 | # 87 | # ARCHS: (armv7 armv7s armv7k arm64 arm64_32 i386 x86_64) If specified, will override the default architectures for the given PLATFORM 88 | # OS = armv7 armv7s arm64 (if applicable) 89 | # OS64 = arm64 (if applicable) 90 | # SIMULATOR = i386 91 | # SIMULATOR64 = x86_64 92 | # TVOS = arm64 93 | # SIMULATOR_TVOS = x86_64 (i386 has since long been deprecated) 94 | # WATCHOS = armv7k arm64_32 (if applicable) 95 | # SIMULATOR_WATCHOS = x86_64 (i386 has since long been deprecated) 96 | # 97 | # This toolchain defines the following variables for use externally: 98 | # 99 | # XCODE_VERSION: Version number (not including Build version) of Xcode detected. 100 | # SDK_VERSION: Version of SDK being used. 101 | # CMAKE_OSX_ARCHITECTURES: Architectures being compiled for (generated from PLATFORM). 102 | # APPLE_TARGET_TRIPLE: Used by autoconf build systems. NOTE: If "ARCHS" are overridden, this will *NOT* be set! 103 | # 104 | # This toolchain defines the following macros for use externally: 105 | # 106 | # set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE XCODE_VARIANT) 107 | # A convenience macro for setting xcode specific properties on targets. 108 | # Available variants are: All, Release, RelWithDebInfo, Debug, MinSizeRel 109 | # example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1" "all"). 110 | # 111 | # find_host_package (PROGRAM ARGS) 112 | # A macro used to find executable programs on the host system, not within the 113 | # environment. Thanks to the android-cmake project for providing the 114 | # command. 115 | # 116 | # ******************************** DEPRECATIONS ******************************* 117 | # 118 | # IOS_DEPLOYMENT_TARGET: (Deprecated) Alias to DEPLOYMENT_TARGET 119 | # CMAKE_IOS_DEVELOPER_ROOT: (Deprecated) Alias to CMAKE_DEVELOPER_ROOT 120 | # IOS_PLATFORM: (Deprecated) Alias to PLATFORM 121 | # IOS_ARCH: (Deprecated) Alias to ARCHS 122 | # 123 | # ***************************************************************************** 124 | # 125 | 126 | # Fix for PThread library not in path 127 | set(CMAKE_THREAD_LIBS_INIT "-lpthread") 128 | set(CMAKE_HAVE_THREADS_LIBRARY 1) 129 | set(CMAKE_USE_WIN32_THREADS_INIT 0) 130 | set(CMAKE_USE_PTHREADS_INIT 1) 131 | 132 | # Cache what generator is used 133 | set(USED_CMAKE_GENERATOR "${CMAKE_GENERATOR}" CACHE STRING "Expose CMAKE_GENERATOR" FORCE) 134 | 135 | if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14") 136 | set(MODERN_CMAKE YES) 137 | endif() 138 | 139 | # Get the Xcode version being used. 140 | execute_process(COMMAND xcodebuild -version 141 | OUTPUT_VARIABLE XCODE_VERSION 142 | ERROR_QUIET 143 | OUTPUT_STRIP_TRAILING_WHITESPACE) 144 | string(REGEX MATCH "Xcode [0-9\\.]+" XCODE_VERSION "${XCODE_VERSION}") 145 | string(REGEX REPLACE "Xcode ([0-9\\.]+)" "\\1" XCODE_VERSION "${XCODE_VERSION}") 146 | 147 | ######## ALIASES (DEPRECATION WARNINGS) 148 | 149 | if(DEFINED IOS_PLATFORM) 150 | set(PLATFORM ${IOS_PLATFORM}) 151 | message(DEPRECATION "IOS_PLATFORM argument is DEPRECATED. Consider using the new PLATFORM argument instead.") 152 | endif() 153 | 154 | if(DEFINED IOS_DEPLOYMENT_TARGET) 155 | set(DEPLOYMENT_TARGET ${IOS_DEPLOYMENT_TARGET}) 156 | message(DEPRECATION "IOS_DEPLOYMENT_TARGET argument is DEPRECATED. Consider using the new DEPLOYMENT_TARGET argument instead.") 157 | endif() 158 | 159 | if(DEFINED CMAKE_IOS_DEVELOPER_ROOT) 160 | set(CMAKE_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}) 161 | message(DEPRECATION "CMAKE_IOS_DEVELOPER_ROOT argument is DEPRECATED. Consider using the new CMAKE_DEVELOPER_ROOT argument instead.") 162 | endif() 163 | 164 | if(DEFINED IOS_ARCH) 165 | set(ARCHS ${IOS_ARCH}) 166 | message(DEPRECATION "IOS_ARCH argument is DEPRECATED. Consider using the new ARCHS argument instead.") 167 | endif() 168 | 169 | ######## END ALIASES 170 | 171 | # Unset the FORCE on cache variables if in try_compile() 172 | set(FORCE_CACHE FORCE) 173 | get_property(_CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE) 174 | if(_CMAKE_IN_TRY_COMPILE) 175 | unset(FORCE_CACHE) 176 | endif() 177 | 178 | # Default to building for iPhoneOS if not specified otherwise, and we cannot 179 | # determine the platform from the CMAKE_OSX_ARCHITECTURES variable. The use 180 | # of CMAKE_OSX_ARCHITECTURES is such that try_compile() projects can correctly 181 | # determine the value of PLATFORM from the root project, as 182 | # CMAKE_OSX_ARCHITECTURES is propagated to them by CMake. 183 | if(NOT DEFINED PLATFORM) 184 | if (CMAKE_OSX_ARCHITECTURES) 185 | if(CMAKE_OSX_ARCHITECTURES MATCHES ".*arm.*" AND CMAKE_OSX_SYSROOT MATCHES ".*iphoneos.*") 186 | set(PLATFORM "OS") 187 | elseif(CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_SYSROOT MATCHES ".*iphonesimulator.*") 188 | set(PLATFORM "SIMULATOR") 189 | elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" AND CMAKE_OSX_SYSROOT MATCHES ".*iphonesimulator.*") 190 | set(PLATFORM "SIMULATOR64") 191 | elseif(CMAKE_OSX_ARCHITECTURES MATCHES "arm64" AND CMAKE_OSX_SYSROOT MATCHES ".*appletvos.*") 192 | set(PLATFORM "TVOS") 193 | elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" AND CMAKE_OSX_SYSROOT MATCHES ".*appletvsimulator.*") 194 | set(PLATFORM "SIMULATOR_TVOS") 195 | elseif(CMAKE_OSX_ARCHITECTURES MATCHES ".*armv7k.*" AND CMAKE_OSX_SYSROOT MATCHES ".*watchos.*") 196 | set(PLATFORM "WATCHOS") 197 | elseif(CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_SYSROOT MATCHES ".*watchsimulator.*") 198 | set(PLATFORM "SIMULATOR_WATCHOS") 199 | endif() 200 | endif() 201 | if (NOT PLATFORM) 202 | set(PLATFORM "OS") 203 | endif() 204 | endif() 205 | 206 | set(PLATFORM_INT "${PLATFORM}" CACHE STRING "Type of platform for which the build targets.") 207 | 208 | # Handle the case where we are targeting iOS and a version above 10.3.4 (32-bit support dropped officially) 209 | if(PLATFORM_INT STREQUAL "OS" AND DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.3.4) 210 | set(PLATFORM_INT "OS64") 211 | message(STATUS "Targeting minimum SDK version ${DEPLOYMENT_TARGET}. Dropping 32-bit support.") 212 | elseif(PLATFORM_INT STREQUAL "SIMULATOR" AND DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.3.4) 213 | set(PLATFORM_INT "SIMULATOR64") 214 | message(STATUS "Targeting minimum SDK version ${DEPLOYMENT_TARGET}. Dropping 32-bit support.") 215 | endif() 216 | 217 | # Determine the platform name and architectures for use in xcodebuild commands 218 | # from the specified PLATFORM name. 219 | if(PLATFORM_INT STREQUAL "OS") 220 | set(SDK_NAME iphoneos) 221 | if(NOT ARCHS) 222 | set(ARCHS armv7 armv7s arm64) 223 | set(APPLE_TARGET_TRIPLE_INT arm-apple-ios) 224 | endif() 225 | elseif(PLATFORM_INT STREQUAL "OS64") 226 | set(SDK_NAME iphoneos) 227 | if(NOT ARCHS) 228 | if (XCODE_VERSION VERSION_GREATER 10.0) 229 | set(ARCHS arm64) # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example 230 | else() 231 | set(ARCHS arm64) 232 | endif() 233 | set(APPLE_TARGET_TRIPLE_INT aarch64-apple-ios) 234 | endif() 235 | elseif(PLATFORM_INT STREQUAL "OS64COMBINED") 236 | set(SDK_NAME iphoneos) 237 | if(MODERN_CMAKE) 238 | if(NOT ARCHS) 239 | if (XCODE_VERSION VERSION_GREATER 10.0) 240 | set(ARCHS arm64 x86_64) # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example 241 | else() 242 | set(ARCHS arm64 x86_64) 243 | endif() 244 | set(APPLE_TARGET_TRIPLE_INT aarch64-x86_64-apple-ios) 245 | endif() 246 | else() 247 | message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the OS64COMBINED setting work") 248 | endif() 249 | elseif(PLATFORM_INT STREQUAL "SIMULATOR") 250 | set(SDK_NAME iphonesimulator) 251 | if(NOT ARCHS) 252 | set(ARCHS i386) 253 | set(APPLE_TARGET_TRIPLE_INT i386-apple-ios) 254 | endif() 255 | message(DEPRECATION "SIMULATOR IS DEPRECATED. Consider using SIMULATOR64 instead.") 256 | elseif(PLATFORM_INT STREQUAL "SIMULATOR64") 257 | set(SDK_NAME iphonesimulator) 258 | if(NOT ARCHS) 259 | set(ARCHS x86_64) 260 | set(APPLE_TARGET_TRIPLE_INT x86_64-apple-ios) 261 | endif() 262 | elseif(PLATFORM_INT STREQUAL "TVOS") 263 | set(SDK_NAME appletvos) 264 | if(NOT ARCHS) 265 | set(ARCHS arm64) 266 | set(APPLE_TARGET_TRIPLE_INT aarch64-apple-tvos) 267 | endif() 268 | elseif (PLATFORM_INT STREQUAL "TVOSCOMBINED") 269 | set(SDK_NAME appletvos) 270 | if(MODERN_CMAKE) 271 | if(NOT ARCHS) 272 | set(ARCHS arm64 x86_64) 273 | set(APPLE_TARGET_TRIPLE_INT aarch64-x86_64-apple-tvos) 274 | endif() 275 | else() 276 | message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the TVOSCOMBINED setting work") 277 | endif() 278 | elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS") 279 | set(SDK_NAME appletvsimulator) 280 | if(NOT ARCHS) 281 | set(ARCHS x86_64) 282 | set(APPLE_TARGET_TRIPLE_INT x86_64-apple-tvos) 283 | endif() 284 | elseif(PLATFORM_INT STREQUAL "WATCHOS") 285 | set(SDK_NAME watchos) 286 | if(NOT ARCHS) 287 | if (XCODE_VERSION VERSION_GREATER 10.0) 288 | set(ARCHS armv7k arm64_32) 289 | set(APPLE_TARGET_TRIPLE_INT aarch64_32-apple-watchos) 290 | else() 291 | set(ARCHS armv7k) 292 | set(APPLE_TARGET_TRIPLE_INT arm-apple-watchos) 293 | endif() 294 | endif() 295 | elseif(PLATFORM_INT STREQUAL "WATCHOSCOMBINED") 296 | set(SDK_NAME watchos) 297 | if(MODERN_CMAKE) 298 | if(NOT ARCHS) 299 | if (XCODE_VERSION VERSION_GREATER 10.0) 300 | set(ARCHS armv7k arm64_32 i386) 301 | set(APPLE_TARGET_TRIPLE_INT aarch64_32-i386-apple-watchos) 302 | else() 303 | set(ARCHS armv7k i386) 304 | set(APPLE_TARGET_TRIPLE_INT arm-i386-apple-watchos) 305 | endif() 306 | endif() 307 | else() 308 | message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the WATCHOSCOMBINED setting work") 309 | endif() 310 | elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS") 311 | set(SDK_NAME watchsimulator) 312 | if(NOT ARCHS) 313 | set(ARCHS i386) 314 | set(APPLE_TARGET_TRIPLE_INT i386-apple-watchos) 315 | endif() 316 | else() 317 | message(FATAL_ERROR "Invalid PLATFORM: ${PLATFORM_INT}") 318 | endif() 319 | 320 | if(MODERN_CMAKE AND PLATFORM_INT MATCHES ".*COMBINED" AND NOT USED_CMAKE_GENERATOR MATCHES "Xcode") 321 | message(FATAL_ERROR "The COMBINED options only work with Xcode generator, -G Xcode") 322 | endif() 323 | 324 | # If user did not specify the SDK root to use, then query xcodebuild for it. 325 | execute_process(COMMAND xcodebuild -version -sdk ${SDK_NAME} Path 326 | OUTPUT_VARIABLE CMAKE_OSX_SYSROOT_INT 327 | ERROR_QUIET 328 | OUTPUT_STRIP_TRAILING_WHITESPACE) 329 | if (NOT DEFINED CMAKE_OSX_SYSROOT_INT AND NOT DEFINED CMAKE_OSX_SYSROOT) 330 | message(SEND_ERROR "Please make sure that Xcode is installed and that the toolchain" 331 | "is pointing to the correct path. Please run:" 332 | "sudo xcode-select -s /Applications/Xcode.app/Contents/Developer" 333 | "and see if that fixes the problem for you.") 334 | message(FATAL_ERROR "Invalid CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT} " 335 | "does not exist.") 336 | elseif(DEFINED CMAKE_OSX_SYSROOT_INT) 337 | set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "") 338 | endif() 339 | 340 | # Set Xcode property for SDKROOT as well if Xcode generator is used 341 | if(USED_CMAKE_GENERATOR MATCHES "Xcode") 342 | set(CMAKE_OSX_SYSROOT "${SDK_NAME}" CACHE INTERNAL "") 343 | if(NOT DEFINED CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM) 344 | set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "123456789A" CACHE INTERNAL "") 345 | endif() 346 | endif() 347 | 348 | # Specify minimum version of deployment target. 349 | if(NOT DEFINED DEPLOYMENT_TARGET) 350 | if (PLATFORM_INT STREQUAL "WATCHOS" OR PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS") 351 | # Unless specified, SDK version 2.0 is used by default as minimum target version (watchOS). 352 | set(DEPLOYMENT_TARGET "2.0" 353 | CACHE STRING "Minimum SDK version to build for." ) 354 | else() 355 | # Unless specified, SDK version 9.0 is used by default as minimum target version (iOS, tvOS). 356 | set(DEPLOYMENT_TARGET "9.0" 357 | CACHE STRING "Minimum SDK version to build for." ) 358 | endif() 359 | message(STATUS "Using the default min-version since DEPLOYMENT_TARGET not provided!") 360 | endif() 361 | 362 | # Use bitcode or not 363 | if(NOT DEFINED ENABLE_BITCODE AND NOT ARCHS MATCHES "((^|;|, )(i386|x86_64))+") 364 | # Unless specified, enable bitcode support by default 365 | message(STATUS "Enabling bitcode support by default. ENABLE_BITCODE not provided!") 366 | set(ENABLE_BITCODE TRUE) 367 | elseif(NOT DEFINED ENABLE_BITCODE) 368 | message(STATUS "Disabling bitcode support by default on simulators. ENABLE_BITCODE not provided for override!") 369 | set(ENABLE_BITCODE FALSE) 370 | endif() 371 | set(ENABLE_BITCODE_INT ${ENABLE_BITCODE} CACHE BOOL "Whether or not to enable bitcode" ${FORCE_CACHE}) 372 | # Use ARC or not 373 | if(NOT DEFINED ENABLE_ARC) 374 | # Unless specified, enable ARC support by default 375 | set(ENABLE_ARC TRUE) 376 | message(STATUS "Enabling ARC support by default. ENABLE_ARC not provided!") 377 | endif() 378 | set(ENABLE_ARC_INT ${ENABLE_ARC} CACHE BOOL "Whether or not to enable ARC" ${FORCE_CACHE}) 379 | # Use hidden visibility or not 380 | if(NOT DEFINED ENABLE_VISIBILITY) 381 | # Unless specified, disable symbols visibility by default 382 | set(ENABLE_VISIBILITY FALSE) 383 | message(STATUS "Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!") 384 | endif() 385 | set(ENABLE_VISIBILITY_INT ${ENABLE_VISIBILITY} CACHE BOOL "Whether or not to hide symbols (-fvisibility=hidden)" ${FORCE_CACHE}) 386 | # Set strict compiler checks or not 387 | if(NOT DEFINED ENABLE_STRICT_TRY_COMPILE) 388 | # Unless specified, disable strict try_compile() 389 | set(ENABLE_STRICT_TRY_COMPILE FALSE) 390 | message(STATUS "Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!") 391 | endif() 392 | set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL "Whether or not to use strict compiler checks" ${FORCE_CACHE}) 393 | # Get the SDK version information. 394 | execute_process(COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion 395 | OUTPUT_VARIABLE SDK_VERSION 396 | ERROR_QUIET 397 | OUTPUT_STRIP_TRAILING_WHITESPACE) 398 | 399 | # Find the Developer root for the specific iOS platform being compiled for 400 | # from CMAKE_OSX_SYSROOT. Should be ../../ from SDK specified in 401 | # CMAKE_OSX_SYSROOT. There does not appear to be a direct way to obtain 402 | # this information from xcrun or xcodebuild. 403 | if (NOT DEFINED CMAKE_DEVELOPER_ROOT AND NOT USED_CMAKE_GENERATOR MATCHES "Xcode") 404 | get_filename_component(PLATFORM_SDK_DIR ${CMAKE_OSX_SYSROOT} PATH) 405 | get_filename_component(CMAKE_DEVELOPER_ROOT ${PLATFORM_SDK_DIR} PATH) 406 | if (NOT DEFINED CMAKE_DEVELOPER_ROOT) 407 | message(FATAL_ERROR "Invalid CMAKE_DEVELOPER_ROOT: " 408 | "${CMAKE_DEVELOPER_ROOT} does not exist.") 409 | endif() 410 | endif() 411 | # Find the C & C++ compilers for the specified SDK. 412 | if(NOT CMAKE_C_COMPILER) 413 | execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang 414 | OUTPUT_VARIABLE CMAKE_C_COMPILER 415 | ERROR_QUIET 416 | OUTPUT_STRIP_TRAILING_WHITESPACE) 417 | message(STATUS "Using C compiler: ${CMAKE_C_COMPILER}") 418 | endif() 419 | if(NOT CMAKE_CXX_COMPILER) 420 | execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang++ 421 | OUTPUT_VARIABLE CMAKE_CXX_COMPILER 422 | ERROR_QUIET 423 | OUTPUT_STRIP_TRAILING_WHITESPACE) 424 | message(STATUS "Using CXX compiler: ${CMAKE_CXX_COMPILER}") 425 | endif() 426 | # Find (Apple's) libtool. 427 | execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find libtool 428 | OUTPUT_VARIABLE BUILD_LIBTOOL 429 | ERROR_QUIET 430 | OUTPUT_STRIP_TRAILING_WHITESPACE) 431 | message(STATUS "Using libtool: ${BUILD_LIBTOOL}") 432 | # Configure libtool to be used instead of ar + ranlib to build static libraries. 433 | # This is required on Xcode 7+, but should also work on previous versions of 434 | # Xcode. 435 | set(CMAKE_C_CREATE_STATIC_LIBRARY 436 | "${BUILD_LIBTOOL} -static -o ") 437 | set(CMAKE_CXX_CREATE_STATIC_LIBRARY 438 | "${BUILD_LIBTOOL} -static -o ") 439 | # Find the toolchain's provided install_name_tool if none is found on the host 440 | if(NOT CMAKE_INSTALL_NAME_TOOL) 441 | execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find install_name_tool 442 | OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT 443 | ERROR_QUIET 444 | OUTPUT_STRIP_TRAILING_WHITESPACE) 445 | set(CMAKE_INSTALL_NAME_TOOL ${CMAKE_INSTALL_NAME_TOOL_INT} CACHE STRING "" ${FORCE_CACHE}) 446 | endif() 447 | # Get the version of Darwin (OS X) of the host. 448 | execute_process(COMMAND uname -r 449 | OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION 450 | ERROR_QUIET 451 | OUTPUT_STRIP_TRAILING_WHITESPACE) 452 | if(SDK_NAME MATCHES "iphone") 453 | set(CMAKE_SYSTEM_NAME iOS CACHE INTERNAL "" ${FORCE_CACHE}) 454 | endif() 455 | # CMake 3.14+ support building for iOS, watchOS and tvOS out of the box. 456 | if(MODERN_CMAKE) 457 | if(SDK_NAME MATCHES "appletv") 458 | set(CMAKE_SYSTEM_NAME tvOS CACHE INTERNAL "" ${FORCE_CACHE}) 459 | elseif(SDK_NAME MATCHES "watch") 460 | set(CMAKE_SYSTEM_NAME watchOS CACHE INTERNAL "" ${FORCE_CACHE}) 461 | endif() 462 | # Provide flags for a combined FAT library build on newer CMake versions 463 | if(PLATFORM_INT MATCHES ".*COMBINED") 464 | set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH "NO" CACHE INTERNAL "" ${FORCE_CACHE}) 465 | set(CMAKE_IOS_INSTALL_COMBINED YES CACHE INTERNAL "" ${FORCE_CACHE}) 466 | message(STATUS "Will combine built (static) artifacts into FAT lib...") 467 | endif() 468 | elseif(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.10") 469 | # Legacy code path prior to CMake 3.14 or fallback if no SDK_NAME specified 470 | set(CMAKE_SYSTEM_NAME iOS CACHE INTERNAL "" ${FORCE_CACHE}) 471 | else() 472 | # Legacy code path prior to CMake 3.14 or fallback if no SDK_NAME specified 473 | set(CMAKE_SYSTEM_NAME Darwin CACHE INTERNAL "" ${FORCE_CACHE}) 474 | endif() 475 | # Standard settings. 476 | set(CMAKE_SYSTEM_VERSION ${SDK_VERSION} CACHE INTERNAL "") 477 | set(UNIX TRUE CACHE BOOL "") 478 | set(APPLE TRUE CACHE BOOL "") 479 | set(IOS TRUE CACHE BOOL "") 480 | set(CMAKE_AR ar CACHE FILEPATH "" FORCE) 481 | set(CMAKE_RANLIB ranlib CACHE FILEPATH "" FORCE) 482 | set(CMAKE_STRIP strip CACHE FILEPATH "" FORCE) 483 | # Set the architectures for which to build. 484 | set(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE STRING "Build architecture for iOS") 485 | # Change the type of target generated for try_compile() so it'll work when cross-compiling, weak compiler checks 486 | if(ENABLE_STRICT_TRY_COMPILE_INT) 487 | message(STATUS "Using strict compiler checks (default in CMake).") 488 | else() 489 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 490 | endif() 491 | # All iOS/Darwin specific settings - some may be redundant. 492 | set(CMAKE_MACOSX_BUNDLE YES) 493 | set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") 494 | set(CMAKE_SHARED_LIBRARY_PREFIX "lib") 495 | set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") 496 | set(CMAKE_SHARED_MODULE_PREFIX "lib") 497 | set(CMAKE_SHARED_MODULE_SUFFIX ".so") 498 | set(CMAKE_C_COMPILER_ABI ELF) 499 | set(CMAKE_CXX_COMPILER_ABI ELF) 500 | set(CMAKE_C_HAS_ISYSROOT 1) 501 | set(CMAKE_CXX_HAS_ISYSROOT 1) 502 | set(CMAKE_MODULE_EXISTS 1) 503 | set(CMAKE_DL_LIBS "") 504 | set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") 505 | set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") 506 | set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") 507 | set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") 508 | 509 | if(ARCHS MATCHES "((^|;|, )(arm64|arm64e|x86_64))+") 510 | set(CMAKE_C_SIZEOF_DATA_PTR 8) 511 | set(CMAKE_CXX_SIZEOF_DATA_PTR 8) 512 | if(ARCHS MATCHES "((^|;|, )(arm64|arm64e))+") 513 | set(CMAKE_SYSTEM_PROCESSOR "aarch64") 514 | else() 515 | set(CMAKE_SYSTEM_PROCESSOR "x86_64") 516 | endif() 517 | else() 518 | set(CMAKE_C_SIZEOF_DATA_PTR 4) 519 | set(CMAKE_CXX_SIZEOF_DATA_PTR 4) 520 | set(CMAKE_SYSTEM_PROCESSOR "arm") 521 | endif() 522 | 523 | # Note that only Xcode 7+ supports the newer more specific: 524 | # -m${SDK_NAME}-version-min flags, older versions of Xcode use: 525 | # -m(ios/ios-simulator)-version-min instead. 526 | if(${CMAKE_VERSION} VERSION_LESS "3.11") 527 | if(PLATFORM_INT STREQUAL "OS" OR PLATFORM_INT STREQUAL "OS64") 528 | if(XCODE_VERSION VERSION_LESS 7.0) 529 | set(SDK_NAME_VERSION_FLAGS 530 | "-mios-version-min=${DEPLOYMENT_TARGET}") 531 | else() 532 | # Xcode 7.0+ uses flags we can build directly from SDK_NAME. 533 | set(SDK_NAME_VERSION_FLAGS 534 | "-m${SDK_NAME}-version-min=${DEPLOYMENT_TARGET}") 535 | endif() 536 | elseif(PLATFORM_INT STREQUAL "TVOS") 537 | set(SDK_NAME_VERSION_FLAGS 538 | "-mtvos-version-min=${DEPLOYMENT_TARGET}") 539 | elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS") 540 | set(SDK_NAME_VERSION_FLAGS 541 | "-mtvos-simulator-version-min=${DEPLOYMENT_TARGET}") 542 | elseif(PLATFORM_INT STREQUAL "WATCHOS") 543 | set(SDK_NAME_VERSION_FLAGS 544 | "-mwatchos-version-min=${DEPLOYMENT_TARGET}") 545 | elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS") 546 | set(SDK_NAME_VERSION_FLAGS 547 | "-mwatchos-simulator-version-min=${DEPLOYMENT_TARGET}") 548 | else() 549 | # SIMULATOR or SIMULATOR64 both use -mios-simulator-version-min. 550 | set(SDK_NAME_VERSION_FLAGS 551 | "-mios-simulator-version-min=${DEPLOYMENT_TARGET}") 552 | endif() 553 | else() 554 | # Newer versions of CMake sets the version min flags correctly 555 | set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET} CACHE STRING 556 | "Set CMake deployment target" ${FORCE_CACHE}) 557 | endif() 558 | 559 | if(DEFINED APPLE_TARGET_TRIPLE_INT) 560 | set(APPLE_TARGET_TRIPLE ${APPLE_TARGET_TRIPLE_INT} CACHE STRING 561 | "Autoconf target triple compatible variable" ${FORCE_CACHE}) 562 | endif() 563 | 564 | if(ENABLE_BITCODE_INT) 565 | set(BITCODE "-fembed-bitcode") 566 | set(CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE "bitcode" CACHE INTERNAL "") 567 | set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES" CACHE INTERNAL "") 568 | else() 569 | set(BITCODE "") 570 | set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" CACHE INTERNAL "") 571 | endif() 572 | 573 | if(ENABLE_ARC_INT) 574 | set(FOBJC_ARC "-fobjc-arc") 575 | set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC "YES" CACHE INTERNAL "") 576 | else() 577 | set(FOBJC_ARC "-fno-objc-arc") 578 | set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC "NO" CACHE INTERNAL "") 579 | endif() 580 | 581 | if(NOT ENABLE_VISIBILITY_INT) 582 | set(VISIBILITY "-fvisibility=hidden") 583 | set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN "YES" CACHE INTERNAL "") 584 | else() 585 | set(VISIBILITY "") 586 | set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN "NO" CACHE INTERNAL "") 587 | endif() 588 | 589 | if(NOT IOS_TOOLCHAIN_HAS_RUN) 590 | #Check if Xcode generator is used, since that will handle these flags automagically 591 | if(USED_CMAKE_GENERATOR MATCHES "Xcode") 592 | message(STATUS "Not setting any manual command-line buildflags, since Xcode is selected as generator.") 593 | else() 594 | set(CMAKE_C_FLAGS 595 | "${SDK_NAME_VERSION_FLAGS} ${BITCODE} -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_C_FLAGS}") 596 | # Hidden visibilty is required for C++ on iOS. 597 | set(CMAKE_CXX_FLAGS 598 | "${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} -fvisibility-inlines-hidden -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_CXX_FLAGS}") 599 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g ${CMAKE_CXX_FLAGS_DEBUG}") 600 | set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG -Os -ffast-math ${CMAKE_CXX_FLAGS_MINSIZEREL}") 601 | set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG -O2 -g -ffast-math ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") 602 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG -O3 -ffast-math ${CMAKE_CXX_FLAGS_RELEASE}") 603 | set(CMAKE_C_LINK_FLAGS "${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") 604 | set(CMAKE_CXX_LINK_FLAGS "${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") 605 | set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") 606 | 607 | # In order to ensure that the updated compiler flags are used in try_compile() 608 | # tests, we have to forcibly set them in the CMake cache, not merely set them 609 | # in the local scope. 610 | set(VARS_TO_FORCE_IN_CACHE 611 | CMAKE_C_FLAGS 612 | CMAKE_CXX_FLAGS 613 | CMAKE_CXX_FLAGS_DEBUG 614 | CMAKE_CXX_FLAGS_RELWITHDEBINFO 615 | CMAKE_CXX_FLAGS_MINSIZEREL 616 | CMAKE_CXX_FLAGS_RELEASE 617 | CMAKE_C_LINK_FLAGS 618 | CMAKE_CXX_LINK_FLAGS) 619 | foreach(VAR_TO_FORCE ${VARS_TO_FORCE_IN_CACHE}) 620 | set(${VAR_TO_FORCE} "${${VAR_TO_FORCE}}" CACHE STRING "" ${FORCE_CACHE}) 621 | endforeach() 622 | endif() 623 | 624 | ## Print status messages to inform of the current state 625 | message(STATUS "Configuring ${SDK_NAME} build for platform: ${PLATFORM_INT}, architecture(s): ${ARCHS}") 626 | message(STATUS "Using SDK: ${CMAKE_OSX_SYSROOT_INT}") 627 | if(DEFINED APPLE_TARGET_TRIPLE) 628 | message(STATUS "Autoconf target triple: ${APPLE_TARGET_TRIPLE}") 629 | endif() 630 | message(STATUS "Using minimum deployment version: ${DEPLOYMENT_TARGET}" 631 | " (SDK version: ${SDK_VERSION})") 632 | if(MODERN_CMAKE) 633 | message(STATUS "Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!") 634 | endif() 635 | if(USED_CMAKE_GENERATOR MATCHES "Xcode") 636 | message(STATUS "Using Xcode version: ${XCODE_VERSION}") 637 | endif() 638 | if(DEFINED SDK_NAME_VERSION_FLAGS) 639 | message(STATUS "Using version flags: ${SDK_NAME_VERSION_FLAGS}") 640 | endif() 641 | message(STATUS "Using a data_ptr size of: ${CMAKE_CXX_SIZEOF_DATA_PTR}") 642 | message(STATUS "Using install_name_tool: ${CMAKE_INSTALL_NAME_TOOL}") 643 | if(ENABLE_BITCODE_INT) 644 | message(STATUS "Enabling bitcode support.") 645 | else() 646 | message(STATUS "Disabling bitcode support.") 647 | endif() 648 | 649 | if(ENABLE_ARC_INT) 650 | message(STATUS "Enabling ARC support.") 651 | else() 652 | message(STATUS "Disabling ARC support.") 653 | endif() 654 | 655 | if(NOT ENABLE_VISIBILITY_INT) 656 | message(STATUS "Hiding symbols (-fvisibility=hidden).") 657 | endif() 658 | endif() 659 | 660 | set(CMAKE_PLATFORM_HAS_INSTALLNAME 1) 661 | set(CMAKE_SHARED_LINKER_FLAGS "-rpath @executable_path/Frameworks -rpath @loader_path/Frameworks") 662 | set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") 663 | set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") 664 | set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") 665 | set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") 666 | set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a") 667 | set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") 668 | 669 | # Set the find root to the iOS developer roots and to user defined paths. 670 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT_INT} ${CMAKE_PREFIX_PATH} CACHE STRING "Root path that will be prepended 671 | to all search paths") 672 | # Default to searching for frameworks first. 673 | set(CMAKE_FIND_FRAMEWORK FIRST) 674 | # Set up the default search directories for frameworks. 675 | set(CMAKE_FRAMEWORK_PATH 676 | ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks 677 | ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks 678 | ${CMAKE_FRAMEWORK_PATH} CACHE STRING "Frameworks search paths" ${FORCE_CACHE}) 679 | 680 | set(IOS_TOOLCHAIN_HAS_RUN TRUE CACHE BOOL "Has the CMake toolchain run already?" ${FORCE_CACHE}) 681 | 682 | # By default, search both the specified iOS SDK and the remainder of the host filesystem. 683 | if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) 684 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE STRING "" ${FORCE_CACHE}) 685 | endif() 686 | if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) 687 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE STRING "" ${FORCE_CACHE}) 688 | endif() 689 | if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) 690 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE STRING "" ${FORCE_CACHE}) 691 | endif() 692 | if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) 693 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH CACHE STRING "" ${FORCE_CACHE}) 694 | endif() 695 | 696 | # 697 | # Some helper-macros below to simplify and beautify the CMakeFile 698 | # 699 | 700 | # This little macro lets you set any Xcode specific property. 701 | macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE XCODE_RELVERSION) 702 | set(XCODE_RELVERSION_I "${XCODE_RELVERSION}") 703 | if(XCODE_RELVERSION_I STREQUAL "All") 704 | set_property(TARGET ${TARGET} PROPERTY 705 | XCODE_ATTRIBUTE_${XCODE_PROPERTY} "${XCODE_VALUE}") 706 | else() 707 | set_property(TARGET ${TARGET} PROPERTY 708 | XCODE_ATTRIBUTE_${XCODE_PROPERTY}[variant=${XCODE_RELVERSION_I}] "${XCODE_VALUE}") 709 | endif() 710 | endmacro(set_xcode_property) 711 | 712 | # This macro lets you find executable programs on the host system. 713 | macro(find_host_package) 714 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 715 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) 716 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) 717 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) 718 | set(IOS FALSE) 719 | find_package(${ARGN}) 720 | set(IOS TRUE) 721 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) 722 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) 723 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) 724 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) 725 | endmacro(find_host_package) -------------------------------------------------------------------------------- /libc_deepspeech/libc_deepspeech.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // Deepspeech 0.9.3 library header file. 5 | #include "../libdeepspeech_0.9.3/deepspeech.h" 6 | 7 | // This library header file. 8 | #include "libc_deepspeech.h" 9 | 10 | char *deepspeech_verison(void) 11 | { 12 | char *version = DS_Version(); 13 | return version; 14 | } 15 | 16 | void deepspeech_free_str(char *string) 17 | { 18 | if (string != NULL) 19 | { 20 | DS_FreeString(string); 21 | } 22 | } 23 | 24 | void *create_model(char *model_path) 25 | { 26 | if (model_path == NULL) 27 | { 28 | return NULL; 29 | } 30 | 31 | ModelState *ctx; 32 | int status = DS_CreateModel(model_path, &ctx); 33 | 34 | return (void *)ctx; 35 | } 36 | 37 | void free_model(void *model_state) 38 | { 39 | if (model_state != NULL) 40 | { 41 | ModelState *ptr = (ModelState *)model_state; 42 | DS_FreeModel(ptr); 43 | } 44 | } 45 | 46 | uint64_t model_sample_rate(void *model_state) 47 | { 48 | if (model_state == NULL) 49 | { 50 | return 0; 51 | } 52 | 53 | ModelState *ptr = (ModelState *)model_state; 54 | int sample_rate = DS_GetModelSampleRate(ptr); 55 | return sample_rate; 56 | } 57 | 58 | char *speech_to_text(void *model_state, char *buffer, uint64_t buffer_size) 59 | { 60 | Metadata *result = DS_SpeechToTextWithMetadata((ModelState *)model_state, (short *)buffer, buffer_size / 2, 3); 61 | 62 | const CandidateTranscript *transcript = &result->transcripts[0]; 63 | std::string retval = ""; 64 | for (int i = 0; i < transcript->num_tokens; i++) 65 | { 66 | const TokenMetadata &token = transcript->tokens[i]; 67 | retval += token.text; 68 | } 69 | char *encoded = strdup(retval.c_str()); 70 | 71 | DS_FreeMetadata(result); 72 | 73 | return encoded; 74 | } 75 | 76 | int enable_external_scorer(void *model_state, char *model_path) 77 | { 78 | ModelState *ptr = (ModelState *)model_state; 79 | int status = DS_EnableExternalScorer(ptr, model_path); 80 | return status; 81 | } 82 | 83 | int disable_external_scorer(void *model_state) 84 | { 85 | ModelState *ptr = (ModelState *)model_state; 86 | int status = DS_DisableExternalScorer(ptr); 87 | return status; 88 | } 89 | 90 | int set_scorer_alpha_beta(void *model_state, float alpha, float beta) 91 | { 92 | ModelState *ptr = (ModelState *)model_state; 93 | int status = DS_SetScorerAlphaBeta(ptr, alpha, beta); 94 | return status; 95 | } -------------------------------------------------------------------------------- /libc_deepspeech/libc_deepspeech.h: -------------------------------------------------------------------------------- 1 | // Include guard 2 | #pragma once 3 | 4 | // Tell compiler to retain function in object file, even if it is unreferenced. 5 | #define EXPORTED __attribute__((visibility("default"))) __attribute__((used)) 6 | 7 | // Disable name mangling for C functions. 8 | #ifdef __cplusplus 9 | extern "C" 10 | { 11 | #endif 12 | 13 | // Return the version of this library. 14 | EXPORTED char *deepspeech_verison(void); 15 | 16 | // Free string allocated by DeepSpeech library. 17 | EXPORTED void deepspeech_free_str(char *string); 18 | 19 | // Return pointer to loaded model state. 20 | EXPORTED void *create_model(char *model_path); 21 | 22 | // Free loaded model. 23 | EXPORTED void free_model(void *model_state); 24 | 25 | // Returns sample rate for loaded model 26 | EXPORTED uint64_t model_sample_rate(void *model_state); 27 | 28 | // Returns json output from speech to text engine. 29 | EXPORTED char *speech_to_text(void *model_state, char *buffer, uint64_t buffer_size); 30 | 31 | // Enable decoding using external scorer. Returns zero on success, non-zero on failure. 32 | EXPORTED int enable_external_scorer(void *model_state, char *scorer_file_path); 33 | 34 | // Disable decoding using external scorer. Returns zero on success, non-zero on failure. 35 | EXPORTED int disable_external_scorer(void *model_state); 36 | 37 | // Set hyperparameters alpha and beta of the external scorer. Returns zero on success, non-zero on failure. 38 | // @param alpha: The alpha hyperparameter of the decoder. Language model weight. 39 | // @param beta: The beta hyperparameter of the decoder. Word insertion weight. 40 | EXPORTED int set_scorer_alpha_beta(void *model_state, float alpha, float beta); 41 | 42 | 43 | // Closing bracket for extern "C" 44 | #ifdef __cplusplus 45 | } 46 | #endif -------------------------------------------------------------------------------- /libdeepspeech_0.9.3/android/arm64-v8a/libdeepspeech.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/libdeepspeech_0.9.3/android/arm64-v8a/libdeepspeech.so -------------------------------------------------------------------------------- /libdeepspeech_0.9.3/android/armeabi-v7a/libdeepspeech.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/libdeepspeech_0.9.3/android/armeabi-v7a/libdeepspeech.so -------------------------------------------------------------------------------- /libdeepspeech_0.9.3/deepspeech.h: -------------------------------------------------------------------------------- 1 | #ifndef DEEPSPEECH_H 2 | #define DEEPSPEECH_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #ifndef SWIG 9 | #if defined _MSC_VER 10 | #define DEEPSPEECH_EXPORT __declspec(dllexport) 11 | #else 12 | #define DEEPSPEECH_EXPORT __attribute__ ((visibility("default"))) 13 | #endif /*End of _MSC_VER*/ 14 | #else 15 | #define DEEPSPEECH_EXPORT 16 | #endif 17 | 18 | typedef struct ModelState ModelState; 19 | 20 | typedef struct StreamingState StreamingState; 21 | 22 | /** 23 | * @brief Stores text of an individual token, along with its timing information 24 | */ 25 | typedef struct TokenMetadata { 26 | /** The text corresponding to this token */ 27 | const char* const text; 28 | 29 | /** Position of the token in units of 20ms */ 30 | const unsigned int timestep; 31 | 32 | /** Position of the token in seconds */ 33 | const float start_time; 34 | } TokenMetadata; 35 | 36 | /** 37 | * @brief A single transcript computed by the model, including a confidence 38 | * value and the metadata for its constituent tokens. 39 | */ 40 | typedef struct CandidateTranscript { 41 | /** Array of TokenMetadata objects */ 42 | const TokenMetadata* const tokens; 43 | /** Size of the tokens array */ 44 | const unsigned int num_tokens; 45 | /** Approximated confidence value for this transcript. This is roughly the 46 | * sum of the acoustic model logit values for each timestep/character that 47 | * contributed to the creation of this transcript. 48 | */ 49 | const double confidence; 50 | } CandidateTranscript; 51 | 52 | /** 53 | * @brief An array of CandidateTranscript objects computed by the model. 54 | */ 55 | typedef struct Metadata { 56 | /** Array of CandidateTranscript objects */ 57 | const CandidateTranscript* const transcripts; 58 | /** Size of the transcripts array */ 59 | const unsigned int num_transcripts; 60 | } Metadata; 61 | 62 | // sphinx-doc: error_code_listing_start 63 | 64 | #define DS_FOR_EACH_ERROR(APPLY) \ 65 | APPLY(DS_ERR_OK, 0x0000, "No error.") \ 66 | APPLY(DS_ERR_NO_MODEL, 0x1000, "Missing model information.") \ 67 | APPLY(DS_ERR_INVALID_ALPHABET, 0x2000, "Invalid alphabet embedded in model. (Data corruption?)") \ 68 | APPLY(DS_ERR_INVALID_SHAPE, 0x2001, "Invalid model shape.") \ 69 | APPLY(DS_ERR_INVALID_SCORER, 0x2002, "Invalid scorer file.") \ 70 | APPLY(DS_ERR_MODEL_INCOMPATIBLE, 0x2003, "Incompatible model.") \ 71 | APPLY(DS_ERR_SCORER_NOT_ENABLED, 0x2004, "External scorer is not enabled.") \ 72 | APPLY(DS_ERR_SCORER_UNREADABLE, 0x2005, "Could not read scorer file.") \ 73 | APPLY(DS_ERR_SCORER_INVALID_LM, 0x2006, "Could not recognize language model header in scorer.") \ 74 | APPLY(DS_ERR_SCORER_NO_TRIE, 0x2007, "Reached end of scorer file before loading vocabulary trie.") \ 75 | APPLY(DS_ERR_SCORER_INVALID_TRIE, 0x2008, "Invalid magic in trie header.") \ 76 | APPLY(DS_ERR_SCORER_VERSION_MISMATCH, 0x2009, "Scorer file version does not match expected version.") \ 77 | APPLY(DS_ERR_FAIL_INIT_MMAP, 0x3000, "Failed to initialize memory mapped model.") \ 78 | APPLY(DS_ERR_FAIL_INIT_SESS, 0x3001, "Failed to initialize the session.") \ 79 | APPLY(DS_ERR_FAIL_INTERPRETER, 0x3002, "Interpreter failed.") \ 80 | APPLY(DS_ERR_FAIL_RUN_SESS, 0x3003, "Failed to run the session.") \ 81 | APPLY(DS_ERR_FAIL_CREATE_STREAM, 0x3004, "Error creating the stream.") \ 82 | APPLY(DS_ERR_FAIL_READ_PROTOBUF, 0x3005, "Error reading the proto buffer model file.") \ 83 | APPLY(DS_ERR_FAIL_CREATE_SESS, 0x3006, "Failed to create session.") \ 84 | APPLY(DS_ERR_FAIL_CREATE_MODEL, 0x3007, "Could not allocate model state.") \ 85 | APPLY(DS_ERR_FAIL_INSERT_HOTWORD, 0x3008, "Could not insert hot-word.") \ 86 | APPLY(DS_ERR_FAIL_CLEAR_HOTWORD, 0x3009, "Could not clear hot-words.") \ 87 | APPLY(DS_ERR_FAIL_ERASE_HOTWORD, 0x3010, "Could not erase hot-word.") 88 | 89 | // sphinx-doc: error_code_listing_end 90 | 91 | enum DeepSpeech_Error_Codes 92 | { 93 | #define DEFINE(NAME, VALUE, DESC) NAME = VALUE, 94 | DS_FOR_EACH_ERROR(DEFINE) 95 | #undef DEFINE 96 | }; 97 | 98 | /** 99 | * @brief An object providing an interface to a trained DeepSpeech model. 100 | * 101 | * @param aModelPath The path to the frozen model graph. 102 | * @param[out] retval a ModelState pointer 103 | * 104 | * @return Zero on success, non-zero on failure. 105 | */ 106 | DEEPSPEECH_EXPORT 107 | int DS_CreateModel(const char* aModelPath, 108 | ModelState** retval); 109 | 110 | /** 111 | * @brief Get beam width value used by the model. If {@link DS_SetModelBeamWidth} 112 | * was not called before, will return the default value loaded from the 113 | * model file. 114 | * 115 | * @param aCtx A ModelState pointer created with {@link DS_CreateModel}. 116 | * 117 | * @return Beam width value used by the model. 118 | */ 119 | DEEPSPEECH_EXPORT 120 | unsigned int DS_GetModelBeamWidth(const ModelState* aCtx); 121 | 122 | /** 123 | * @brief Set beam width value used by the model. 124 | * 125 | * @param aCtx A ModelState pointer created with {@link DS_CreateModel}. 126 | * @param aBeamWidth The beam width used by the model. A larger beam width value 127 | * generates better results at the cost of decoding time. 128 | * 129 | * @return Zero on success, non-zero on failure. 130 | */ 131 | DEEPSPEECH_EXPORT 132 | int DS_SetModelBeamWidth(ModelState* aCtx, 133 | unsigned int aBeamWidth); 134 | 135 | /** 136 | * @brief Return the sample rate expected by a model. 137 | * 138 | * @param aCtx A ModelState pointer created with {@link DS_CreateModel}. 139 | * 140 | * @return Sample rate expected by the model for its input. 141 | */ 142 | DEEPSPEECH_EXPORT 143 | int DS_GetModelSampleRate(const ModelState* aCtx); 144 | 145 | /** 146 | * @brief Frees associated resources and destroys model object. 147 | */ 148 | DEEPSPEECH_EXPORT 149 | void DS_FreeModel(ModelState* ctx); 150 | 151 | /** 152 | * @brief Enable decoding using an external scorer. 153 | * 154 | * @param aCtx The ModelState pointer for the model being changed. 155 | * @param aScorerPath The path to the external scorer file. 156 | * 157 | * @return Zero on success, non-zero on failure (invalid arguments). 158 | */ 159 | DEEPSPEECH_EXPORT 160 | int DS_EnableExternalScorer(ModelState* aCtx, 161 | const char* aScorerPath); 162 | 163 | /** 164 | * @brief Add a hot-word and its boost. 165 | * 166 | * @param aCtx The ModelState pointer for the model being changed. 167 | * @param word The hot-word. 168 | * @param boost The boost. 169 | * 170 | * @return Zero on success, non-zero on failure (invalid arguments). 171 | */ 172 | DEEPSPEECH_EXPORT 173 | int DS_AddHotWord(ModelState* aCtx, 174 | const char* word, 175 | float boost); 176 | 177 | /** 178 | * @brief Remove entry for a hot-word from the hot-words map. 179 | * 180 | * @param aCtx The ModelState pointer for the model being changed. 181 | * @param word The hot-word. 182 | * 183 | * @return Zero on success, non-zero on failure (invalid arguments). 184 | */ 185 | DEEPSPEECH_EXPORT 186 | int DS_EraseHotWord(ModelState* aCtx, 187 | const char* word); 188 | 189 | /** 190 | * @brief Removes all elements from the hot-words map. 191 | * 192 | * @param aCtx The ModelState pointer for the model being changed. 193 | * 194 | * @return Zero on success, non-zero on failure (invalid arguments). 195 | */ 196 | DEEPSPEECH_EXPORT 197 | int DS_ClearHotWords(ModelState* aCtx); 198 | 199 | /** 200 | * @brief Disable decoding using an external scorer. 201 | * 202 | * @param aCtx The ModelState pointer for the model being changed. 203 | * 204 | * @return Zero on success, non-zero on failure. 205 | */ 206 | DEEPSPEECH_EXPORT 207 | int DS_DisableExternalScorer(ModelState* aCtx); 208 | 209 | /** 210 | * @brief Set hyperparameters alpha and beta of the external scorer. 211 | * 212 | * @param aCtx The ModelState pointer for the model being changed. 213 | * @param aAlpha The alpha hyperparameter of the decoder. Language model weight. 214 | * @param aLMBeta The beta hyperparameter of the decoder. Word insertion weight. 215 | * 216 | * @return Zero on success, non-zero on failure. 217 | */ 218 | DEEPSPEECH_EXPORT 219 | int DS_SetScorerAlphaBeta(ModelState* aCtx, 220 | float aAlpha, 221 | float aBeta); 222 | 223 | /** 224 | * @brief Use the DeepSpeech model to convert speech to text. 225 | * 226 | * @param aCtx The ModelState pointer for the model to use. 227 | * @param aBuffer A 16-bit, mono raw audio signal at the appropriate 228 | * sample rate (matching what the model was trained on). 229 | * @param aBufferSize The number of samples in the audio signal. 230 | * 231 | * @return The STT result. The user is responsible for freeing the string using 232 | * {@link DS_FreeString()}. Returns NULL on error. 233 | */ 234 | DEEPSPEECH_EXPORT 235 | char* DS_SpeechToText(ModelState* aCtx, 236 | const short* aBuffer, 237 | unsigned int aBufferSize); 238 | 239 | /** 240 | * @brief Use the DeepSpeech model to convert speech to text and output results 241 | * including metadata. 242 | * 243 | * @param aCtx The ModelState pointer for the model to use. 244 | * @param aBuffer A 16-bit, mono raw audio signal at the appropriate 245 | * sample rate (matching what the model was trained on). 246 | * @param aBufferSize The number of samples in the audio signal. 247 | * @param aNumResults The maximum number of CandidateTranscript structs to return. Returned value might be smaller than this. 248 | * 249 | * @return Metadata struct containing multiple CandidateTranscript structs. Each 250 | * transcript has per-token metadata including timing information. The 251 | * user is responsible for freeing Metadata by calling {@link DS_FreeMetadata()}. 252 | * Returns NULL on error. 253 | */ 254 | DEEPSPEECH_EXPORT 255 | Metadata* DS_SpeechToTextWithMetadata(ModelState* aCtx, 256 | const short* aBuffer, 257 | unsigned int aBufferSize, 258 | unsigned int aNumResults); 259 | 260 | /** 261 | * @brief Create a new streaming inference state. The streaming state returned 262 | * by this function can then be passed to {@link DS_FeedAudioContent()} 263 | * and {@link DS_FinishStream()}. 264 | * 265 | * @param aCtx The ModelState pointer for the model to use. 266 | * @param[out] retval an opaque pointer that represents the streaming state. Can 267 | * be NULL if an error occurs. 268 | * 269 | * @return Zero for success, non-zero on failure. 270 | */ 271 | DEEPSPEECH_EXPORT 272 | int DS_CreateStream(ModelState* aCtx, 273 | StreamingState** retval); 274 | 275 | /** 276 | * @brief Feed audio samples to an ongoing streaming inference. 277 | * 278 | * @param aSctx A streaming state pointer returned by {@link DS_CreateStream()}. 279 | * @param aBuffer An array of 16-bit, mono raw audio samples at the 280 | * appropriate sample rate (matching what the model was trained on). 281 | * @param aBufferSize The number of samples in @p aBuffer. 282 | */ 283 | DEEPSPEECH_EXPORT 284 | void DS_FeedAudioContent(StreamingState* aSctx, 285 | const short* aBuffer, 286 | unsigned int aBufferSize); 287 | 288 | /** 289 | * @brief Compute the intermediate decoding of an ongoing streaming inference. 290 | * 291 | * @param aSctx A streaming state pointer returned by {@link DS_CreateStream()}. 292 | * 293 | * @return The STT intermediate result. The user is responsible for freeing the 294 | * string using {@link DS_FreeString()}. 295 | */ 296 | DEEPSPEECH_EXPORT 297 | char* DS_IntermediateDecode(const StreamingState* aSctx); 298 | 299 | /** 300 | * @brief Compute the intermediate decoding of an ongoing streaming inference, 301 | * return results including metadata. 302 | * 303 | * @param aSctx A streaming state pointer returned by {@link DS_CreateStream()}. 304 | * @param aNumResults The number of candidate transcripts to return. 305 | * 306 | * @return Metadata struct containing multiple candidate transcripts. Each transcript 307 | * has per-token metadata including timing information. The user is 308 | * responsible for freeing Metadata by calling {@link DS_FreeMetadata()}. 309 | * Returns NULL on error. 310 | */ 311 | DEEPSPEECH_EXPORT 312 | Metadata* DS_IntermediateDecodeWithMetadata(const StreamingState* aSctx, 313 | unsigned int aNumResults); 314 | 315 | /** 316 | * @brief Compute the final decoding of an ongoing streaming inference and return 317 | * the result. Signals the end of an ongoing streaming inference. 318 | * 319 | * @param aSctx A streaming state pointer returned by {@link DS_CreateStream()}. 320 | * 321 | * @return The STT result. The user is responsible for freeing the string using 322 | * {@link DS_FreeString()}. 323 | * 324 | * @note This method will free the state pointer (@p aSctx). 325 | */ 326 | DEEPSPEECH_EXPORT 327 | char* DS_FinishStream(StreamingState* aSctx); 328 | 329 | /** 330 | * @brief Compute the final decoding of an ongoing streaming inference and return 331 | * results including metadata. Signals the end of an ongoing streaming 332 | * inference. 333 | * 334 | * @param aSctx A streaming state pointer returned by {@link DS_CreateStream()}. 335 | * @param aNumResults The number of candidate transcripts to return. 336 | * 337 | * @return Metadata struct containing multiple candidate transcripts. Each transcript 338 | * has per-token metadata including timing information. The user is 339 | * responsible for freeing Metadata by calling {@link DS_FreeMetadata()}. 340 | * Returns NULL on error. 341 | * 342 | * @note This method will free the state pointer (@p aSctx). 343 | */ 344 | DEEPSPEECH_EXPORT 345 | Metadata* DS_FinishStreamWithMetadata(StreamingState* aSctx, 346 | unsigned int aNumResults); 347 | 348 | /** 349 | * @brief Destroy a streaming state without decoding the computed logits. This 350 | * can be used if you no longer need the result of an ongoing streaming 351 | * inference and don't want to perform a costly decode operation. 352 | * 353 | * @param aSctx A streaming state pointer returned by {@link DS_CreateStream()}. 354 | * 355 | * @note This method will free the state pointer (@p aSctx). 356 | */ 357 | DEEPSPEECH_EXPORT 358 | void DS_FreeStream(StreamingState* aSctx); 359 | 360 | /** 361 | * @brief Free memory allocated for metadata information. 362 | */ 363 | DEEPSPEECH_EXPORT 364 | void DS_FreeMetadata(Metadata* m); 365 | 366 | /** 367 | * @brief Free a char* string returned by the DeepSpeech API. 368 | */ 369 | DEEPSPEECH_EXPORT 370 | void DS_FreeString(char* str); 371 | 372 | /** 373 | * @brief Returns the version of this library. The returned version is a semantic 374 | * version (SemVer 2.0.0). The string returned must be freed with {@link DS_FreeString()}. 375 | * 376 | * @return The version string. 377 | */ 378 | DEEPSPEECH_EXPORT 379 | char* DS_Version(); 380 | 381 | /** 382 | * @brief Returns a textual description corresponding to an error code. 383 | * The string returned must be freed with @{link DS_FreeString()}. 384 | * 385 | * @return The error description. 386 | */ 387 | DEEPSPEECH_EXPORT 388 | char* DS_ErrorCodeToErrorMessage(int aErrorCode); 389 | 390 | #undef DEEPSPEECH_EXPORT 391 | 392 | #ifdef __cplusplus 393 | } 394 | #endif 395 | 396 | #endif /* DEEPSPEECH_H */ 397 | -------------------------------------------------------------------------------- /libdeepspeech_0.9.3/deepspeech_ios.framework/deepspeech_ios: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manuindersekhon/mozilla-deepspeech-flutter/c236468ebcab92950eac95b5584f48bfd915455c/libdeepspeech_0.9.3/deepspeech_ios.framework/deepspeech_ios --------------------------------------------------------------------------------