code: def test_background(
      noise, n_samples, weight_min, weight_max, jam_fixture
  ):
      D = muda.deformers.BackgroundNoise(
          files=noise,
          n_samples=n_samples,
          weight_min=weight_min,
          weight_max=weight_max,
      )
  
      jam_orig = deepcopy(jam_fixture)
      orig_duration = librosa.get_duration(
          **jam_orig.sandbox.muda["_audio"]
      )
  
      n_out = 0
      for jam_new in D.transform(jam_orig):
          assert jam_new is not jam_fixture
          __test_effect(jam_orig, jam_fixture)
  
          assert not np.allclose(
              jam_orig.sandbox.muda["_audio"]["y"],
              jam_new.sandbox.muda["_audio"]["y"],
          )
  
          d_state = jam_new.sandbox.muda.history[-1]["state"]
          filename = d_state["filename"]
          start = d_state["start"]
          stop = d_state["stop"]
  
          with psf.SoundFile(str(filename), mode="r") as soundf:
              max_index = len(soundf)
              noise_sr = soundf.samplerate
  
          assert 0 <= start < stop
          assert start < stop <= max_index
          assert ((stop - start) / float(noise_sr)) == orig_duration
  
          __test_effect(jam_orig, jam_new)
          n_out += 1
  
      assert n_out == n_samples
      # Serialization test
      D2 = muda.deserialize(muda.serialize(D))
      __test_params(D, D2)
  
imports: from copy import deepcopy
  import re
  import six
  import numpy
  import soundfile
  import jams
  import librosa
  import muda
  import pytest
  import scipy
  from contextlib import contextmanager
label_desc: Use image node_id 28 for calling a global function with example usage: test_background(noise, n_samples, weight_min, weight_max, jam_fixture) without return types