Creates a new FallbackAudioProxy wrapping the given provider chain.
Ordered list of audio providers to try. Must contain at least one entry for operations to succeed (an empty chain always throws).
EventEmitter on which audio:generate:fallback events
are published so callers can observe the failover path.
const proxy = new FallbackAudioProxy(
[sunoProvider, stableAudioProvider],
new EventEmitter(),
);
Generate music from a text prompt, falling back through the provider chain on failure.
Providers whose IAudioGenerator.supports returns false for
'music' are silently skipped.
The generation request forwarded to each provider.
The result from the first provider that succeeds.
When every provider in the chain fails.
When the chain is empty.
Generate a sound effect from a text prompt, falling back through providers that support SFX.
Providers whose IAudioGenerator.supports returns false for
'sfx' or that lack the generateSFX method are silently skipped.
The SFX request forwarded to each capable provider.
The result from the first provider that succeeds.
When every provider fails or does not support SFX.
Readonly providerIdentifier derived from the first provider in the chain.
Readonly isAlways true — the proxy is ready as soon as it is constructed.
Optional Readonly defaultDefault model from the first provider, if set.
An IAudioGenerator that wraps an ordered chain of audio providers and implements automatic failover for every operation.
Retry chain logic
Providers are tried left-to-right (index 0 first). The first provider that succeeds returns immediately. When a provider throws:
audio:generate:fallbackevent is emitted and the next provider is tried.AggregateErrorcontaining every collected error is thrown.Error('No providers in audio fallback chain')is thrown immediately.For
generateMusic, providers whose IAudioGenerator.supports returnsfalsefor'music'are silently skipped. ForgenerateSFX, providers that don't support'sfx'(or lack the method entirely) are skipped.