{"id":28374083,"url":"https://github.com/rnheroes/react-native-pitchy","last_synced_at":"2025-06-26T19:37:24.125Z","repository":{"id":251179756,"uuid":"834480518","full_name":"rnheroes/react-native-pitchy","owner":"rnheroes","description":"A real-time pitch detection library for React Native.","archived":false,"fork":false,"pushed_at":"2024-08-01T09:06:07.000Z","size":1250,"stargazers_count":48,"open_issues_count":3,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-25T18:46:01.758Z","etag":null,"topics":["native","pitch","pitch-detection","pitch-estimation","react","react-native"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-native-pitchy","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rnheroes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-27T11:54:50.000Z","updated_at":"2025-06-23T14:23:40.000Z","dependencies_parsed_at":"2024-08-01T10:31:15.139Z","dependency_job_id":"5d215b70-af32-4deb-8377-720b6028c4dc","html_url":"https://github.com/rnheroes/react-native-pitchy","commit_stats":null,"previous_names":["yigithanyucedag/react-native-pitchy"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rnheroes/react-native-pitchy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnheroes%2Freact-native-pitchy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnheroes%2Freact-native-pitchy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnheroes%2Freact-native-pitchy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnheroes%2Freact-native-pitchy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rnheroes","download_url":"https://codeload.github.com/rnheroes/react-native-pitchy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnheroes%2Freact-native-pitchy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262133446,"owners_count":23264216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["native","pitch","pitch-detection","pitch-estimation","react","react-native"],"created_at":"2025-05-29T21:09:34.651Z","updated_at":"2025-06-26T19:37:24.102Z","avatar_url":"https://github.com/rnheroes.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-pitchy\n\nA real-time pitch detection library for React Native.\n\n## Installation\n\n1. Install the library using a package manager of your choice:\n\n```sh\nnpm install react-native-pitchy\n```\n\n2. **Linking (iOS only):**\n\n```sh\nnpx pod-install\n```\n\n3. **Rebuild your app** after installing the package.\n\n\u003e On iOS simulators, pitch detection may not work as expected due to the **lack of microphone support**. Make sure to test on a real device.\n\n## Permissions\n\nMicrophone permissions are **required for pitch detection** to work. Make sure to request the necessary permissions before starting pitch detection. You can use a library like [react-native-permissions](https://github.com/zoontek/react-native-permissions) to request permissions.\n\n### iOS\n\n`Microphone`\n\n### Android\n\n`RECORD_AUDIO`\n\n## Usage\n\n1. Import the library:\n\n```tsx\nimport Pitchy, { PitchyConfig, PitchyEventCallback } from 'react-native-pitchy';\n```\n\n2. **(Optional)** Configure Pitchy before initialization:\n\n```tsx\nconst config: PitchyConfig = {\n  bufferSize: 4096, // Adjust buffer size for performance vs accuracy\n  minVolume: -60, // Minimum volume threshold for pitch detection (in dB)\n};\n```\n\n3. Initialize Pitchy with the optional configuration:\n\n```tsx\nPitchy.init(config);\n```\n\n4. Start pitch detection:\n\n```tsx\nPitchy.start().then(() =\u003e {\n  console.log('Pitch detection started!');\n});\n```\n\n5. Listen to pitch events:\n\n```tsx\nconst handlePitchDetected: PitchyEventCallback = (data) =\u003e {\n  console.log('Pitch detected:', data.pitch);\n};\n\nconst subscription = Pitchy.addListener(handlePitchDetected);\n\n// Remember to unsubscribe later to avoid memory leaks\nsubscription.remove();\n```\n\n6. Stop pitch detection:\n\n```tsx\nPitchy.stop().then(() =\u003e {\n  console.log('Pitch detection stopped!');\n});\n```\n\n7. Check if pitch detection is running:\n\n```tsx\nPitchy.isRecording().then((isRecording) =\u003e {\n  console.log('Pitch detection is recording:', isRecording);\n});\n```\n\n## API\n\n### Types\n\n- `PitchyAlgorithm`: String representing the pitch detection algorithm (currently only supports `\"ACF2+\"`)\n- `PitchyConfig`: Configuration object for Pitchy.init\n  - `bufferSize`: (optional) Number representing the audio buffer size (default: 4096)\n  - `minVolume`: (optional) Number representing the minimum volume threshold (default: -60)\n  - `algorithm`: (optional) `PitchyAlgorithm` used for detection (default: \"ACF2+\")\n- `PitchyEventCallback`: Function called when pitch is detected. Receives an object with a `pitch` property (number)\n\n### Methods\n\n- `Pitchy.init(config?: PitchyConfig)`: Initializes Pitchy with an optional configuration.\n- `Pitchy.start()`: Starts pitch detection and returns a Promise.\n- `Pitchy.stop()`: Stops pitch detection and returns a Promise.\n- `Pitchy.isRecording()`: Checks if pitch detection is currently running and returns a Promise resolving to a boolean.\n- `Pitchy.addListener(callback: PitchyEventCallback)`: Adds a listener for the `onPitchDetected` event.\n\n## Roadmap\n\n- [ ] Fix example app (permissions issue related to builder-bob)\n- [ ] Add FFT for ACF2+ algorithm (currently uses a naive implementation)\n- [ ] Add more pitch detection algorithms\n\n## Examples\n\nCheck out the [example app](example) for a simple implementation of pitch detection using Pitchy.\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnheroes%2Freact-native-pitchy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnheroes%2Freact-native-pitchy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnheroes%2Freact-native-pitchy/lists"}