├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── libs │ └── TarsosDSP.jar ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── slins │ └── flutterfft │ ├── AudioInterface.java │ ├── AudioModel.java │ ├── FlutterFftPlugin.java │ ├── FrequencyData.java │ ├── PitchInterface.java │ └── PitchModel.java ├── example ├── .gitignore ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── slins │ │ │ │ │ └── flutterfft │ │ │ │ │ └── flutter_fft_example │ │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── 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-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── 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.yaml ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── FlutterFftPlugin.h │ ├── FlutterFftPlugin.m │ └── SwiftFlutterFftPlugin.swift └── flutter_fft.podspec ├── lib └── flutter_fft.dart └── pubspec.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | ## [1.0.2+6] - 2021-06-25 6 | - Fixed readme 7 | 8 | ## [1.0.2+5] - 2021-06-25 9 | 10 | ### Changed 11 | - Fixed remove recorder callback method 12 | 13 | ## [1.0.2+4] - 2021-06-25 14 | 15 | ### Changed 16 | - Fixed tuning 17 | 18 | ## [1.0.2+3] - 2021-06-25 19 | 20 | ### Changed 21 | - Updated readme 22 | 23 | ## [1.0.2+2] - 2021-06-25 24 | 25 | ### Changed 26 | - Description fix 27 | 28 | ## [1.0.2+1] - 2021-06-25 29 | 30 | ### Changed 31 | - Improved package requirements 32 | 33 | ## [1.0.2] - 2021-06-24 34 | 35 | ### Added 36 | - Null safety 37 | 38 | ### Changed 39 | - Updated flutter version 40 | 41 | ## [1.0.1] - No changes 42 | 43 | ## [1.0.0] - 2019-01-11 44 | 45 | ### Added 46 | - Plugin release. 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Alexsander Bispo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter FFT 2 | 3 | ### Plugin at pub-dev 4 | 5 | 6 | **Warning:** *Currently works only on Android! This plugin makes use of platform channels, and only the Java/Android platform channel has been implemented.* 7 | 8 | **The plugin was developed in a Pixel 2 emulator, API 29. Tested in a real Pixel 2, Android 11 and another Pixel 2 emulator, API 30. Does not work on iOS at the moment, due to the platform channel having yet to be implemented.** 9 | 10 | **Minimum SDK version >= 24**: You can update the minimum SDK requirements at `"/android/app/build.gradle"` in the line `minSdkVersion 16` of your main application. 11 | 12 | The following needs to be added to your project's `"android/app/src/main/AndroidManifest.xml"`: 13 | 14 | ```xml 15 | 16 | ``` 17 | 18 | This is my first (and currently only) Flutter plugin and Java project. 19 | 20 | I was gathering ideas my personal guitar tuner application on Flutter, when I realized that I couldn't find any examples of audio analysis/processing/manipulation with Flutter. 21 | 22 | Flutter doesn't have great support for device specific hardware, such as microphone input. Obviously, it is the fundamental pillar for anything that deals with audio processing in real-time. 23 | Since Flutter has "just" started to become mainstream, there are still not many real-world projects or examples around. 24 | 25 | The plan I ended up coming up with was to code a platform channel for android, which is basically a way to call native code from within Flutter - i.e. Calling Java functions through Dart code, using Flutter. 26 | 27 | The problem with this is that, as it calls native platform code, the "one codebase" Flutter feature is rendered useless, since I would have to code the same thing for both platforms. (Objective-C/Swift for iOS & Java/Kotlin for Android) 28 | 29 | Because of that, at the moment, I only coded the android platform channel. 30 | 31 | ## How to use 32 | 33 | As mentioned above, this plugin was purely intended for usage in my personal project, however, since I couldn't find similar implementations, I decided to upload it here, in case anyone else goes through the same process. 34 | 35 | Because of this, what you can do with the plugin is very strict: Start recording, get data back from the platform channel, and stop recording. 36 | 37 | If you know how to program however, you can easily modify the code for your own needs. 38 | 39 | There are many getters and setters for the processed and default data, which are going to be discussed further below. 40 | 41 | Simple example: 42 | 43 | ```dart 44 | import 'package:flutter/material.dart'; 45 | import 'package:flutter_fft/flutter_fft.dart'; 46 | 47 | void main() => runApp(Application()); 48 | 49 | class Application extends StatefulWidget { 50 | @override 51 | ApplicationState createState() => ApplicationState(); 52 | } 53 | 54 | class ApplicationState extends State { 55 | double? frequency; 56 | String? note; 57 | int? octave; 58 | bool? isRecording; 59 | 60 | FlutterFft flutterFft = new FlutterFft(); 61 | 62 | _initialize() async { 63 | print("Starting recorder..."); 64 | // print("Before"); 65 | // bool hasPermission = await flutterFft.checkPermission(); 66 | // print("After: " + hasPermission.toString()); 67 | 68 | // Keep asking for mic permission until accepted 69 | while (!(await flutterFft.checkPermission())) { 70 | flutterFft.requestPermission(); 71 | // IF DENY QUIT PROGRAM 72 | } 73 | 74 | // await flutterFft.checkPermissions(); 75 | await flutterFft.startRecorder(); 76 | print("Recorder started..."); 77 | setState(() => isRecording = flutterFft.getIsRecording); 78 | 79 | flutterFft.onRecorderStateChanged.listen( 80 | (data) => { 81 | print("Changed state, received: $data"), 82 | setState( 83 | () => { 84 | frequency = data[1] as double, 85 | note = data[2] as String, 86 | octave = data[5] as int, 87 | }, 88 | ), 89 | flutterFft.setNote = note!, 90 | flutterFft.setFrequency = frequency!, 91 | flutterFft.setOctave = octave!, 92 | print("Octave: ${octave!.toString()}") 93 | }, 94 | onError: (err) { 95 | print("Error: $err"); 96 | }, 97 | onDone: () => {print("Isdone")}); 98 | } 99 | 100 | @override 101 | void initState() { 102 | isRecording = flutterFft.getIsRecording; 103 | frequency = flutterFft.getFrequency; 104 | note = flutterFft.getNote; 105 | octave = flutterFft.getOctave; 106 | super.initState(); 107 | _initialize(); 108 | } 109 | 110 | @override 111 | Widget build(BuildContext context) { 112 | return MaterialApp( 113 | title: "Simple flutter fft example", 114 | theme: ThemeData.dark(), 115 | color: Colors.blue, 116 | home: Scaffold( 117 | backgroundColor: Colors.purple, 118 | body: Center( 119 | child: Column( 120 | mainAxisAlignment: MainAxisAlignment.center, 121 | children: [ 122 | isRecording! 123 | ? Text("Current note: ${note!},${octave!.toString()}", 124 | style: TextStyle(fontSize: 30)) 125 | : Text("Not Recording", style: TextStyle(fontSize: 35)), 126 | isRecording! 127 | ? Text( 128 | "Current frequency: ${frequency!.toStringAsFixed(2)}", 129 | style: TextStyle(fontSize: 30)) 130 | : Text("Not Recording", style: TextStyle(fontSize: 35)) 131 | ], 132 | ), 133 | ), 134 | )); 135 | } 136 | } 137 | ``` 138 | 139 | ## Methods 140 | 141 | When we instantiate the plugin, a method channel variable is created, with the tag `"com.slins.flutterfft/record"`. 142 | 143 | This is the variable responsible for estabilishing a connection between Dart and the platform channel. 144 | 145 | ***For the section below, it is assumed that the plugin was instantiated and stored in a variable called "flutterFft".*** 146 | 147 | ### Three main methods 148 | 149 | 1. `flutterFft.onRecorderStateChanged` 150 | - Stream that listens to the updates from the recorder.. 151 | 2. `flutterFft.startRecording()` 152 | - Starts recording using the data from the plugin's **local** instance. In other words, if you want to pass custom values as arguments, you have to set them inside the `flutterFft` instance before starting the recorder. i.e. `flutterFft.setSampleRate = 22050` 153 | 3. `flutterFft.stopRecording()` 154 | - Stops recording. 155 | 156 | ### Variables, default values, getters, setters and descriptions 157 | 158 | | Variable | Default Value | Type | Getter | Setter | Description | 159 | | ----------------------- | -------------------------------------- | -------------------- | ------------------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 160 | | `_tuning` | `["E4", "B3", "G3", "D3", "A2", "E2"]` | `List` | `flutterFft.getTuning` | `flutterFft.setTuning` | Controller for the tuning target. Format: `["E4", "B3", "G3", "D3", "A2", "E2"]` (The detected frequency is compared to these values in order to resolve the detection data.) | 161 | | `_isRecording` | `false` | `bool` | `flutterFft.getIsRecording` | `flutterFft.setIsRecording` | Controller for the recorder state. | 162 | | `_subscriptionDuration` | `0.25` | `double` | `flutterFft.getSubscriptionDuration` | `flutterFft.setSubscriptionDuration` | Controller for the interval between platform channel function calls. | 163 | | `_numChannels` | `1` | `int` | `flutterFft.getNumChannels` | `flutterFft.setNumChannels` | Controller for the number of channels that gets passed to the pitch detector. | 164 | | `_sampleRate` | `44100` | `int` | `flutterFft.getSampleRate` | `flutterFft.setSampleRate` | Controller for the sample rate that gets passed to the pitch detector. | 165 | | `_androidAudioSource` | `AndroidAudioSource.MIC` | `AndroidAudioSource` | `flutterFft.getAndroidAudioSource` | `flutterFft.setAndroidAudioSource` | Controller for the audio source. (Microphone, etc.) | 166 | | `_tolerance` | `1.00` | `double` | `flutterFft.getTolerance` | `flutterFft.setTolerance` | Controller for the tolerance. (How far apart can the current frequency from the target frequency in order to be considered on pitch) | 167 | | `_frequency` | `0` | `double` | `flutterFft.getFrequency` | `flutterFft.setFrequency` | Controller for the frequency. | 168 | | `_note` | `""` | `String` | `flutterFft.getNote` | `flutterFft.setNote` | Controller for the note | 169 | | `_target` | `0` | `double` | `flutterFft.getTarget` | `flutterFft.setTarget` | Controller for the target frequency. (Based on the current selected tuning, calculate the nearest frequency in tune to be considered as the target, i.e: `IF currentNote == A && A.frequency.distanceToB IS SmallestTargetDistance -> _target = A.frequency.distanceToB`) | 170 | | `_distance` | `0` | `double` | `flutterFft.getDistance` | `flutterFft.setDistance` | Controller for the distance between the current frequency and the target frequency. | 171 | | `_octave` | `0` | `int` | `flutterFft.getOctave` | `flutterFft.setOctave` | Controller for the detected octave. | 172 | | `_nearestNote` | `""` | `String` | `flutterFft.getNearestNote` | `flutterFft.setNearestNote` | Controller for nearest note. (Based on the current note) | 173 | | `_nearestTarget` | `0` | `double` | `flutterFft.getNearestTarget` | `flutterFft.setNearestTarget` | Controller for nearest target. (Second smallest distance, as the smallest distance is already `_target`) | 174 | | `_nearestDistance` | `0` | `double` | `flutterFft.getNearestDistance` | `flutterFft.setNearestDistance` | Controller for nearest distance. (Second smallest distance) | 175 | | `_nearestOctave` | `0` | `int` | `flutterFft.getNearestOctave` | `flutterFft.setNearestOctave` | Controller for nearest octave. (Based on the "nearest" data) | 176 | | `_isOnPitch` | `false` | `bool` | `flutterFft.getIsOnPitch` | `flutterFft.setIsOnPitch` | Controller for the pitch | 177 | 178 | ### Todo 179 | 180 | - iOS version; 181 | - Separate call handling logic; 182 | - Improve performance, by rewriting code and/or writing native flutter/dart pitch detection; 183 | - Improve accuracy/outliers, some frequencies are way off; 184 | - Improve asking for permission when first running the app, when there's no permanent permission given by the user, and quit when it's denied. (crashes when user denies prompt) 185 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .settings -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.slins.flutterfft' 2 | version '1.0' 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.4.0' 11 | } 12 | } 13 | rootProject.allprojects { 14 | repositories { 15 | google() 16 | jcenter() 17 | } 18 | } 19 | apply plugin: 'com.android.library' 20 | android { 21 | namespace "com.slins.flutterfft" 22 | compileSdkVersion 30 23 | 24 | defaultConfig { 25 | minSdkVersion 24 26 | } 27 | lintOptions { 28 | disable 'InvalidPackage' 29 | } 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | } 35 | 36 | dependencies { 37 | implementation files('libs/TarsosDSP.jar') 38 | } 39 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true -------------------------------------------------------------------------------- /android/libs/TarsosDSP.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/android/libs/TarsosDSP.jar -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'flutter_fft' -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/java/com/slins/flutterfft/AudioInterface.java: -------------------------------------------------------------------------------- 1 | package com.slins.flutterfft; 2 | 3 | import java.util.List; 4 | 5 | import io.flutter.plugin.common.MethodChannel; 6 | 7 | interface AudioInterface { 8 | void startRecorder(List tuning, Integer numChannels, Integer sampleRate, int androidAudioSource, Float tolerance, MethodChannel.Result result); 9 | void stopRecorder(MethodChannel.Result result); 10 | void setSubscriptionDuration(double sec, MethodChannel.Result result); 11 | void checkIfPermissionGranted(); 12 | void initializeAudioRecorder(MethodChannel.Result result, List tuning, Integer sampleRate, Integer numChannels, int androidAudioSource, Float tolerance); 13 | } -------------------------------------------------------------------------------- /android/src/main/java/com/slins/flutterfft/AudioModel.java: -------------------------------------------------------------------------------- 1 | package com.slins.flutterfft; 2 | 3 | import android.media.AudioFormat; 4 | import android.media.AudioRecord; 5 | 6 | public class AudioModel { 7 | protected int subsDurationMillis = 500; // DEFAULT INTERVAL (0.5s) 8 | 9 | private AudioRecord audioRecorder; // AUDIO RECORDER 10 | private Runnable recorderTicker; // RECORDER RUNNABLE 11 | 12 | protected int audioFormat = AudioFormat.ENCODING_PCM_16BIT; // FORMAT IN WHICH THE AUDIO GETS RECORDED AND PROCESSED 13 | 14 | private short[] audioData; // AUDIO DATA 15 | 16 | protected short[] getAudioData() { 17 | return audioData; 18 | } // AUDIO DATA GETTER 19 | 20 | protected void setAudioData(short[] audioData) { 21 | this.audioData = audioData; 22 | } // AUDIO DATA SETTER 23 | 24 | protected AudioRecord getAudioRecorder() { 25 | return audioRecorder; 26 | } // AUDIO RECORDER GETTER 27 | 28 | protected void setAudioRecorder(AudioRecord audioRecorder) { 29 | this.audioRecorder = audioRecorder; 30 | } // AUDIO RECORDER SETTER 31 | 32 | protected Runnable getRecorderTicker() { 33 | return recorderTicker; 34 | } // RECORDER RUNNABLE GETTER 35 | 36 | protected void setRecorderTicker(Runnable recorderTicker) { 37 | this.recorderTicker = recorderTicker; 38 | } // RECORDER RUNNABLE SETTER 39 | } -------------------------------------------------------------------------------- /android/src/main/java/com/slins/flutterfft/FlutterFftPlugin.java: -------------------------------------------------------------------------------- 1 | package com.slins.flutterfft; 2 | 3 | import android.Manifest; 4 | import android.content.pm.PackageManager; 5 | import android.os.Build; 6 | import android.os.Handler; 7 | import android.media.AudioRecord; 8 | import android.os.Looper; 9 | import android.util.Log; 10 | import android.app.Activity; 11 | 12 | import java.util.List; 13 | import java.util.concurrent.ExecutorService; 14 | import java.util.concurrent.Executors; 15 | import java.util.concurrent.Executor; 16 | 17 | import be.tarsos.dsp.pitch.FastYin; 18 | 19 | import androidx.annotation.NonNull; 20 | import androidx.annotation.RequiresApi; 21 | import androidx.core.app.ActivityCompat; 22 | 23 | import io.flutter.plugin.common.PluginRegistry; 24 | import io.flutter.plugin.common.PluginRegistry.Registrar; 25 | import io.flutter.embedding.engine.plugins.FlutterPlugin; 26 | import io.flutter.plugin.common.MethodCall; 27 | import io.flutter.plugin.common.MethodChannel; 28 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler; 29 | import io.flutter.plugin.common.MethodChannel.Result; 30 | 31 | import io.flutter.embedding.engine.plugins.activity.ActivityAware; 32 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; 33 | 34 | /** FlutterFftPlugin */ 35 | public class FlutterFftPlugin implements ActivityAware, FlutterPlugin, PluginRegistry.RequestPermissionsResultListener, AudioInterface, MethodCallHandler { 36 | /// The MethodChannel that will the communication between Flutter and native Android 37 | /// 38 | /// This local reference serves to register the plugin with the Flutter Engine and unregister it 39 | /// when the Flutter Engine is detached from the Activity 40 | 41 | final public static String TAG = "FlutterFftPlugin"; // ANDROID STUDIO DEBUG CHANNEL 42 | 43 | final private static String RECORD_STREAM = "com.slins.flutterfft/record"; // PLATFORM CHANNEL NAME 44 | // ERROR CODES 45 | public static final String ERROR_MIC_PERMISSSION_DENIED = "ERROR_MIC_PERMISSION_DENIED"; 46 | public static final String ERROR_RECORDER_IS_NULL = "ERROR_RECORDER_IS_NULL"; 47 | public static final String ERROR_FAILED_RECORDER_INITIALIZATION = "ERROR_FAILED_RECORDER_INITIALIZATION"; 48 | public static final String ERROR_RECORDER_IS_NOT_INITIALIZED = "ERROR_RECORDER_IS_NOT_INITIALIZED"; 49 | public static final String ERROR_FAILED_RECORDER_PROGRESS = "ERROR_FAILED_RECORDER_PROGRESS"; 50 | public static final String ERROR_FAILED_RECORDER_UPDATE = "ERROR_FAILED_RECORDER_UPDATE"; 51 | public static final String ERROR_WRONG_BUFFER_SIZE = "ERROR_WRONG_BUFFER_SIZE"; 52 | public static final String ERROR_FAILED_FREQUENCIES_AND_OCTAVES_INSTANTIATION = "ERROR_FAILED_FREQUENCIES_AND_OCTAVES_INSTANTIATION"; 53 | 54 | public static int bufferSize; // AUDIO DATA BUFFER SIZE 55 | 56 | private boolean doneBefore = false; 57 | 58 | public static float frequency = 0; // FREQUENCY THAT GETS RETURNED TO THE FLUTTER APPLICATION 59 | 60 | public static String note = ""; // NOTE THAT GETS RETURNED TO THE FLUTTER APPLICATION 61 | public static float target = 0; 62 | public static float distance = 0; 63 | public static int octave = 0; // OCTAVE THAT GETS RETURNED TO THE FLUTTER APPLICATION 64 | 65 | public static String nearestNote = ""; 66 | public static float nearestTarget = 0; 67 | public static float nearestDistance = 0; 68 | public static int nearestOctave = 0; 69 | 70 | private final ExecutorService taskScheduler = Executors.newSingleThreadExecutor(); // MAIN THREAD 71 | 72 | // private static Registrar reg; // REGISTERED PLUGIN 73 | // private final Activity activity; 74 | // 75 | // FlutterFftPlugin(Activity activity) { 76 | // this.activity = activity; 77 | // } 78 | 79 | final private AudioModel audioModel = new AudioModel(); // INITIALIZATION OF AUDIO MODEL CLASS 80 | final private PitchModel pitchModel = new PitchModel(); // INITIALIZATION OF PITCH MODEL CLASS 81 | 82 | public static MethodChannel channel; // PLATFORM CHANNEL 83 | 84 | final static public Handler recordHandler = new Handler(); // RECORDER HANDLER 85 | final static public Handler mainHandler = new Handler(); // MAIN APPLICATION HANDLER 86 | 87 | private ActivityPluginBinding activityBinding; 88 | private Activity activity; 89 | 90 | @Override 91 | public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { 92 | // channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flutter_fft"); 93 | channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), RECORD_STREAM); 94 | channel.setMethodCallHandler(this); 95 | } 96 | 97 | @Override 98 | public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) { 99 | activityBinding = binding; 100 | activity = binding.getActivity(); 101 | } 102 | 103 | public boolean checkPermission() { // Checks whether mic permission was given 104 | if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { 105 | // Log.d(TAG, "Different: " + ActivityCompat.checkSelfPermission(activity, Manifest.permission.RECORD_AUDIO) + " | " + PackageManager.PERMISSION_GRANTED); 106 | return false; 107 | } 108 | 109 | return true; 110 | } 111 | 112 | public void requestPermission() { // Requests mic permission 113 | ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.RECORD_AUDIO}, 0); 114 | } 115 | 116 | @RequiresApi(api = Build.VERSION_CODES.N) 117 | @Override 118 | public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { 119 | // result.success(10); 120 | switch (call.method) { 121 | case "startRecorder": // WHEN "startRecorder" GETS CALLED FROM FLUTTER, RUN LOCAL startRecorder method, with given parameters 122 | taskScheduler.submit(() -> { 123 | List tuning = call.argument("tuning"); 124 | Integer sampleRate = call.argument("sampleRate"); // SAMPLE RATE, DEFAULT: 22050 125 | Integer numChannels = call.argument("numChannels"); // NUMBER OF CHANNELS, DEFAULT: 1 126 | int androidAudioSource = call.argument("androidAudioSource"); // AUDIO SOURCE, DEFAULT: MICROPHONE 127 | double tolerance = call.argument("tolerance"); // HOW APART CAN THE CURRENT PITCH AND TARGET PITCH BE TO CONSIDER IT ON PITCH, DEFAULT: 1.0 128 | startRecorder(tuning, numChannels, sampleRate, androidAudioSource, (float) tolerance, result); // CALL LOCAL "startRecorder" METHOD (JAVA IMPLEMENTATION) 129 | }); 130 | break; 131 | case "stopRecorder": 132 | taskScheduler.submit(() -> stopRecorder(result)); // CALL METHOD THAT STOPS RECORDING 133 | break; 134 | case "setSubscriptionDuration": 135 | if (call.argument("sec") == null) return; 136 | double duration = call.argument("sec"); 137 | setSubscriptionDuration(duration, result); // SET DURATION OF SUBSCRIPTION, IN OTHER WORDS, INTERVAL BETWEEN PITCH ESTIMATIONS 138 | break; 139 | case "checkPermission": 140 | result.success(checkPermission()); 141 | break; 142 | case "requestPermission": 143 | requestPermission(); 144 | break; 145 | default: 146 | result.notImplemented(); // IF THE METHOD THAT WAS CALLED FROM FLUTTER IS NOT ONE OF THE ABOVE, RETURN THIS 147 | break; 148 | } 149 | } 150 | 151 | @Override 152 | public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { // CHECK IF MICROPHONE RECORDING PERMISSION IS GRANTED 153 | Log.d(TAG, "Permission start"); 154 | final int REQUEST_RECORD_AUDIO_PERMISSION = 200; 155 | switch (requestCode) { 156 | case REQUEST_RECORD_AUDIO_PERMISSION: 157 | if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { 158 | Log.d(TAG, "Permission end1"); 159 | return true; 160 | } 161 | break; 162 | } 163 | Log.d(TAG, "Permission end2"); 164 | return false; 165 | } 166 | 167 | public static void printError(String message, Exception err) { 168 | Log.d(TAG, message + ". Error: " + err.toString()); 169 | } 170 | 171 | public static void printError(String message) { 172 | Log.d(TAG, message + "."); 173 | } 174 | 175 | @RequiresApi(api = Build.VERSION_CODES.N) 176 | @Override 177 | public void startRecorder(List tuning, Integer numChannels, Integer sampleRate, int androidAudioSource, Float tolerance, final Result result) { // START RECORDING 178 | checkIfPermissionGranted(); // CHECKS IF PERMISSION IS GRANTED 179 | 180 | if (!doneBefore) { 181 | try { 182 | pitchModel.getFrequenciesAndOctaves(result); 183 | doneBefore = true; 184 | } 185 | catch(Exception err) { 186 | printError("Could not get frequencies and octaves", err); 187 | return; 188 | } 189 | } 190 | 191 | initializeAudioRecorder(result, tuning, sampleRate, numChannels, androidAudioSource, tolerance); // INITIALIZE THE AUDIO RECORDER 192 | 193 | audioModel.getAudioRecorder().startRecording(); // START THE AUDIO RECORDER 194 | recordHandler.removeCallbacksAndMessages(null); 195 | 196 | audioModel.setRecorderTicker(() -> pitchModel.updateFrequencyAndNote(result, audioModel)); // PROCESS AUDIO IN LOOP 197 | 198 | recordHandler.post(audioModel.getRecorderTicker()); // UPDATES RECORD HANDLER 199 | 200 | mainHandler.post(new Runnable() { 201 | @Override 202 | public void run() { 203 | result.success("Recorder successfully set up."); 204 | } 205 | }); // UPDATES THE MAIN HANDLER 206 | } 207 | 208 | @Override 209 | public void stopRecorder(final Result result) { // STOP RECORDING 210 | recordHandler.removeCallbacksAndMessages(null); 211 | 212 | if (audioModel.getAudioRecorder() == null) { // IF THE AUDIO RECORDER IS ALREADY NULL, IN OTHER WORDS, ALREADY STOPPED, RETURN AN ERROR 213 | FlutterFftPlugin.printError("Recorder is null and cannot be stopped."); 214 | return; 215 | // result.error(ERROR_RECORDER_IS_NULL, "Can't stop recorder, it is NULL.", null); 216 | } 217 | 218 | audioModel.getAudioRecorder().stop(); 219 | audioModel.getAudioRecorder().release(); 220 | audioModel.setAudioRecorder(null); 221 | 222 | mainHandler.post(new Runnable() { // UPDATES THE MAIN HANDLER 223 | @Override 224 | public void run() { 225 | result.success("Recorder stopped."); 226 | } 227 | }); 228 | } 229 | 230 | @Override 231 | public void setSubscriptionDuration(double sec, Result result) { // SET SUBSCRIPTION DURATION/INTERVAL (TIME INTERVAL IN WHICH THE PITCH GETS UPDATED) 232 | audioModel.subsDurationMillis = (int) (sec * 1000); 233 | result.success("setSubscriptionDuration: " + audioModel.subsDurationMillis); 234 | } 235 | 236 | @Override 237 | public void checkIfPermissionGranted() { 238 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 239 | if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { 240 | ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.RECORD_AUDIO}, 0); 241 | 242 | // if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { 243 | // result.error(ERROR_MIC_PERMISSSION_DENIED, "Microphone permission denied.", null); 244 | // } 245 | } 246 | } 247 | } 248 | 249 | @Override 250 | public void initializeAudioRecorder(Result result, List tuning, Integer sampleRate, Integer numChannels, int androidAudioSource, Float tolerance) { 251 | if (audioModel.getAudioRecorder() == null) { // IF THE AUDIO RECORDER IS NOT NULL, IN OTHER WORDS, NOT ALREADY RUNNING, WE START IT 252 | bufferSize = 0; 253 | 254 | try { 255 | bufferSize = AudioRecord.getMinBufferSize(sampleRate, numChannels, audioModel.audioFormat) * 3; // CALCULATE AND UPDATE BUFFER SIZE 256 | 257 | if (bufferSize != AudioRecord.ERROR_BAD_VALUE) { // CONTINUE WITH THE PROCESS IF THE BUFFER SIZE IS VALID, OTHERWISE RETURN AN ERROR 258 | audioModel.setAudioRecorder(new AudioRecord(androidAudioSource, sampleRate, numChannels, audioModel.audioFormat, bufferSize)); // RECORDER INSTANTIATION 259 | audioModel.setAudioData(new short[bufferSize / 2]); // AUDIO BUFFER INSTANTIATION 260 | pitchModel.setPitchDetector(new FastYin(sampleRate, bufferSize / 2)); // PITCH DETECTOR INSTANTIATION 261 | pitchModel.setTolerance(tolerance); 262 | pitchModel.setTuning(tuning); 263 | } 264 | 265 | else { 266 | printError("Failed to initialize recorder, wrong buffer data: " + bufferSize); 267 | return; 268 | // result.error(ERROR_WRONG_BUFFER_SIZE, "Failed to initialize recorder, wrong buffer data: " + bufferSize, null); 269 | } 270 | 271 | } catch (Exception e) { 272 | printError("Failed to initialize recorder.", e); 273 | return; 274 | // result.error(ERROR_FAILED_RECORDER_INITIALIZATION, "Error: " + e.toString(), null); 275 | } 276 | 277 | 278 | } else { 279 | audioModel.getAudioRecorder().release(); 280 | } 281 | } 282 | 283 | @Override 284 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { 285 | channel.setMethodCallHandler(null); 286 | } 287 | 288 | @Override 289 | public void onDetachedFromActivityForConfigChanges() { 290 | onDetachedFromActivity(); 291 | } 292 | 293 | @Override 294 | public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) { 295 | onAttachedToActivity(binding); 296 | } 297 | 298 | @Override 299 | public void onDetachedFromActivity() { 300 | activityBinding.removeRequestPermissionsResultListener(this); 301 | activityBinding = null; 302 | } 303 | } 304 | -------------------------------------------------------------------------------- /android/src/main/java/com/slins/flutterfft/FrequencyData.java: -------------------------------------------------------------------------------- 1 | package com.slins.flutterfft; 2 | 3 | import java.util.Objects; 4 | 5 | public class FrequencyData { 6 | public final F first; 7 | public final S second; 8 | public final T third; 9 | 10 | public FrequencyData(F first, S second, T third) { 11 | this.first = first; 12 | this.second = second; 13 | this.third = third; 14 | } 15 | 16 | @Override 17 | public boolean equals(Object o) { 18 | if (!(o instanceof FrequencyData)) { 19 | return false; 20 | } 21 | FrequencyData fData = (FrequencyData) o; 22 | return Objects.equals(fData.first, first) && Objects.equals(fData.second, second) && Objects.equals(fData.third, third); 23 | } 24 | 25 | @Override 26 | public int hashCode() { 27 | return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode() ^ (third == null ? 0 : third.hashCode())); 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "FrequencyData{" + String.valueOf(first) + " " + String.valueOf(second) + " " + String.valueOf(third) + "}"; 33 | } 34 | 35 | public static FrequencyData create(A a, B b, C c) { 36 | return new FrequencyData(a, b, c); 37 | } 38 | } -------------------------------------------------------------------------------- /android/src/main/java/com/slins/flutterfft/PitchInterface.java: -------------------------------------------------------------------------------- 1 | package com.slins.flutterfft; 2 | 3 | import io.flutter.plugin.common.MethodChannel; 4 | 5 | interface PitchInterface { 6 | void updateFrequencyAndNote(MethodChannel.Result result, AudioModel audioModel); 7 | void processPitch(float floatInHz, MethodChannel.Result result); 8 | void getFrequenciesAndOctaves(MethodChannel.Result result); 9 | } 10 | -------------------------------------------------------------------------------- /android/src/main/java/com/slins/flutterfft/PitchModel.java: -------------------------------------------------------------------------------- 1 | package com.slins.flutterfft; 2 | 3 | import android.media.AudioRecord; 4 | import android.os.Build; 5 | import android.util.Log; 6 | import android.util.Pair; 7 | 8 | import androidx.annotation.RequiresApi; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Comparator; 12 | import java.util.List; 13 | 14 | import be.tarsos.dsp.pitch.PitchDetector; 15 | import io.flutter.plugin.common.MethodChannel; 16 | 17 | import static com.slins.flutterfft.FlutterFftPlugin.TAG; 18 | 19 | public class PitchModel implements PitchInterface { 20 | //ERRORS 21 | public static final String ERROR_PITCH_DETECTION_FAILURE = "ERROR_PITCH_DETECTION_FAILURE"; 22 | public static final String ERROR_DATA_FAILURE = "ERROR_DATA_FAILURE"; 23 | public static final String ERROR_FAILED_FREQUENCY_DATA_PROCESSING = "ERROR_FAILED_FREQUENCY_DATA_PROCESSING"; 24 | 25 | private float tolerance; // TOLERANCE IN HERTZ, AS IN HOW MANY HERTZ APART FROM THE PERFECT FREQUENCY THE NOTE IS TO BE CONSIDERED ON PITCH 26 | private List tuning; 27 | private ArrayList> tuningData = new ArrayList>(); 28 | private float[] targetFrequencies = null; 29 | private boolean isOnPitch = false; 30 | 31 | private PitchDetector pitchDetector; // PITCH DETECTOR VARIABLE 32 | 33 | ArrayList> frequencyData = new ArrayList>(); 34 | 35 | @Override 36 | public void updateFrequencyAndNote(MethodChannel.Result result, AudioModel audioModel) { 37 | try { 38 | if (audioModel.getAudioRecorder().getState() == AudioRecord.STATE_INITIALIZED) { // PROCEED IF THE AUDIO IS BEING RECORDED, RETURN AN ERROR OTHERWISE 39 | 40 | 41 | audioModel.getAudioRecorder().read(audioModel.getAudioData(), 0, FlutterFftPlugin.bufferSize / 2); // UPDATES AUDIO BUFFER TO THE CURRENT AUDIO DATA 42 | 43 | parseTuning(); 44 | 45 | ArrayList returnData = new ArrayList<>(); // VARIABLE THAT WILL CONTAIN THE DATA TO BE RETURNED TO FLUTTER 46 | 47 | short[] bufferData = audioModel.getAudioData(); // GETTING "SHORT" BUFFER ARRAY, IN ORDER TO CONVERT IT TO A FLOAT ARRAY (FLOAT ARRAY IS WHAT THE PITCH DETECTOR TAKES AS INPUT) 48 | float[] floatData = new float[FlutterFftPlugin.bufferSize / 2]; // INSTANTIATING THE FLOAT ARRAY 49 | 50 | for (int i = 0; i < bufferData.length; i++) { // MAKING THE TYPE CONVERSION 51 | floatData[i] = (float) bufferData[i]; 52 | // Log.d(TAG, "Data: " + floatData[i]); 53 | } 54 | 55 | FlutterFftPlugin.frequency = pitchDetector.getPitch(floatData).getPitch(); // GET DETECTED FREQUENCY FROM AUDIO 56 | // Log.d(TAG, "Data: " + pitchDetector.getPitch(floatData).getPitch()); 57 | 58 | if (FlutterFftPlugin.frequency != -1) { // PROCEED IF FREQUENCY WAS DETECTED, RETURN AN ERROR OTHERWISE 59 | try { 60 | processPitch(FlutterFftPlugin.frequency, result); // UPDATE NOTE FROM THE DETECTED FREQUENCY 61 | } catch(Exception e) { 62 | FlutterFftPlugin.printError("Could not process pitch", e); 63 | return; 64 | } 65 | 66 | try { 67 | returnData.add(tolerance); 68 | returnData.add(FlutterFftPlugin.frequency); // ADDS FREQUENCY TO THE RETURN ARRAY 69 | returnData.add(FlutterFftPlugin.note); // ADDS NOTE TO THE RETURN ARRAY 70 | returnData.add(FlutterFftPlugin.target); 71 | returnData.add(FlutterFftPlugin.distance); 72 | returnData.add(FlutterFftPlugin.octave); // ADDS OCTAVE TO THE RETURN ARRAY 73 | returnData.add(FlutterFftPlugin.nearestNote); 74 | returnData.add(FlutterFftPlugin.nearestTarget); 75 | returnData.add(FlutterFftPlugin.nearestDistance); 76 | returnData.add(FlutterFftPlugin.nearestOctave); 77 | returnData.add(isOnPitch); 78 | } catch(Exception err) { 79 | FlutterFftPlugin.printError("Could not set return data", err); 80 | return; 81 | } 82 | 83 | try { 84 | // Log.d(TAG, "Array here: " + returnData); 85 | // result.success(1); 86 | FlutterFftPlugin.channel.invokeMethod("updateRecorderProgress", returnData); // SENDS ARRAY "returnData" BACK TO FLUTTER 87 | } catch (Exception err) { 88 | FlutterFftPlugin.printError("Failed to update recorder progress", err); 89 | return; 90 | } 91 | } 92 | 93 | FlutterFftPlugin.recordHandler.postDelayed(audioModel.getRecorderTicker(), audioModel.subsDurationMillis); // LOOPS THIS CODE BLOCK 94 | } else { 95 | FlutterFftPlugin.printError("Recorder is not initialized"); 96 | return; 97 | // result.error(FlutterFftPlugin.ERROR_RECORDER_IS_NOT_INITIALIZED, "Current state: " + audioModel.getAudioRecorder().getState(), null); 98 | } 99 | } catch (Exception e) { 100 | FlutterFftPlugin.printError("Failed to update recorder", e); 101 | return; 102 | // Log.d(TAG, "Error there: " + e.toString()); 103 | // result.error(FlutterFftPlugin.ERROR_FAILED_RECORDER_UPDATE, "Failed to update recorder: " + e.toString(), null); 104 | } 105 | } 106 | 107 | // @Override 108 | // public void processPitch(float pitchInHz, MethodChannel.Result result) { // GET NOTE AND OCTAVE FROM PITCH (IN HZ) 109 | // if (tuning[0] != "None") { 110 | // float smallestDistance = Float.MAX_VALUE; 111 | // float secondSmallestDistance = Float.MAX_VALUE; 112 | // 113 | // for (FrequencyData data : frequencyData) { 114 | // for (int i = 0; i < targetFrequencies.length; i++) { 115 | // float currentDistance = pitchInHz - targetFrequencies[i]; 116 | // if (currentDistance < tolerance) { 117 | // smallestDistance = currentDistance; 118 | // FlutterFftPlugin.note = tuningData.get(i).first; 119 | // FlutterFftPlugin.distance = smallestDistance; 120 | // FlutterFftPlugin.target = targetFrequencies[i]; 121 | // FlutterFftPlugin.octave = tuningData.get(i).second; 122 | // isOnPitch = true; 123 | // int dataIndex = frequencyData.indexOf(data); 124 | // if (dataIndex != 0 && dataIndex != frequencyData.size() - 1) { 125 | // float dist1 = Math.abs(pitchInHz - frequencyData.get(dataIndex - 1).second); 126 | // float dist2 = Math.abs(pitchInHz - frequencyData.get(dataIndex + 1).second); 127 | // if (dist1 > dist2) { 128 | // secondSmallestDistance = dist2; 129 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex + 1).first; 130 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 131 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex + 1).second; 132 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex + 1).third; 133 | // } else if (dist1 < dist2) { 134 | // secondSmallestDistance = dist1; 135 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex - 1).first; 136 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 137 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex - 1).second; 138 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex - 1).third; 139 | // } else { 140 | // result.error(ERROR_FAILED_FREQUENCY_DATA_PROCESSING, "Could not properly set up the frequency data, dist1: " + dist1 + " | " + "dist2: " + dist2, null); 141 | // } 142 | // } 143 | // return; 144 | // } 145 | // } 146 | // } 147 | // 148 | // for (FrequencyData data : frequencyData) { 149 | // float currentDistance = Math.abs(pitchInHz - data.second); 150 | // if (currentDistance < tolerance) { 151 | // smallestDistance = currentDistance; 152 | // FlutterFftPlugin.note = data.first; 153 | // FlutterFftPlugin.distance = smallestDistance; 154 | // FlutterFftPlugin.target = data.second; 155 | // FlutterFftPlugin.octave = data.third; 156 | // isOnPitch = true; 157 | // int dataIndex = frequencyData.indexOf(data); 158 | // if (dataIndex != 0 && dataIndex != frequencyData.size() - 1) { 159 | // float dist1 = Math.abs(pitchInHz - frequencyData.get(dataIndex - 1).second); 160 | // float dist2 = Math.abs(pitchInHz - frequencyData.get(dataIndex + 1).second); 161 | // if (dist1 > dist2) { 162 | // secondSmallestDistance = dist2; 163 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex + 1).first; 164 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 165 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex + 1).second; 166 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex + 1).third; 167 | // } 168 | // else if(dist1 < dist2) { 169 | // secondSmallestDistance = dist1; 170 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex - 1).first; 171 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 172 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex - 1).second; 173 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex - 1).third; 174 | // } 175 | // else { 176 | // result.error(ERROR_FAILED_FREQUENCY_DATA_PROCESSING, "Could not properly set up the frequency data, dist1: " + dist1 + " | " + "dist2: " + dist2,null); 177 | // } 178 | // } 179 | // return; 180 | // } else if (currentDistance > tolerance) { 181 | // isOnPitch = false; 182 | // 183 | // if (currentDistance < smallestDistance) { 184 | // smallestDistance = currentDistance; 185 | // } else if (currentDistance > smallestDistance) { 186 | // 187 | // } 188 | // } 189 | // } 190 | // } 191 | // else if (currentDistance > tolerance) { 192 | // isOnPitch = false; 193 | // 194 | // if (currentDistance < smallestDistance) { 195 | // smallestDistance = currentDistance; 196 | // } else if (currentDistance > smallestDistance) { 197 | // int dataIndex = frequencyData.indexOf(data) - 1; 198 | // FlutterFftPlugin.note = data.first; 199 | // FlutterFftPlugin.distance = smallestDistance; 200 | // FlutterFftPlugin.target = data.second; 201 | // FlutterFftPlugin.octave = data.third; 202 | // 203 | // if (dataIndex != 0 && dataIndex != frequencyData.size() - 1) { 204 | // float dist1 = Math.abs(pitchInHz - frequencyData.get(dataIndex - 1).second); 205 | // float dist2 = Math.abs(pitchInHz - frequencyData.get(dataIndex + 1).second); 206 | // if (dist1 > dist2) { 207 | // secondSmallestDistance = dist2; 208 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex + 1).first; 209 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 210 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex + 1).second; 211 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex + 1).third; 212 | // } 213 | // else if(dist1 < dist2) { 214 | // secondSmallestDistance = dist1; 215 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex - 1).first; 216 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 217 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex - 1).second; 218 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex - 1).third; 219 | // } 220 | // else { 221 | // result.error(ERROR_FAILED_FREQUENCY_DATA_PROCESSING, "Could not properly set up the frequency data, dist1: " + dist1 + " | " + "dist2: " + dist2,null); 222 | // } 223 | // } 224 | // return; 225 | // } 226 | // } 227 | // } 228 | // } 229 | // 230 | // else { 231 | // float smallestDistance = Float.MAX_VALUE; 232 | // float secondSmallestDistance = Float.MAX_VALUE; 233 | // 234 | // for (FrequencyData data : frequencyData) { 235 | // float currentDistance = Math.abs(pitchInHz - data.second); 236 | // if (currentDistance < tolerance) { 237 | // smallestDistance = currentDistance; 238 | // FlutterFftPlugin.note = data.first; 239 | // FlutterFftPlugin.distance = smallestDistance; 240 | // FlutterFftPlugin.target = data.second; 241 | // FlutterFftPlugin.octave = data.third; 242 | // isOnPitch = true; 243 | // int dataIndex = frequencyData.indexOf(data); 244 | // if (dataIndex != 0 && dataIndex != frequencyData.size() - 1) { 245 | // float dist1 = Math.abs(pitchInHz - frequencyData.get(dataIndex - 1).second); 246 | // float dist2 = Math.abs(pitchInHz - frequencyData.get(dataIndex + 1).second); 247 | // if (dist1 > dist2) { 248 | // secondSmallestDistance = dist2; 249 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex + 1).first; 250 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 251 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex + 1).second; 252 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex + 1).third; 253 | // } 254 | // else if(dist1 < dist2) { 255 | // secondSmallestDistance = dist1; 256 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex - 1).first; 257 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 258 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex - 1).second; 259 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex - 1).third; 260 | // } 261 | // else { 262 | // result.error(ERROR_FAILED_FREQUENCY_DATA_PROCESSING, "Could not properly set up the frequency data, dist1: " + dist1 + " | " + "dist2: " + dist2,null); 263 | // } 264 | // } 265 | // return; 266 | // } else if (currentDistance > tolerance) { 267 | // isOnPitch = false; 268 | // 269 | // if (currentDistance < smallestDistance) { 270 | // smallestDistance = currentDistance; 271 | // } else if (currentDistance > smallestDistance){ 272 | // int dataIndex = frequencyData.indexOf(data) - 1; 273 | // FlutterFftPlugin.note = data.first; 274 | // FlutterFftPlugin.distance = smallestDistance; 275 | // FlutterFftPlugin.target = data.second; 276 | // FlutterFftPlugin.octave = data.third; 277 | // 278 | // if (dataIndex != 0 && dataIndex != frequencyData.size() - 1) { 279 | // float dist1 = Math.abs(pitchInHz - frequencyData.get(dataIndex - 1).second); 280 | // float dist2 = Math.abs(pitchInHz - frequencyData.get(dataIndex + 1).second); 281 | // if (dist1 > dist2) { 282 | // secondSmallestDistance = dist2; 283 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex + 1).first; 284 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 285 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex + 1).second; 286 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex + 1).third; 287 | // } 288 | // else if(dist1 < dist2) { 289 | // secondSmallestDistance = dist1; 290 | // FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex - 1).first; 291 | // FlutterFftPlugin.nearestDistance = secondSmallestDistance; 292 | // FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex - 1).second; 293 | // FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex - 1).third; 294 | // } 295 | // else { 296 | // result.error(ERROR_FAILED_FREQUENCY_DATA_PROCESSING, "Could not properly set up the frequency data, dist1: " + dist1 + " | " + "dist2: " + dist2,null); 297 | // } 298 | // } 299 | // return; 300 | // } 301 | // } 302 | // } 303 | // } 304 | // } 305 | 306 | @Override 307 | public void processPitch(float pitchInHz, MethodChannel.Result result) { // GET NOTE AND OCTAVE FROM PITCH (IN HZ) 308 | if (tuning.get(0) != "None") { 309 | float smallestTargetDistance = Float.MAX_VALUE; 310 | float smallestCurrentDistance = Float.MAX_VALUE; 311 | int targetIdx = 0; 312 | int currentIdx = -1; 313 | 314 | for (int i = 0; i < targetFrequencies.length; i++) { 315 | float currentDistance = Math.abs(pitchInHz - targetFrequencies[i]); 316 | if (currentDistance < smallestTargetDistance) { 317 | smallestTargetDistance = currentDistance; 318 | targetIdx = i; 319 | } 320 | } 321 | 322 | float currentDistance = smallestTargetDistance; 323 | //targetIdx = Math.abs(targetIdx); 324 | if (currentDistance < tolerance) { 325 | FlutterFftPlugin.note = tuningData.get(targetIdx).first; 326 | FlutterFftPlugin.distance = currentDistance; 327 | FlutterFftPlugin.target = targetFrequencies[targetIdx]; 328 | FlutterFftPlugin.octave = tuningData.get(targetIdx).second; 329 | isOnPitch = true; 330 | return; 331 | } else if (currentDistance > tolerance) { 332 | isOnPitch = false; 333 | 334 | FlutterFftPlugin.distance = currentDistance; 335 | FlutterFftPlugin.target = targetFrequencies[targetIdx]; 336 | 337 | for (FrequencyData data : frequencyData) { 338 | float curDistance = Math.abs(pitchInHz - data.second); 339 | currentIdx++; 340 | if (curDistance < smallestCurrentDistance) { 341 | smallestCurrentDistance = curDistance; 342 | } else if (curDistance > smallestCurrentDistance) { 343 | break; 344 | } 345 | } 346 | 347 | // for (int i = 0; i < frequencyData.size(); i++) { 348 | // float curDistance = Math.abs(pitchInHz -) 349 | // } 350 | 351 | // Log.d(TAG, "Target: " + targetIdx + " | Current: " + currentIdx); 352 | 353 | FlutterFftPlugin.note = frequencyData.get(currentIdx).first; 354 | FlutterFftPlugin.octave = frequencyData.get(currentIdx).third; 355 | 356 | FlutterFftPlugin.nearestNote = tuningData.get(targetIdx).first; 357 | FlutterFftPlugin.nearestDistance = FlutterFftPlugin.distance; 358 | FlutterFftPlugin.nearestOctave = tuningData.get(targetIdx).second; 359 | 360 | FlutterFftPlugin.nearestTarget = targetFrequencies[targetIdx]; 361 | return; 362 | } 363 | } else if (tuning.get(0) == "None") { 364 | float smallestDistance = Float.MAX_VALUE; 365 | float secondSmallestDistance = Float.MAX_VALUE; 366 | 367 | for (FrequencyData data : frequencyData) { 368 | float currentDistance = Math.abs(pitchInHz - data.second); 369 | if (currentDistance < tolerance) { 370 | smallestDistance = currentDistance; 371 | FlutterFftPlugin.note = data.first; 372 | FlutterFftPlugin.distance = smallestDistance; 373 | FlutterFftPlugin.target = data.second; 374 | FlutterFftPlugin.octave = data.third; 375 | isOnPitch = true; 376 | int dataIndex = frequencyData.indexOf(data); 377 | if (dataIndex != 0 && dataIndex != frequencyData.size() - 1) { 378 | float dist1 = Math.abs(pitchInHz - frequencyData.get(dataIndex - 1).second); 379 | float dist2 = Math.abs(pitchInHz - frequencyData.get(dataIndex + 1).second); 380 | if (dist1 > dist2) { 381 | secondSmallestDistance = dist2; 382 | FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex + 1).first; 383 | FlutterFftPlugin.nearestDistance = secondSmallestDistance; 384 | FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex + 1).second; 385 | FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex + 1).third; 386 | } else if (dist1 < dist2) { 387 | secondSmallestDistance = dist1; 388 | FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex - 1).first; 389 | FlutterFftPlugin.nearestDistance = secondSmallestDistance; 390 | FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex - 1).second; 391 | FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex - 1).third; 392 | } else { 393 | FlutterFftPlugin.printError("Could not properly set up the frequency data"); 394 | return; 395 | // result.error(ERROR_FAILED_FREQUENCY_DATA_PROCESSING, "Could not properly set up the frequency data, dist1: " + dist1 + " | " + "dist2: " + dist2, null); 396 | } 397 | } 398 | return; 399 | } else if (currentDistance > tolerance) { 400 | isOnPitch = false; 401 | 402 | if (currentDistance < smallestDistance) { 403 | smallestDistance = currentDistance; 404 | } else if (currentDistance > smallestDistance) { 405 | int dataIndex = frequencyData.indexOf(data) - 1; 406 | FlutterFftPlugin.note = data.first; 407 | FlutterFftPlugin.distance = smallestDistance; 408 | FlutterFftPlugin.target = data.second; 409 | FlutterFftPlugin.octave = data.third; 410 | 411 | if (dataIndex != 0 && dataIndex != frequencyData.size() - 1) { 412 | float dist1 = Math.abs(pitchInHz - frequencyData.get(dataIndex - 1).second); 413 | float dist2 = Math.abs(pitchInHz - frequencyData.get(dataIndex + 1).second); 414 | if (dist1 > dist2) { 415 | secondSmallestDistance = dist2; 416 | FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex + 1).first; 417 | FlutterFftPlugin.nearestDistance = secondSmallestDistance; 418 | FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex + 1).second; 419 | FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex + 1).third; 420 | } else if (dist1 < dist2) { 421 | secondSmallestDistance = dist1; 422 | FlutterFftPlugin.nearestNote = frequencyData.get(dataIndex - 1).first; 423 | FlutterFftPlugin.nearestDistance = secondSmallestDistance; 424 | FlutterFftPlugin.nearestTarget = frequencyData.get(dataIndex - 1).second; 425 | FlutterFftPlugin.nearestOctave = frequencyData.get(dataIndex - 1).third; 426 | } else { 427 | FlutterFftPlugin.printError("Could not properly set up the frequency data"); 428 | return; 429 | } 430 | } 431 | return; 432 | } 433 | } 434 | } 435 | } else { 436 | FlutterFftPlugin.printError("Unknown tuning."); 437 | return; 438 | } 439 | } 440 | 441 | @RequiresApi(api = Build.VERSION_CODES.N) 442 | @Override 443 | public void getFrequenciesAndOctaves(MethodChannel.Result result) { 444 | float A4 = 440; 445 | float a; 446 | float aSharp; 447 | float b; 448 | float c; 449 | float cSharp; 450 | float d; 451 | float dSharp; 452 | float e; 453 | float f; 454 | float fSharp; 455 | float g; 456 | float gSharp; 457 | 458 | for (int i = -4; i < 4; i++) { 459 | a = A4 * (float) Math.pow(2, (float) i); 460 | aSharp = a * (float) Math.pow(2, (float) 1/12); 461 | b = a * (float) Math.pow(2, (float) 2/12); 462 | c = a * (float) Math.pow(2, (float) -9/12); 463 | cSharp = a * (float) Math.pow(2, (float) -8/12); 464 | d = a * (float) Math.pow(2, (float) -7/12); 465 | dSharp = a * (float) Math.pow(2, (float) -6/12); 466 | e = a * (float) Math.pow(2, (float) -5/12); 467 | f = a * (float) Math.pow(2, (float) -4/12); 468 | fSharp = a * (float) Math.pow(2, (float) -3/12); 469 | g = a * (float) Math.pow(2, (float) -2/12); 470 | gSharp = a * (float) Math.pow(2, (float) -1/12); 471 | 472 | frequencyData.add(new FrequencyData("B", b, i + 4)); 473 | frequencyData.add(new FrequencyData("A#", aSharp, i + 4)); 474 | frequencyData.add(new FrequencyData("A", a, i + 4)); 475 | frequencyData.add(new FrequencyData("G#", gSharp, i + 4)); 476 | frequencyData.add(new FrequencyData("G", g, i + 4)); 477 | frequencyData.add(new FrequencyData("F#", fSharp, i + 4)); 478 | frequencyData.add(new FrequencyData("F", f, i + 4)); 479 | frequencyData.add(new FrequencyData("E", e, i + 4)); 480 | frequencyData.add(new FrequencyData("D#", dSharp, i + 4)); 481 | frequencyData.add(new FrequencyData("D", d, i + 4)); 482 | frequencyData.add(new FrequencyData("C#", cSharp, i + 4)); 483 | frequencyData.add(new FrequencyData("C", c, i + 4)); 484 | } 485 | 486 | frequencyData.sort(new Comparator>() { 487 | @Override 488 | public int compare(final FrequencyData FData, final FrequencyData otherFData) { 489 | if (FData.second > otherFData.second) { 490 | return -1; 491 | } else if (FData.second < otherFData.second) { 492 | return 1; 493 | } else { 494 | return 0; 495 | } 496 | } 497 | }); 498 | } 499 | 500 | 501 | public void setPitchDetector(PitchDetector pitchDetector) { 502 | this.pitchDetector = pitchDetector; 503 | } 504 | 505 | public void setTolerance(Float tolerance) { 506 | this.tolerance = tolerance; 507 | } 508 | 509 | public void setTuning(List tuning) { 510 | this.tuning = tuning; 511 | } 512 | 513 | public void parseTuning() { 514 | tuningData = new ArrayList>(); 515 | 516 | if (tuning.get(0) != "None") { 517 | for (int i = 0; i < tuning.size(); i++) { 518 | if (tuning.get(i).toString().length() == 2) { 519 | tuningData.add(new Pair(Character.toString(tuning.get(i).toString().charAt(0)), (int) tuning.get(i).toString().charAt(1) - 50 + 2)); 520 | } 521 | else if (tuning.get(i).toString().length() == 3) { 522 | tuningData.add(new Pair(Character.toString(tuning.get(i).toString().charAt(0)) + tuning.get(i).toString().charAt(1), (int) tuning.get(i).toString().charAt(2) - 50 + 2)); 523 | } 524 | 525 | } 526 | 527 | targetFrequencies = new float[tuningData.size()]; 528 | 529 | int currentTuneIdx = 0; 530 | 531 | for (Pair tune : tuningData) { 532 | for (FrequencyData data : frequencyData) { 533 | if (data.third.equals(tune.second) && data.first.equals(tune.first)) { 534 | targetFrequencies[currentTuneIdx] = data.second; 535 | } 536 | } 537 | currentTuneIdx++; 538 | } 539 | } 540 | } 541 | } 542 | -------------------------------------------------------------------------------- /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 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_fft_example 2 | 3 | Demonstrates how to use the flutter_fft 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 30 29 | 30 | defaultConfig { 31 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 32 | applicationId "com.slins.flutterfft.flutter_fft_example" 33 | minSdkVersion 24 34 | targetSdkVersion 30 35 | versionCode flutterVersionCode.toInteger() 36 | versionName flutterVersionName 37 | } 38 | 39 | buildTypes { 40 | release { 41 | // TODO: Add your own signing config for the release build. 42 | // Signing with the debug keys for now, so `flutter run --release` works. 43 | signingConfig signingConfigs.debug 44 | } 45 | } 46 | } 47 | 48 | flutter { 49 | source '../..' 50 | } 51 | 52 | dependencies { 53 | testImplementation 'junit:junit:4.12' 54 | androidTestImplementation 'androidx.test:runner:1.1.1' 55 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 56 | } 57 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 8 | 15 | 19 | 23 | 28 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/slins/flutterfft/flutter_fft_example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.slins.flutterfft.flutter_fft_example; 2 | 3 | import io.flutter.embedding.android.FlutterActivity; 4 | 5 | public class MainActivity extends FlutterActivity { 6 | } -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:4.2.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | project.evaluationDependsOn(':app') 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/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-6.7.1-all.zip 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/ephemeral/ 22 | Flutter/app.flx 23 | Flutter/app.zip 24 | Flutter/flutter_assets/ 25 | Flutter/flutter_export_environment.sh 26 | ServiceDefinitions.json 27 | Runner/GeneratedPluginRegistrant.* 28 | 29 | # Exceptions to above rules. 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.pbxuser 33 | !default.perspectivev3 34 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 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 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1020; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | INFOPLIST_FILE = Runner/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 294 | PRODUCT_BUNDLE_IDENTIFIER = com.slins.flutterfft.flutterFftExample; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 297 | SWIFT_VERSION = 5.0; 298 | VERSIONING_SYSTEM = "apple-generic"; 299 | }; 300 | name = Profile; 301 | }; 302 | 97C147031CF9000F007C117D /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_COMMA = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INFINITE_RECURSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = dwarf; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | ENABLE_TESTABILITY = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_OPTIMIZATION_LEVEL = 0; 339 | GCC_PREPROCESSOR_DEFINITIONS = ( 340 | "DEBUG=1", 341 | "$(inherited)", 342 | ); 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 350 | MTL_ENABLE_DEBUG_INFO = YES; 351 | ONLY_ACTIVE_ARCH = YES; 352 | SDKROOT = iphoneos; 353 | TARGETED_DEVICE_FAMILY = "1,2"; 354 | }; 355 | name = Debug; 356 | }; 357 | 97C147041CF9000F007C117D /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ALWAYS_SEARCH_USER_PATHS = NO; 361 | CLANG_ANALYZER_NONNULL = YES; 362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 363 | CLANG_CXX_LIBRARY = "libc++"; 364 | CLANG_ENABLE_MODULES = YES; 365 | CLANG_ENABLE_OBJC_ARC = YES; 366 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 367 | CLANG_WARN_BOOL_CONVERSION = YES; 368 | CLANG_WARN_COMMA = YES; 369 | CLANG_WARN_CONSTANT_CONVERSION = YES; 370 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 372 | CLANG_WARN_EMPTY_BODY = YES; 373 | CLANG_WARN_ENUM_CONVERSION = YES; 374 | CLANG_WARN_INFINITE_RECURSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 381 | CLANG_WARN_STRICT_PROTOTYPES = YES; 382 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 383 | CLANG_WARN_UNREACHABLE_CODE = YES; 384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 386 | COPY_PHASE_STRIP = NO; 387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 388 | ENABLE_NS_ASSERTIONS = NO; 389 | ENABLE_STRICT_OBJC_MSGSEND = YES; 390 | GCC_C_LANGUAGE_STANDARD = gnu99; 391 | GCC_NO_COMMON_BLOCKS = YES; 392 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 393 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 394 | GCC_WARN_UNDECLARED_SELECTOR = YES; 395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 396 | GCC_WARN_UNUSED_FUNCTION = YES; 397 | GCC_WARN_UNUSED_VARIABLE = YES; 398 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 399 | MTL_ENABLE_DEBUG_INFO = NO; 400 | SDKROOT = iphoneos; 401 | SUPPORTED_PLATFORMS = iphoneos; 402 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 403 | TARGETED_DEVICE_FAMILY = "1,2"; 404 | VALIDATE_PRODUCT = YES; 405 | }; 406 | name = Release; 407 | }; 408 | 97C147061CF9000F007C117D /* Debug */ = { 409 | isa = XCBuildConfiguration; 410 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | CLANG_ENABLE_MODULES = YES; 414 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 415 | ENABLE_BITCODE = NO; 416 | INFOPLIST_FILE = Runner/Info.plist; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 418 | PRODUCT_BUNDLE_IDENTIFIER = com.slins.flutterfft.flutterFftExample; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 421 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 422 | SWIFT_VERSION = 5.0; 423 | VERSIONING_SYSTEM = "apple-generic"; 424 | }; 425 | name = Debug; 426 | }; 427 | 97C147071CF9000F007C117D /* Release */ = { 428 | isa = XCBuildConfiguration; 429 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | CLANG_ENABLE_MODULES = YES; 433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 434 | ENABLE_BITCODE = NO; 435 | INFOPLIST_FILE = Runner/Info.plist; 436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 437 | PRODUCT_BUNDLE_IDENTIFIER = com.slins.flutterfft.flutterFftExample; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 440 | SWIFT_VERSION = 5.0; 441 | VERSIONING_SYSTEM = "apple-generic"; 442 | }; 443 | name = Release; 444 | }; 445 | /* End XCBuildConfiguration section */ 446 | 447 | /* Begin XCConfigurationList section */ 448 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 449 | isa = XCConfigurationList; 450 | buildConfigurations = ( 451 | 97C147031CF9000F007C117D /* Debug */, 452 | 97C147041CF9000F007C117D /* Release */, 453 | 249021D3217E4FDB00AE95B9 /* Profile */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 97C147061CF9000F007C117D /* Debug */, 462 | 97C147071CF9000F007C117D /* Release */, 463 | 249021D4217E4FDB00AE95B9 /* Profile */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | /* End XCConfigurationList section */ 469 | }; 470 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 471 | } 472 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | flutter_fft_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 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_fft/flutter_fft.dart'; 3 | 4 | void main() => runApp(Application()); 5 | 6 | class Application extends StatefulWidget { 7 | @override 8 | ApplicationState createState() => ApplicationState(); 9 | } 10 | 11 | class ApplicationState extends State { 12 | double? frequency; 13 | String? note; 14 | int? octave; 15 | bool? isRecording; 16 | 17 | FlutterFft flutterFft = new FlutterFft(); 18 | 19 | _initialize() async { 20 | print("Starting recorder..."); 21 | // print("Before"); 22 | // bool hasPermission = await flutterFft.checkPermission(); 23 | // print("After: " + hasPermission.toString()); 24 | 25 | // Keep asking for mic permission until accepted 26 | while (!(await flutterFft.checkPermission())) { 27 | flutterFft.requestPermission(); 28 | // IF DENY QUIT PROGRAM 29 | } 30 | 31 | // await flutterFft.checkPermissions(); 32 | await flutterFft.startRecorder(); 33 | print("Recorder started..."); 34 | setState(() => isRecording = flutterFft.getIsRecording); 35 | 36 | flutterFft.onRecorderStateChanged.listen( 37 | (data) => { 38 | print("Changed state, received: $data"), 39 | setState( 40 | () => { 41 | frequency = data[1] as double, 42 | note = data[2] as String, 43 | octave = data[5] as int, 44 | }, 45 | ), 46 | flutterFft.setNote = note!, 47 | flutterFft.setFrequency = frequency!, 48 | flutterFft.setOctave = octave!, 49 | print("Octave: ${octave!.toString()}") 50 | }, 51 | onError: (err) { 52 | print("Error: $err"); 53 | }, 54 | onDone: () => {print("Isdone")}); 55 | } 56 | 57 | @override 58 | void initState() { 59 | isRecording = flutterFft.getIsRecording; 60 | frequency = flutterFft.getFrequency; 61 | note = flutterFft.getNote; 62 | octave = flutterFft.getOctave; 63 | super.initState(); 64 | _initialize(); 65 | } 66 | 67 | @override 68 | Widget build(BuildContext context) { 69 | return MaterialApp( 70 | title: "Simple flutter fft example", 71 | theme: ThemeData.dark(), 72 | color: Colors.blue, 73 | home: Scaffold( 74 | backgroundColor: Colors.purple, 75 | body: Center( 76 | child: Column( 77 | mainAxisAlignment: MainAxisAlignment.center, 78 | children: [ 79 | isRecording! 80 | ? Text("Current note: ${note!},${octave!.toString()}", 81 | style: TextStyle(fontSize: 30)) 82 | : Text("Not Recording", style: TextStyle(fontSize: 35)), 83 | isRecording! 84 | ? Text( 85 | "Current frequency: ${frequency!.toStringAsFixed(2)}", 86 | style: TextStyle(fontSize: 30)) 87 | : Text("Not Recording", style: TextStyle(fontSize: 35)) 88 | ], 89 | ), 90 | ), 91 | )); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_fft_example 2 | description: Demonstrates how to use the flutter_fft 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 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | flutter_fft: 15 | # When depending on this package from a real application you should use: 16 | # flutter_fft: ^x.y.z 17 | # See https://dart.dev/tools/pub/dependencies#version-constraints 18 | # The example app is bundled with the plugin so we use a path dependency on 19 | # the parent directory to use the current plugin's version. 20 | path: ../ 21 | 22 | # The following adds the Cupertino Icons font to your application. 23 | # Use with the CupertinoIcons class for iOS style icons. 24 | cupertino_icons: ^1.0.2 25 | 26 | dev_dependencies: 27 | flutter_test: 28 | sdk: flutter 29 | 30 | # For information on the generic Dart part of this file, see the 31 | # following page: https://dart.dev/tools/pub/pubspec 32 | 33 | # The following section is specific to Flutter. 34 | flutter: 35 | 36 | # The following line ensures that the Material Icons font is 37 | # included with your application, so that you can use the icons in 38 | # the material Icons class. 39 | uses-material-design: true 40 | 41 | # To add assets to your application, add an assets section, like this: 42 | # assets: 43 | # - images/a_dot_burr.jpeg 44 | # - images/a_dot_ham.jpeg 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 | -------------------------------------------------------------------------------- /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/ephemeral/ 38 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slins-23/flutter-fft/cf65b6e965cca464796fcf07ab1b9cf67953addd/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/FlutterFftPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface FlutterFftPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/Classes/FlutterFftPlugin.m: -------------------------------------------------------------------------------- 1 | #import "FlutterFftPlugin.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 "flutter_fft-Swift.h" 9 | #endif 10 | 11 | @implementation FlutterFftPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftFlutterFftPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /ios/Classes/SwiftFlutterFftPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | public class SwiftFlutterFftPlugin: NSObject, FlutterPlugin { 5 | public static func register(with registrar: FlutterPluginRegistrar) { 6 | let channel = FlutterMethodChannel(name: "flutter_fft", binaryMessenger: registrar.messenger()) 7 | let instance = SwiftFlutterFftPlugin() 8 | registrar.addMethodCallDelegate(instance, channel: channel) 9 | } 10 | 11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 12 | result("iOS " + UIDevice.current.systemVersion) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ios/flutter_fft.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint flutter_fft.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'flutter_fft' 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.dependency 'Flutter' 18 | s.platform = :ios, '8.0' 19 | 20 | # Flutter.framework does not contain a i386 slice. 21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } 22 | s.swift_version = '5.0' 23 | end 24 | -------------------------------------------------------------------------------- /lib/flutter_fft.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/services.dart'; 3 | 4 | class FlutterFft { 5 | static const MethodChannel _channel = 6 | const MethodChannel("com.slins.flutterfft/record"); 7 | 8 | StreamController>? _recorderController; 9 | 10 | /// Returns the recorder stream 11 | Stream> get onRecorderStateChanged => 12 | _recorderController!.stream; 13 | 14 | bool _isRecording = false; 15 | 16 | double _subscriptionDuration = 0.25; 17 | 18 | int _numChannels = 1; 19 | int _sampleRate = 44100; 20 | AndroidAudioSource _androidAudioSource = AndroidAudioSource.MIC; 21 | double _tolerance = 1.0; 22 | 23 | double _frequency = 0; 24 | 25 | String _note = ""; 26 | double _target = 0; 27 | double _distance = 0; 28 | int _octave = 0; 29 | 30 | String _nearestNote = ""; 31 | double _nearestTarget = 0; 32 | double _nearestDistance = 0; 33 | int _nearestOctave = 0; 34 | 35 | bool _isOnPitch = false; 36 | 37 | /// Highest to lowest string 38 | List _tuning = ["E4", "B3", "G3", "D3", "A2", "E2"]; 39 | 40 | /// Returns whether it's recording or not 41 | bool get getIsRecording => _isRecording; 42 | 43 | /// Returns subscription duration 44 | /// 45 | /// How often data gets updated 46 | double get getSubscriptionDuration => _subscriptionDuration; 47 | 48 | /// Returns channels 49 | int get getNumChannels => _numChannels; 50 | 51 | /// Returns sample rate 52 | int get getSampleRate => _sampleRate; 53 | 54 | /// Returns android audio source 55 | AndroidAudioSource get getAndroidAudioSource => _androidAudioSource; 56 | 57 | /// Returns tolerance 58 | /// 59 | /// How many HZ away can a frequency be from the target and still be considered on pitch 60 | double get getTolerance => _tolerance; 61 | 62 | /// Returns current frequency 63 | double get getFrequency => _frequency; 64 | 65 | /// Returns current note 66 | String get getNote => _note; 67 | 68 | /// Returns current target 69 | double get getTarget => _target; 70 | 71 | /// Returns distance between current frequecy and target 72 | double get getDistance => _distance; 73 | 74 | /// Returns current octave 75 | int get getOctave => _octave; 76 | 77 | /// Returns nearest target note 78 | /// 79 | /// Note which is in the tuning target and has the closest frequency 80 | String get getNearestNote => _nearestNote; 81 | 82 | /// Returns nearest target frequency 83 | /// 84 | /// Frequency which is in the tuning target and has the least distance to the current frequency 85 | double get getNearestTarget => _nearestTarget; 86 | 87 | /// Returns distance of the nearest target note 88 | /// 89 | /// Smallest distance between the current frequency and one (the nearest) that is in the tuning target 90 | double get getNearestDistance => _nearestDistance; 91 | 92 | /// Returns octave of the nearest target note 93 | int get getNearestOctave => _nearestOctave; 94 | 95 | /// Returns whether the current note/frequency is on pitch 96 | /// 97 | /// Considered on pitch when current frequency/note is in the tuning target and within a given error (local tolerance) of the closest frequency 98 | bool get getIsOnPitch => _isOnPitch; 99 | 100 | /// Returns current tuning 101 | /// 102 | /// List of strings where each element is a string containing 2 characters, the 1st is the note as an alphabetic letter and the 2nd is a number indicating the octave. 103 | /// i.e. ["E2", "A2", "D3", "G3", "B3", "E4"]; 104 | List get getTuning => _tuning; 105 | 106 | set setIsRecording(bool isRecording) => _isRecording = isRecording; 107 | set setSubscriptionDuration(double subscriptionDuration) => 108 | _subscriptionDuration = subscriptionDuration; 109 | set setTolerance(double tolerance) => _tolerance = tolerance; 110 | set setFrequency(double frequency) => _frequency = frequency; 111 | 112 | set setNumChannels(int numChannels) => _numChannels = numChannels; 113 | set setSampleRate(int sampleRate) => _sampleRate = sampleRate; 114 | set setAndroidAudioSource(AndroidAudioSource androidAudioSource) => 115 | _androidAudioSource = androidAudioSource; 116 | 117 | set setNote(String note) => _note = note; 118 | set setTarget(double target) => _target = target; 119 | set setDistance(double distance) => _distance = distance; 120 | set setOctave(int octave) => _octave = octave; 121 | 122 | set setNearestNote(String nearestNote) => _nearestNote = nearestNote; 123 | set setNearestTarget(double nearestTarget) => _nearestTarget = nearestTarget; 124 | set setNearestDistance(double nearestDistance) => 125 | _nearestDistance = nearestDistance; 126 | set setNearestOctave(int nearestOctave) => _nearestOctave = nearestOctave; 127 | 128 | set setIsOnPitch(bool isOnPitch) => _isOnPitch = isOnPitch; 129 | 130 | set setTuning(List tuning) => _tuning = tuning; 131 | 132 | /// Sets up the recorder stream and call handler 133 | Future _setRecorderCallback() async { 134 | if (_recorderController == null) { 135 | _recorderController = new StreamController.broadcast(); 136 | } 137 | 138 | _channel.setMethodCallHandler((MethodCall call) { 139 | // List newARGS = [ 140 | // call.arguments[0], 141 | // call.arguments[1], 142 | // call.arguments[2], 143 | // call.arguments[3], 144 | // call.arguments[4], 145 | // call.arguments[5], 146 | // call.arguments[6], 147 | // call.arguments[7], 148 | // call.arguments[8], 149 | // call.arguments[9], 150 | // call.arguments[10] 151 | // ]; 152 | 153 | // List ok = call.arguments; 154 | 155 | // print("Runtime args: ${call.arguments.runtimeType}"); 156 | // print("Runtime newARGS: ${newARGS.runtimeType}"); 157 | // print("Equal?: ${call.arguments == newARGS}"); 158 | // print("Equal2?: ${ok == newARGS}"); 159 | // _recorderController!.add(newARGS); 160 | // _recorderController!.add(call.arguments.toString()); 161 | // _recorderController!.add(["Equipe rocket"]); 162 | 163 | switch (call.method) { 164 | case "updateRecorderProgress": 165 | if (_recorderController != null) { 166 | List newARGS = [ 167 | call.arguments[0], 168 | call.arguments[1], 169 | call.arguments[2], 170 | call.arguments[3], 171 | call.arguments[4], 172 | call.arguments[5], 173 | call.arguments[6], 174 | call.arguments[7], 175 | call.arguments[8], 176 | call.arguments[9], 177 | call.arguments[10] 178 | ]; 179 | // print("Arguments: ${call.arguments}"); 180 | // _recorderController!.add(call.arguments); 181 | _recorderController!.add(newARGS); 182 | } else { 183 | throw new ArgumentError( 184 | "updateRecorderProgress called but recorder controller is null."); 185 | } 186 | break; 187 | default: 188 | throw new ArgumentError("Unknown method: ${call.method}"); 189 | } 190 | return null as Future; 191 | }); 192 | } 193 | 194 | /// Closes the recorder stream 195 | Future _removeRecorderCallback() async { 196 | if (_recorderController != null) {} 197 | // _recorderController!.close(); 198 | _recorderController! 199 | ..add([]) 200 | ..close(); 201 | _recorderController = null; 202 | } 203 | 204 | /// Returns whether microphone permission was granted 205 | Future checkPermission() async { 206 | return await _channel.invokeMethod("checkPermission"); 207 | } 208 | 209 | /// Prompts the user to grant permission to use the microphone 210 | requestPermission() { 211 | _channel.invokeMethod("requestPermission"); 212 | } 213 | 214 | /// Sets subscription duration, starts recorder from the platform channel, then sets up recorder stream 215 | Future startRecorder() async { 216 | try { 217 | await _channel.invokeMethod("setSubscriptionDuration", 218 | {'sec': this.getSubscriptionDuration}); 219 | } catch (err) { 220 | print("Could not set subscription duration, error: $err"); 221 | } 222 | 223 | if (this.getIsRecording) { 224 | throw new RecorderRunningException("Recorder is already running."); 225 | } 226 | 227 | try { 228 | String result = 229 | await _channel.invokeMethod('startRecorder', { 230 | 'tuning': this.getTuning, 231 | 'numChannels': this.getNumChannels, 232 | 'sampleRate': this.getSampleRate, 233 | 'androidAudioSource': this.getAndroidAudioSource.value, 234 | 'tolerance': this.getTolerance, 235 | }); 236 | 237 | _setRecorderCallback(); 238 | this.setIsRecording = true; 239 | 240 | return result; 241 | } catch (err) { 242 | throw new Exception(err); 243 | } 244 | } 245 | 246 | /// Stops recorder from the platform channel, then closes recorder stream 247 | Future stopRecorder() async { 248 | if (!this.getIsRecording) { 249 | throw new RecorderStoppedException("Recorder is not running."); 250 | } 251 | 252 | String result = await _channel.invokeMethod("stopRecorder"); 253 | this.setIsRecording = false; 254 | _removeRecorderCallback(); 255 | 256 | return result; 257 | } 258 | } 259 | 260 | class RecorderRunningException implements Exception { 261 | final String message; 262 | RecorderRunningException(this.message); 263 | } 264 | 265 | class RecorderStoppedException implements Exception { 266 | final String message; 267 | RecorderStoppedException(this.message); 268 | } 269 | 270 | class AndroidAudioSource { 271 | final _value; 272 | const AndroidAudioSource._internal(this._value); 273 | toString() => 'AndroidAudioSource.$_value'; 274 | int get value => _value; 275 | 276 | static const DEFAULT = const AndroidAudioSource._internal(0); 277 | static const MIC = const AndroidAudioSource._internal(1); 278 | static const VOICE_UPLINK = const AndroidAudioSource._internal(2); 279 | static const VOICE_DOWNLINK = const AndroidAudioSource._internal(3); 280 | static const CAMCORDER = const AndroidAudioSource._internal(4); 281 | static const VOICE_RECOGNITION = const AndroidAudioSource._internal(5); 282 | static const VOICE_COMMUNICATION = const AndroidAudioSource._internal(6); 283 | static const REMOTE_SUBMIX = const AndroidAudioSource._internal(7); 284 | static const UNPROCESSED = const AndroidAudioSource._internal(8); 285 | static const RADIO_TUNER = const AndroidAudioSource._internal(9); 286 | static const HOTWORD = const AndroidAudioSource._internal(10); 287 | } 288 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_fft 2 | description: Pitch detection plugin, made for my personal project. Makes use of platform channels (currently Android only) in order to process audio in real-time and give feedback. 3 | version: 1.0.2+6 4 | homepage: https://github.com/Slins-23/flutter-fft 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | flutter: ">=1.20.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | 18 | # For information on the generic Dart part of this file, see the 19 | # following page: https://dart.dev/tools/pub/pubspec 20 | 21 | # The following section is specific to Flutter. 22 | flutter: 23 | # This section identifies this Flutter project as a plugin project. 24 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily 25 | # be modified. They are used by the tooling to maintain consistency when 26 | # adding or updating assets for this project. 27 | plugin: 28 | platforms: 29 | android: 30 | package: com.slins.flutterfft 31 | pluginClass: FlutterFftPlugin 32 | ios: 33 | pluginClass: FlutterFftPlugin 34 | 35 | # To add assets to your plugin package, add an assets section, like this: 36 | # assets: 37 | # - images/a_dot_burr.jpeg 38 | # - images/a_dot_ham.jpeg 39 | # 40 | # For details regarding assets in packages, see 41 | # https://flutter.dev/assets-and-images/#from-packages 42 | # 43 | # An image asset can refer to one or more resolution-specific "variants", see 44 | # https://flutter.dev/assets-and-images/#resolution-aware. 45 | 46 | # To add custom fonts to your plugin package, add a fonts section here, 47 | # in this "flutter" section. Each entry in this list should have a 48 | # "family" key with the font family name, and a "fonts" key with a 49 | # list giving the asset and other descriptors for the font. For 50 | # example: 51 | # fonts: 52 | # - family: Schyler 53 | # fonts: 54 | # - asset: fonts/Schyler-Regular.ttf 55 | # - asset: fonts/Schyler-Italic.ttf 56 | # style: italic 57 | # - family: Trajan Pro 58 | # fonts: 59 | # - asset: fonts/TrajanPro.ttf 60 | # - asset: fonts/TrajanPro_Bold.ttf 61 | # weight: 700 62 | # 63 | # For details regarding fonts in packages, see 64 | # https://flutter.dev/custom-fonts/#from-packages 65 | --------------------------------------------------------------------------------