docstr: saves the test audio (mixture, targets, and estimated sources) on disk
docstr_tok: ["saves","the","test","audio","(","mixture",",","targets",",","and","estimated","sources",")","on","disk"]
code: def save_audio(self, snt_id, mixture, targets, predictions):
      "saves the test audio (mixture, targets, and estimated sources) on disk"
  
      # Create outout folder
      save_path = os.path.join(
          self.hparams.save_folder, "audio_results"
      )
      if not os.path.exists(save_path):
          os.mkdir(save_path)
  
      for ns in range(self.hparams.num_spks):
          # Estimated source
          signal = predictions[0, :, ns]
          signal = signal / signal.abs().max()
          save_file = os.path.join(
              save_path, "item{}_source{}hat.wav".format(snt_id, ns + 1)
          )
          torchaudio.save(
              save_file,
              signal.unsqueeze(0).cpu(),
              self.hparams.sample_rate,
          )
  
          # Original source
          signal = targets[0, :, ns]
          signal = signal / signal.abs().max()
          save_file = os.path.join(
              save_path, "item{}_source{}.wav".format(snt_id, ns + 1)
          )
          torchaudio.save(
              save_file,
              signal.unsqueeze(0).cpu(),
              self.hparams.sample_rate,
          )
  
      # Mixture
      signal = mixture[0][0, :]
      signal = signal / signal.abs().max()
      save_file = os.path.join(
          save_path, "item{}_mix.wav".format(snt_id)
      )
      torchaudio.save(
          save_file, signal.unsqueeze(0).cpu(), self.hparams.sample_rate
      )
  
imports: import os
  import csv
  import sys
  import torch
  import torchaudio
  import numpy
  from tqdm import tqdm
  import speechbrain
  import torch.nn.functional
  import speechbrain.nnet.schedulers
  from speechbrain.utils.distributed import run_on_main
  from hyperpyyaml import load_hyperpyyaml
  import logging
  from speechbrain.core import AMPConfig
label_desc: Use image node_id 10 for calling the Separation obj's underlying member method code with example usage: obj.save_audio(snt_id, mixture, targets, predictions) without return types