File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,27 @@ export interface UseOscilloscopeProps {
1111
1212const FFT_SIZE = 1024
1313
14+ /**
15+ * `useOscilloscope` is a custom React hook that integrates with Tone.js to create an oscilloscope.
16+ * It is designed to capture and display real-time waveform data from an audio source.
17+ *
18+ * @param {UseOscilloscopeProps } props - The configuration properties for the oscilloscope.
19+ * @param {number } [props.fftSize=1024] - The FFT size, must be a power of 2. Default is 1024.
20+ * @param {Function } props.onReady - Callback executed when the oscilloscope is ready.
21+ * @param {Function } props.onError - Callback executed in case of an error.
22+ *
23+ * @returns {object } An object containing various properties and methods for the oscilloscope:
24+ * - init: Method to initialize the oscilloscope.
25+ * - analyser: The Tone.Analyser instance used by the oscilloscope.
26+ * - data: The current waveform data captured by the oscilloscope.
27+ * - getData: Method to retrieve the current waveform data.
28+ * - observe: Method to start the data observation.
29+ * - cancelObserve: Method to stop the data observation.
30+ * - error: Boolean indicating if an error has occurred.
31+ * - errorMessage: The error message in case of an error.
32+ *
33+ * This hook can be useful in audio analysis applications, allowing for real-time visualization of waveform data.
34+ */
1435export const useOscilloscope = ( props : UseOscilloscopeProps = { } ) => {
1536 const { fftSize = FFT_SIZE , onReady, onError } = props
1637
You can’t perform that action at this time.
0 commit comments