Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 5 days 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 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-15T01:42:17.000Z (over 3 years ago)
- Last Synced: 2024-11-08T17:16:28.882Z (about 1 month 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: 2
- 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-toneor
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.25RNTone.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 toneP.S. I'm still still learning Obj-C and bridging, so if anyone would like to help with this module they are very welcome!