useAudio
Subscribes to system audio information streamed from the Fluxlay desktop app. Useful for building audio visualizers and music-reactive wallpapers.
Import
Signature
Parameters
AudioOptions
Return Value
Returns { rms: 0, peak: 0, spectrum: [] } until the first event is received.
Example
Combining with useProperties
Combine with useProperties to let end users adjust the number of bands.
Notes
- Audio data is streamed at approximately 30 fps.
- The spectrum uses A-weighting (IEC 61672) so that the frequency balance matches human hearing perception.
- Audio capture starts when the first subscriber connects and stops when all subscribers disconnect.
- Requires "Screen Recording & System Audio Recording" permission on macOS (System Settings > Privacy & Security > Screen Recording).
- This hook only works inside the Fluxlay desktop app. In a normal browser, it returns the initial zero values.
- When
optionsvalues change, the stream is automatically reconnected.