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

Adapter

Registry convention (arioso): the loader imports adapter.Adapter.

Classes

Adapter

Registry convention (arioso): the loader imports adapter.Adapter.

PyfxrAdapter([config])

The pyfxr procedural adapter (a GenerateAdapter).

foley.sources.pyfxr.adapter.Adapter#

Registry convention (arioso): the loader imports adapter.Adapter.

class foley.sources.pyfxr.adapter.PyfxrAdapter(config=None)[source]#

Bases: object

The pyfxr procedural adapter (a GenerateAdapter).

Parameters:

config (Optional[dict]) – The SOURCE_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 prompt names (or preset).

Parameters:
  • prompt (str) – The sound description; picks the preset when preset is 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. None draws one (draw_seed()) and records it.

  • provider_params (Optional[dict]) – Native pyfxr.SFX params (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:

GeneratedClip

Returns:

A GeneratedClip under procedural-free, is_ai_generated=False.

Raises:

UnsupportedParameter – When no preset is given and none matches the prompt.