0.2.8 • Published 7 years ago
react-looper v0.2.8
Web Audio API based Looper component for React
- Connect your own
AudioContext
(or use the default one 🤖)
- Connect your own
- Built-in tweakable oscillator as metronome (tick, tick, tick...💣)
- Loop your audio file each X bars (just provide the arrayBuffer 👍)
Installation and usage
yarn add react-looper
Metronome
import Looper from "react-looper"
<Looper playing />
99 BPM
<Looper bpm={99} playing />
Play each 4 bars
<Looper bpm={99} playEach={4} playing />
Props
Name | Type | Default | Description |
---|---|---|---|
audioContext | AudioContext | new AudioContext() | AudioContext object |
bpm | number | 120 | sets the tempo of your loop |
looping | boolean | false | starts or stops your loop |
source | ArrayBuffer | undefined | audio file to play each iteration |
onIteration | function | () => {} | function to invoke each iteration |
playEach | number | undefined | play sound each number of iterations |
Additional props
oscillator
This object can be provided in order to configure Looper's oscillator and its duration (ms).
Name | Type | Default | Description |
---|---|---|---|
detune | number | 0 | OscillatorNode.detune |
duration | number | 0 | duration of the tone in milliseconds |
frequency | number | false | OscillatorNode.frequency |
type | string | "sine" | OscillatorNode.type |
const oscillatorConfig = {
duration: 0.05,
detune: 1,
frequency: 555,
type: "square",
}
<Looper playing oscillator={oscillatorConfig} />
License
MIT Licensed. Copyright (c) Peter Sherhsov 2018.
0.2.8
7 years ago
0.2.7
7 years ago
0.2.6
7 years ago
0.2.5
7 years ago
0.2.4
7 years ago
0.2.3
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.9
7 years ago
0.1.8
7 years ago
0.1.7
7 years ago
0.1.6
7 years ago
0.1.5
7 years ago
0.1.4
7 years ago
0.1.3
7 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago