2.0.0: Synthesis#
The final step in any AudibleLight data generation pipeline is synthesis, which refers to generating any outputs (e.g., audio, visuals, metadata).
Scene.generate#
Calling scene.generate can be used to do the following:
render IRs for all microphones;
convolve
Eventaudio with IRs for all microphones;combine
Event+Ambienceaudio together WRT theScenenoise floorsave spatial audio for all microphones;
save DCASE-style metadata for all microphones;
save a custom
AudibleLightJSON file for theScene, which can be used to reproduce theSceneat a later date.
[1]:
import os
from audiblelight.core import Scene
from audiblelight import utils
First, we’ll generate a simple scene with one static and one moving Event, + some Ambience
[2]:
scene = Scene(
duration=60,
sample_rate=44100,
backend="rlr",
backend_kwargs=dict(
mesh=utils.get_project_root() / "tests/test_resources/meshes/Oyens.glb"
),
fg_path=utils.get_project_root() / "tests/test_resources/soundevents"
)
scene.add_microphone(microphone_type="ambeovr")
scene.add_event(event_type="static")
scene.add_event(event_type="moving")
scene.add_ambience(noise="gaussian")
CreateContext: Context created
Warning: initializing context twice. Will destroy old context and create a new one.
CreateContext: Context created
Warning: initializing context twice. Will destroy old context and create a new one.
CreateContext: Context created
2025-10-07 17:19:46.852 | INFO | audiblelight.core:add_event:834 - Event added successfully: Static 'Event' with alias 'event000', audio file '/home/huw-cheston/Documents/python_projects/AudibleLight/tests/test_resources/soundevents/musicInstrument/8390.wav' (unloaded, 0 augmentations), 1 emitter(s).
Warning: initializing context twice. Will destroy old context and create a new one.
2025-10-07 17:20:34.473 | INFO | audiblelight.core:add_event:834 - Event added successfully: Moving 'Event' with alias 'event001', audio file '/home/huw-cheston/Documents/python_projects/AudibleLight/tests/test_resources/soundevents/doorCupboard/35632.wav' (unloaded, 0 augmentations), 6 emitter(s).
CreateContext: Context created
Now, we can call scene.generate to dump audio, CSV files, and JSON files inside a given output directory:
[ ]:
os.makedirs("tmp")
scene.generate(output_dir="tmp")
Note that, to avoid saving any particular outputs, we can pass the following arguments:
[ ]:
scene.generate(
audio=False, # don't save audio
metadata_json=False, # don't save JSON
metadata_dcase=False # don't save CSV
)