code: def test_read_audio(tmpdir, device):
      from speechbrain.dataio.dataio import read_audio, write_audio
  
      test_waveform = torch.rand(16000, device=device)
      wavfile = os.path.join(tmpdir, "wave.wav")
      write_audio(wavfile, test_waveform.cpu(), 16000)
  
      # dummy annotation
      for i in range(3):
          start = torch.randint(0, 8000, (1,), device=device).item()
          stop = (
              start
              + torch.randint(500, 1000, (1,), device=device).item()
          )
  
          loaded_range = read_audio(
              {"file": wavfile, "start": start, "stop": stop}
          ).to(device)
          assert loaded_range.allclose(
              test_waveform[start:stop], atol=1e-4
          )
  
          loaded_omit_start = read_audio(
              {"file": wavfile, "stop": stop}
          ).to(device)
          assert loaded_omit_start.allclose(
              test_waveform[:stop], atol=1e-4
          )
  
          loaded_omit_stop = read_audio(
              {"file": wavfile, "start": start}
          ).to(device)
          assert loaded_omit_stop.allclose(
              test_waveform[start:], atol=1e-4
          )
  
          loaded_simple = read_audio(wavfile).to(device)
          assert loaded_simple.allclose(test_waveform, atol=1e-4)
  
imports: import torch
  import os
label_desc: Use image node_id 2 for calling a global function with example usage: test_read_audio(tmpdir, device) without return types