foley.sources.pyfxr.adapter#
pyfxr procedural adapter: a category preset, seeded, rendered to audio bytes (#76).
pyfxr’s presets (pyfxr.laser(), pyfxr.pickup(), …) draw their parameters from
the module-level random of pyfxr. The adapter swaps a random.Random(seed)
in for the one draw, under a lock, and puts the module back: the global random is
never reseeded. The drawn parameters, with the caller’s provider_params over them,
build a pyfxr.SFX; its full resolved parameter set (every field, defaults included)
is recorded in generation_params, so the clip can be rebuilt from parameters alone.
pyfxr renders mono 16-bit PCM at pyfxr.SAMPLE_RATE (44.1 kHz) at full scale; the
adapter scales it to float with the config’s render gain, pads a blip shorter than
Tier-0 QC admits (pad_to_qc_minimum()), and encodes it with
foley.audio.encode(). A noise-waveform clip records bit_exact: False. The licence is
procedural-free with is_ai_generated=False (no disclosure, no watermark). The
adapter does no storage: foley.generate() ingests the clip.
Module Attributes
Registry convention (arioso): the loader imports |
Classes
Registry convention (arioso): the loader imports |
|
|
The pyfxr procedural adapter (a |
- foley.sources.pyfxr.adapter.Adapter#
Registry convention (arioso): the loader imports
adapter.Adapter.
- class foley.sources.pyfxr.adapter.PyfxrAdapter(config=None)[source]#
Bases:
objectThe pyfxr procedural adapter (a
GenerateAdapter).- Parameters:
config (
Optional[dict]) – TheSOURCE_CONFIG(defaults to the module’s), passed positionally by the registry’s lazy loader.
- generate(prompt, *, preset=None, seed=None, provider_params=None, loop=False, output_format='wav', **kw)[source]#
Synthesize the category preset
promptnames (orpreset).- Parameters:
prompt (
str) – The sound description; picks the preset whenpresetis not given (config['preset_keywords']), and is the clip’s caption.preset (
Optional[str]) – A canonical preset (config['presets']), overriding the prompt.seed (
Optional[int]) – Seeds the preset’s parameter draw.Nonedraws one (draw_seed()) and records it.provider_params (
Optional[dict]) – Nativepyfxr.SFXparams (base_freq,env_decay,wave_type, …) set over the preset’s draw.loop (
bool) – No native param: noted and ignored.output_format (
str) – No native param (the audio layer’s): noted and ignored.**kw – Other affordances (
duration_s,steps, …): noted and ignored.
- Return type:
- Returns:
A
GeneratedClipunderprocedural-free,is_ai_generated=False.- Raises:
UnsupportedParameter – When no preset is given and none matches the prompt.