https://github.com/oliviachang29/react-native-tone
🎶 Generate sine waves with frequency and amplitude (iOS only).
https://github.com/oliviachang29/react-native-tone
ios react-native tone
Last synced: 3 months ago
JSON representation
🎶 Generate sine waves with frequency and amplitude (iOS only).
- Host: GitHub
- URL: https://github.com/oliviachang29/react-native-tone
- Owner: oliviachang29
- Created: 2018-06-19T08:58:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-15T01:42:17.000Z (over 4 years ago)
- Last Synced: 2025-06-14T11:16:01.409Z (5 months ago)
- Topics: ios, react-native, tone
- Language: Objective-C
- Homepage: https://www.npmjs.com/package/react-native-tone
- Size: 21.5 KB
- Stars: 18
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-react-native - react-native-tone ★7 - Generates simple sine wave, specify a frequency and amplitude. Play sound indefinitely or for a specified time interval (iOS only). (Components / Media)
- awesome-react-native - react-native-tone ★7 - Generates simple sine wave, specify a frequency and amplitude. Play sound indefinitely or for a specified time interval (iOS only). (Components / Media)
- awesome-react-native - react-native-tone ★7 - Generates simple sine wave, specify a frequency and amplitude. Play sound indefinitely or for a specified time interval (iOS only). (Components / Media)
- awesome-react-native - react-native-tone ★7 - Generates simple sine wave, specify a frequency and amplitude. Play sound indefinitely or for a specified time interval (iOS only). (Components / Media)
README
# react-native-tone 🎶
Simple library for playing tones in React Native (iOS only). Bridge of https://github.com/picciano/iOS-Tone-Generator
⚠️ Note: this library is **not actively maintained.**
## Getting started
```
yarn add react-native-tone
or
npm install react-native-tone --save
```
```
react-native link react-native-tone
```
## Usage
Generates simple sine wave, specify a frequency and amplitude. Play sound indefinitely or for a specified time interval.
```
import RNTone from 'react-native-tone';
// In constructor
RNTone.initWithChannels(numChannels, volume) // initalize
// volume ranges from 0.01-0.25
RNTone.play() // play tone, indefinitely
RNTone.playForDuration(seconds) // play specified time interval (in seconds)
RNTone.stop() // stop tone
// Example
RNTone.initWithChannels(2, 0.25) // initalize two channels at full volume
RNTone.setChannelFrequencies([440, 220]) // A4 and A3
RNTone.playForDuration(0.5) // play for half a second
```
## Todo
* Remove clicking sound at beginning and end of tone
P.S. I'm still still learning Obj-C and bridging, so if anyone would like to help with this module they are very welcome!