accompy.synthesis#
Audio synthesis backends for accompy.
Provides abstraction over different synthesis engines:
FluidSynth: Default, uses SoundFonts for realistic instrument sounds
Pyo: Real-time synthesis (future integration with hum package)
The synthesis backends are used to convert MIDI files to audio.
Functions
Get the best available synthesis backend. |
Classes
Abstract base for audio synthesis backends. |
- class accompy.synthesis.SynthesizerBackend[source]#
Bases:
ABCAbstract base for audio synthesis backends.
Subclasses implement specific synthesis engines (FluidSynth, Pyo, etc.).
- abstractmethod classmethod is_available()[source]#
Check if this backend’s dependencies are installed.
- Return type:
- Returns:
True if the backend can be used
- render_to_bytes(midi_path, *, sample_rate=44100)[source]#
Render a MIDI file to PCM bytes (for streaming).
- Parameters:
- Return type:
- Returns:
Raw PCM audio bytes
Note
Default implementation not provided - subclasses should override for streaming support.
- accompy.synthesis.get_default_backend()[source]#
Get the best available synthesis backend.
- Return type:
- Returns:
An instance of an available SynthesizerBackend
- Raises:
RuntimeError – If no synthesis backend is available
Modules
FluidSynth synthesis backend. |