docstr: Test room simulation for fixed parameters.
          
docstr_tok: ["Test","room","simulation","for","fixed","parameters","."]
code: def test_simulate_room_mix(self, test_data_dir):
      """Test room simulation for fixed parameters."""
      # Test setup
      data_dir = os.path.join(test_data_dir, "asr", "data_simulation")
  
      # Minimal configuration
      sample_rate = 16000
      target_cfg = {
          "room_filepath": os.path.join(data_dir, "test_room.h5"),
          "mic_positions": np.random.rand(6, 3),  # random positions
          "selected_mics": [0, 1, 2, 3, 4, 5],
          "source": 0,
          "audio_filepath": os.path.join(data_dir, "target.wav"),
          "duration": 1.5,
      }
  
      interference_cfg = [
          {"source": 1, "selected_mics": target_cfg["selected_mics"]}
      ]
  
      audio_metadata = {
          "target": [
              {
                  "audio_filepath": "target.wav",
                  "duration": 1.5,
                  "offset": 0.8,
              }
          ],
          "target_dir": data_dir,
          "noise": [{"audio_filepath": "noise.wav", "duration": 2.3}],
          "noise_dir": data_dir,
          "interference": [
              {"audio_filepath": "interference_1.wav", "duration": 0.8},
              {
                  "audio_filepath": "interference_2.wav",
                  "duration": 0.75,
              },
          ],
          "interference_dir": data_dir,
      }
  
      mix_cfg = {
          "rsnr": 10,
          "rsir": 15,
          "ref_mic": 0,
          "ref_mic_rms": -30,
          "min_duration": None,
          "save": {},
      }
  
      with tempfile.TemporaryDirectory() as output_dir:
          # Mix
          base_output_filepath = os.path.join(output_dir, "test_output")
          simulate_room_mix(
              sample_rate=sample_rate,
              target_cfg=target_cfg,
              interference_cfg=interference_cfg,
              mix_cfg=mix_cfg,
              audio_metadata=audio_metadata,
              base_output_filepath=base_output_filepath,
          )
  
          # Check target + noise + interference = mix
          mix_from_parts = 0
          for suffix in [
              "_target_reverberant.wav",
              "_noise.wav",
              "_interference.wav",
          ]:
              mix_from_parts += AudioSegment.from_file(
                  base_output_filepath + suffix
              ).samples
  
          mix_uut = AudioSegment.from_file(
              base_output_filepath + "_mic.wav"
          )
          mix_uut_samples = mix_uut.samples
  
          # Compare UUT to sum of parts
          max_diff = np.max(np.abs(mix_uut_samples - mix_from_parts))
          assert max_diff < self.max_diff_tol
  
          # Compare the UUT to golden reference
          golden_mix_filepath = os.path.join(
              data_dir, "test_output_mic.wav"
          )
          mix_golden = AudioSegment.from_file(
              base_output_filepath + "_mic.wav"
          )
  
          assert mix_uut.num_samples == mix_golden.num_samples
          assert mix_uut.num_channels == mix_golden.num_channels
          assert mix_uut.sample_rate == mix_golden.sample_rate
          assert mix_uut.duration == mix_golden.duration
          max_diff = np.max(
              np.abs(mix_uut_samples - mix_golden.samples)
          )
          assert max_diff < self.max_diff_tol
  
file_path: NeMo/tests/collections/asr/test_asr_data_simulation.py
imports: import os
  import tempfile
  from typing import List, Type, Union
  import numpy
  import pytest
  from numpy.random import default_rng
  from nemo.collections.asr.data.data_simulation import ArrayGeometry, check_angle, convert_placement_to_range, convert_rir_to_multichannel, simulate_room_mix, wrap_to_180
  from nemo.collections.asr.parts.preprocessing.segment import AudioSegment
label_desc: Use image node_id 1 for calling the TestRoomSimulation obj's underlying member method code with example usage: obj.test_simulate_room_mix(test_data_dir) without return types