Audio File Player
A node that loads and plays an audio file and extracts values from its spectrum. The file can be specified by dragging and dropping onto the node, with the “Choose Audio File” button, or through the path input field. The supported formats are WAV / MP3 / OGG / AIF and AIFF; other extensions are not loaded. The node shows a waveform, a seek bar, the playback time, and a Loop toggle (Loop is ON by default).
Analysis
The following are computed from a 512-bin spectrum (Blackman-Harris window).
- Level — the peak of all bins × Gain
- Bass — 20-200 Hz, Mid — 200-2000 Hz, Treble — 2000-8000 Hz; the average × Gain
- Onset — fires when the spectral flux exceeds the average of the last 43 frames × (1 + OnsetSensitivity) + 0.01. Refractory period 0.1 s
Parameters
- Gain — negative values are treated as 0 (default 1)
- Smoothing — the time constant (seconds) for the value falling. Clamped to a minimum of 0.001, default 0.25. Rises are instant; only falls decay with this time constant
- OnsetSensitivity — negative values are treated as 0 (default 1)
While stopped or at the end, Level / Bass / Mid / Treble are returned to 0 once. Without this, downstream would keep running on the last value even after the sound is stopped.
If you specify a file that fails to load, the previous audio source is stopped and discarded (because the UI and path point at the new file, so the old sound must not keep playing). The waveform display is an auxiliary display that depends on ffmpeg; playback itself continues even if generating it fails.
Input ports
| Port ID | Type |
|---|---|
Play | bool |
Gain | float |
Smoothing | float |
OnsetSensitivity | float |
Output ports
| Port ID | Type |
|---|---|
Level | float |
Bass | float |
Mid | float |
Treble | float |
Onset | trigger |
Scriptable members
| Path | Type |
|---|---|
playInput | bool |
gainInput | float |
smoothingInput | float |
sensitivityInput | float |
currentFilePath | string |
currentPlaying | bool |
currentLoop | bool |
Synapse Apps (scripting)
await synapse.modules.create({ type: "AudioFilePlayer" })