From 899f245be4ac6bc18e9db80d2bb025537ac4555d Mon Sep 17 00:00:00 2001 From: 1fabiopereira Date: Sun, 4 Jun 2023 00:42:18 +0000 Subject: [PATCH] Deploy website - based on 6d8c2dce3b3a270fda60e168e0c2153b1324328a --- 404.html | 4 ++-- assets/js/{6476eba6.e3b2d50b.js => 6476eba6.f4b9a74b.js} | 2 +- .../{runtime~main.c0e9ed8b.js => runtime~main.04f85e24.js} | 2 +- docs/before-you-start.html | 4 ++-- docs/code-of-conduct.html | 4 ++-- docs/contributing.html | 4 ++-- docs/installation.html | 4 ++-- docs/license.html | 4 ++-- docs/playground.html | 4 ++-- docs/usage.html | 6 +++--- index.html | 4 ++-- 11 files changed, 21 insertions(+), 21 deletions(-) rename assets/js/{6476eba6.e3b2d50b.js => 6476eba6.f4b9a74b.js} (66%) rename assets/js/{runtime~main.c0e9ed8b.js => runtime~main.04f85e24.js} (98%) diff --git a/404.html b/404.html index a855a1c..57998ea 100644 --- a/404.html +++ b/404.html @@ -5,13 +5,13 @@ Page Not Found | React Native Pitch Detector - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/6476eba6.e3b2d50b.js b/assets/js/6476eba6.f4b9a74b.js similarity index 66% rename from assets/js/6476eba6.e3b2d50b.js rename to assets/js/6476eba6.f4b9a74b.js index 9529f0c..7bcaee0 100644 --- a/assets/js/6476eba6.e3b2d50b.js +++ b/assets/js/6476eba6.f4b9a74b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkreact_native_pitch_detector_docs=self.webpackChunkreact_native_pitch_detector_docs||[]).push([[827],{3905:function(e,t,n){n.d(t,{Zo:function(){return p},kt:function(){return m}});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l\n\n// To stop recording\nawait PitchDetector.stop(); // Promise\n\n// To get current status\nawait PitchDetector.isRecording(); // Promise\n\n// To listener results\nconst subscription = PitchDetector.addListener(console.log) // { frequency: 440.14782, tone: \"C#\" }\n\n// To stop listen results\nPitchDetector.removeListener(subscription)\n\n")),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"You can see a complete implementation at ",(0,a.kt)("a",{parentName:"p",href:"/react-native-pitch-detector/docs/playground"},"Playground"),".")),(0,a.kt)("h3",{id:"permissions"},"Permissions"),(0,a.kt)("p",null,"To use microphone we need give permission to our app, for that we use a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/zoontek/react-native-permissions"},"react-native-permissions")," library."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"}," yarn add react-native-permissions\n")),(0,a.kt)("p",null,"Or using npm:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"npm install react-native-permissions\n")),(0,a.kt)("p",null,"After that, on ",(0,a.kt)("inlineCode",{parentName:"p"},"package.json")," file add de following lines:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json"},'"reactNativePermissionsIOS": [\n "Microphone"\n]\n')),(0,a.kt)("p",null,"For iOS you need edit ",(0,a.kt)("inlineCode",{parentName:"p"},"Info.plist"),", add:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-xml"},"NSMicrophoneUsageDescription\nPerform pitch detection\n")),(0,a.kt)("p",null,"Lastly for iOS you need execute:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"(cd ios && pod install)\n")),(0,a.kt)("p",null,"For Android you need change ",(0,a.kt)("inlineCode",{parentName:"p"},"AndroidManifest.xml"),", and add:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-xml"},'\n')),(0,a.kt)("p",null,"and finally recompile your project both platforms."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"\ud83d\udca1 In future the idea is remove react-native-permission dependency and develop in house permission manager.")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkreact_native_pitch_detector_docs=self.webpackChunkreact_native_pitch_detector_docs||[]).push([[827],{3905:function(e,t,n){n.d(t,{Zo:function(){return p},kt:function(){return m}});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l\n\n// To stop recording\nawait PitchDetector.stop(); // Promise\n\n// To get current status\nawait PitchDetector.isRecording(); // Promise\n\n// To listener results\nconst subscription = PitchDetector.addListener(console.log) // { frequency: 440.14782, tone: \"C#\" }\n\n// To stop listen results\nPitchDetector.removeListener()\n\n")),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"You can see a complete implementation at ",(0,a.kt)("a",{parentName:"p",href:"/react-native-pitch-detector/docs/playground"},"Playground"),".")),(0,a.kt)("h3",{id:"permissions"},"Permissions"),(0,a.kt)("p",null,"To use microphone we need give permission to our app, for that we use a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/zoontek/react-native-permissions"},"react-native-permissions")," library."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"}," yarn add react-native-permissions\n")),(0,a.kt)("p",null,"Or using npm:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"npm install react-native-permissions\n")),(0,a.kt)("p",null,"After that, on ",(0,a.kt)("inlineCode",{parentName:"p"},"package.json")," file add de following lines:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json"},'"reactNativePermissionsIOS": [\n "Microphone"\n]\n')),(0,a.kt)("p",null,"For iOS you need edit ",(0,a.kt)("inlineCode",{parentName:"p"},"Info.plist"),", add:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-xml"},"NSMicrophoneUsageDescription\nPerform pitch detection\n")),(0,a.kt)("p",null,"Lastly for iOS you need execute:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"(cd ios && pod install)\n")),(0,a.kt)("p",null,"For Android you need change ",(0,a.kt)("inlineCode",{parentName:"p"},"AndroidManifest.xml"),", and add:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-xml"},'\n')),(0,a.kt)("p",null,"and finally recompile your project both platforms."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"\ud83d\udca1 In future the idea is remove react-native-permission dependency and develop in house permission manager.")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.c0e9ed8b.js b/assets/js/runtime~main.04f85e24.js similarity index 98% rename from assets/js/runtime~main.c0e9ed8b.js rename to assets/js/runtime~main.04f85e24.js index 3a5aa16..b095674 100644 --- a/assets/js/runtime~main.c0e9ed8b.js +++ b/assets/js/runtime~main.04f85e24.js @@ -1 +1 @@ -!function(){"use strict";var e,t,n,r,o,a={},c={};function i(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={id:e,loaded:!1,exports:{}};return a[e].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}i.m=a,i.c=c,e=[],i.O=function(t,n,r,o){if(!n){var a=1/0;for(d=0;d=o)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(c=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},i.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);i.r(o);var a={};t=t||[null,n({}),n([]),n(n)];for(var c=2&r&&e;"object"==typeof c&&!~t.indexOf(c);c=n(c))Object.getOwnPropertyNames(c).forEach((function(t){a[t]=function(){return e[t]}}));return a.default=function(){return e},i.d(o,a),o},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=function(e){return Promise.all(Object.keys(i.f).reduce((function(t,n){return i.f[n](e,t),t}),[]))},i.u=function(e){return"assets/js/"+({53:"935f2afb",80:"4d54d076",202:"8879b7a8",217:"3b8c55ea",237:"1df93b7f",352:"dea0f9ea",450:"a679ac6c",514:"1be78505",529:"ac5280f2",817:"cddf5d51",827:"6476eba6",918:"17896441",938:"81c55a5a"}[e]||e)+"."+{53:"cf518c83",80:"c0f10c7e",202:"fcee044a",217:"19260e61",237:"a273e3fc",352:"85032b24",450:"6a25e22c",514:"16d1903b",529:"f6f4cc37",817:"827806b2",827:"e3b2d50b",918:"9b305ce5",938:"550504a9",972:"e0776935"}[e]+".js"},i.miniCssF=function(e){},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="react-native-pitch-detector-docs:",i.l=function(e,t,n,a){if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var f=document.getElementsByTagName("script"),d=0;d=o)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(c=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},i.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);i.r(o);var a={};t=t||[null,n({}),n([]),n(n)];for(var c=2&r&&e;"object"==typeof c&&!~t.indexOf(c);c=n(c))Object.getOwnPropertyNames(c).forEach((function(t){a[t]=function(){return e[t]}}));return a.default=function(){return e},i.d(o,a),o},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=function(e){return Promise.all(Object.keys(i.f).reduce((function(t,n){return i.f[n](e,t),t}),[]))},i.u=function(e){return"assets/js/"+({53:"935f2afb",80:"4d54d076",202:"8879b7a8",217:"3b8c55ea",237:"1df93b7f",352:"dea0f9ea",450:"a679ac6c",514:"1be78505",529:"ac5280f2",817:"cddf5d51",827:"6476eba6",918:"17896441",938:"81c55a5a"}[e]||e)+"."+{53:"cf518c83",80:"c0f10c7e",202:"fcee044a",217:"19260e61",237:"a273e3fc",352:"85032b24",450:"6a25e22c",514:"16d1903b",529:"f6f4cc37",817:"827806b2",827:"f4b9a74b",918:"9b305ce5",938:"550504a9",972:"e0776935"}[e]+".js"},i.miniCssF=function(e){},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="react-native-pitch-detector-docs:",i.l=function(e,t,n,a){if(r[e])r[e].push(t);else{var c,u;if(void 0!==n)for(var f=document.getElementsByTagName("script"),d=0;d Before you start | React Native Pitch Detector - +

Before you start

React Native Pitch Detector is a module created to be used alongside React Native, so previous experience is required. If you need, can start with their Getting Started tutorial and come back here after.

This module is compatible with Android and iOS devices, we assume that you have Android and iOS environment configured, in the case that you don't have, we suggest that you setup enviroment before.

For android devices we use a TarsosDSP library to perform a pitch estimation and for iOS devices we use Beethoven library, you can see more about these on yours respectives documentations.

If you see something wrong, feel free to report an issue on Github, pull requests are encouraged. Know more about it on Contributing session.

📖 TarsosDSP - https://github.com/JorenSix/TarsosDSP

📖 Beethoven - https://github.com/vadymmarkov/Beethoven

- + \ No newline at end of file diff --git a/docs/code-of-conduct.html b/docs/code-of-conduct.html index 5874019..0b61b18 100644 --- a/docs/code-of-conduct.html +++ b/docs/code-of-conduct.html @@ -5,7 +5,7 @@ Code of Conduct | React Native Pitch Detector - + @@ -60,7 +60,7 @@ Mozilla's code of conduct enforcement ladder.

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

- + \ No newline at end of file diff --git a/docs/contributing.html b/docs/contributing.html index 21aaa8f..b6aaa26 100644 --- a/docs/contributing.html +++ b/docs/contributing.html @@ -5,13 +5,13 @@ Contributing | React Native Pitch Detector - +

Contributing

Contributions are always welcome, no matter how large or small!

We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the code of conduct.

Development workflow

To get started with the project, run yarn in the root directory to install the required dependencies for each package:

yarn

While it's possible to use npm, the tooling is built around yarn, so you'll have an easier time if you use yarn for development.

While developing, you can run the example app to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app.

To start the packager:

yarn example start

To run the example app on Android:

yarn example android

To run the example app on iOS:

yarn example ios

Make sure your code passes TypeScript and ESLint. Run the following to verify:

yarn typecheck
yarn lint

To fix formatting errors, run the following:

yarn lint --fix

Remember to add tests for your change if possible. Run the unit tests by:

yarn test

To edit the Objective-C or Swift files, open example/ios/PitchDetectorExample.xcworkspace in XCode and find the source files at Pods > Development Pods > react-native-pitch-detector.

To edit the Java or Kotlin files, open example/android in Android studio and find the source files at react-native-pitch-detector under Android.

Commit message convention

We follow the conventional commits specification for our commit messages:

  • fix: bug fixes, e.g. fix crash due to deprecated method.
  • feat: new features, e.g. add new method to the module.
  • refactor: code refactor, e.g. migrate from class components to hooks.
  • docs: changes into documentation, e.g. add usage example for the module..
  • test: adding or updating tests, e.g. add integration tests using detox.
  • chore: tooling changes, e.g. change CI config.

Our pre-commit hooks verify that your commit message matches this format when committing.

Linting and tests

ESLint, Prettier, TypeScript

We use TypeScript for type checking, ESLint with Prettier for linting and formatting the code, and Jest for testing.

Our pre-commit hooks verify that the linter and tests pass when committing.

Publishing to npm

We use release-it to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.

To publish new versions, run the following:

yarn release

Scripts

The package.json file contains various scripts for common tasks:

  • yarn bootstrap: setup project by installing all dependencies and pods.
  • yarn typecheck: type-check files with TypeScript.
  • yarn lint: lint files with ESLint.
  • yarn test: run unit tests with Jest.
  • yarn example start: start the Metro server for the example app.
  • yarn example android: run the example app on Android.
  • yarn example ios: run the example app on iOS.

Sending a pull request

Working on your first pull request? You can learn how from this free series: How to Contribute to an Open Source Project on GitHub.

When you're sending a pull request:

  • Prefer small pull requests focused on one change.
  • Verify that linters and tests are passing.
  • Review the documentation to make sure it looks good.
  • Follow the pull request template when opening a pull request.
  • For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
- + \ No newline at end of file diff --git a/docs/installation.html b/docs/installation.html index 26765a6..247380f 100644 --- a/docs/installation.html +++ b/docs/installation.html @@ -5,13 +5,13 @@ Installation | React Native Pitch Detector - +

Installation

yarn add react-native-pitch-detector

Or using npm:

npm install react-native-pitch-detector

iOS

After install you need run:

(cd ios && pod install)

Android

Version compatibility: react-native@>=0.66 is required.

- + \ No newline at end of file diff --git a/docs/license.html b/docs/license.html index 3717ed4..ade28e9 100644 --- a/docs/license.html +++ b/docs/license.html @@ -5,7 +5,7 @@ License | React Native Pitch Detector - + @@ -24,7 +24,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

- + \ No newline at end of file diff --git a/docs/playground.html b/docs/playground.html index c6a0da5..deb0b44 100644 --- a/docs/playground.html +++ b/docs/playground.html @@ -5,14 +5,14 @@ Playground | React Native Pitch Detector - +

Playground

💡 It is important to note that you need to use a real device to test the audio input.

To get started with the project, run yarn in the root directory to install the required dependencies for each package:

yarn

While it's possible to use npm, the tooling is built around yarn, so you'll have an easier time if you use yarn for development.

To start the packager:

yarn example start

To run the example app on Android:

yarn example android

To run the example app on iOS:

yarn example ios

If all goes well you will see something like:

Stopped Example Stopped Example

- + \ No newline at end of file diff --git a/docs/usage.html b/docs/usage.html index 7d2264c..e586344 100644 --- a/docs/usage.html +++ b/docs/usage.html @@ -5,13 +5,13 @@ Usage | React Native Pitch Detector - +
-

Usage

API

Below you can see small code snippet that shows how to import and use the main functions.

import { PitchDetector } from 'react-native-pitch-detector';

// To start recording
await PitchDetector.start(); // Promise<void>

// To stop recording
await PitchDetector.stop(); // Promise<void>

// To get current status
await PitchDetector.isRecording(); // Promise<true | false>

// To listener results
const subscription = PitchDetector.addListener(console.log) // { frequency: 440.14782, tone: "C#" }

// To stop listen results
PitchDetector.removeListener(subscription)

You can see a complete implementation at Playground.

Permissions

To use microphone we need give permission to our app, for that we use a react-native-permissions library.

 yarn add react-native-permissions

Or using npm:

npm install react-native-permissions

After that, on package.json file add de following lines:

"reactNativePermissionsIOS": [
"Microphone"
]

For iOS you need edit Info.plist, add:

<key>NSMicrophoneUsageDescription</key>
<string>Perform pitch detection</string>

Lastly for iOS you need execute:

(cd ios && pod install)

For Android you need change AndroidManifest.xml, and add:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

and finally recompile your project both platforms.

💡 In future the idea is remove react-native-permission dependency and develop in house permission manager.

- +

Usage

API

Below you can see small code snippet that shows how to import and use the main functions.

import { PitchDetector } from 'react-native-pitch-detector';

// To start recording
await PitchDetector.start(); // Promise<void>

// To stop recording
await PitchDetector.stop(); // Promise<void>

// To get current status
await PitchDetector.isRecording(); // Promise<true | false>

// To listener results
const subscription = PitchDetector.addListener(console.log) // { frequency: 440.14782, tone: "C#" }

// To stop listen results
PitchDetector.removeListener()

You can see a complete implementation at Playground.

Permissions

To use microphone we need give permission to our app, for that we use a react-native-permissions library.

 yarn add react-native-permissions

Or using npm:

npm install react-native-permissions

After that, on package.json file add de following lines:

"reactNativePermissionsIOS": [
"Microphone"
]

For iOS you need edit Info.plist, add:

<key>NSMicrophoneUsageDescription</key>
<string>Perform pitch detection</string>

Lastly for iOS you need execute:

(cd ios && pod install)

For Android you need change AndroidManifest.xml, and add:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

and finally recompile your project both platforms.

💡 In future the idea is remove react-native-permission dependency and develop in house permission manager.

+ \ No newline at end of file diff --git a/index.html b/index.html index d53006c..c603671 100644 --- a/index.html +++ b/index.html @@ -5,13 +5,13 @@ Hello from React Native Pitch Detector | React Native Pitch Detector - +

🎸

React Native Pitch Detector

High performance real time pitch detection.

- + \ No newline at end of file