code: def generate_voice(
      audio,
      model,
      output_path,
  ):
      """Generate a new voice from a given audio and text prompt.
  
      Args:
          audio (np.ndarray): The audio to use as a base for the new voice.
          text (str): Transcription of the audio you are clonning.
          model (BarkModel): The BarkModel to use for generating the new voice.
          output_path (str): The path to save the generated voice to.
      """
      if isinstance(audio, str):
          audio, sr = torchaudio.load(audio)
          audio = convert_audio(
              audio,
              sr,
              model.config.sample_rate,
              model.encodec.channels,
          )
          audio = audio.unsqueeze(0).to(model.device)
  
      with torch.no_grad():
          encoded_frames = model.encodec.encode(audio)
      codes = torch.cat(
          [encoded[0] for encoded in encoded_frames], dim=-1
      ).squeeze()  # [n_q, T]
  
      # move codes to cpu
      codes = codes.cpu().numpy()
  
      # generate semantic tokens
      # Load the HuBERT model
      hubert_manager = HubertManager()
      # hubert_manager.make_sure_hubert_installed(model_path=model.config.LOCAL_MODEL_PATHS["hubert"])
      hubert_manager.make_sure_tokenizer_installed(
          model_path=model.config.LOCAL_MODEL_PATHS["hubert_tokenizer"]
      )
  
      hubert_model = CustomHubert(
          checkpoint_path=model.config.LOCAL_MODEL_PATHS["hubert"]
      ).to(model.device)
  
      # Load the CustomTokenizer model
      tokenizer = HubertTokenizer.load_from_checkpoint(
          model.config.LOCAL_MODEL_PATHS["hubert_tokenizer"],
          map_location=model.device,
      )
      # semantic_tokens = model.text_to_semantic(
      #     text, max_gen_duration_s=seconds, top_k=50, top_p=0.95, temp=0.7
      # )  # not 100%
      semantic_vectors = hubert_model.forward(
          audio[0], input_sample_hz=model.config.sample_rate
      )
      semantic_tokens = tokenizer.get_token(semantic_vectors)
      semantic_tokens = semantic_tokens.cpu().numpy()
  
      np.savez(
          output_path,
          fine_prompt=codes,
          coarse_prompt=codes[:2, :],
          semantic_prompt=semantic_tokens,
      )
  
imports: import logging
  import os
  import re
  from glob import glob
  from typing import Dict, List
  import librosa
  import numpy
  import torch
  import torchaudio
  import tqdm
  from encodec.utils import convert_audio
  from scipy.special import softmax
  from torch.nn import functional
  from TTS.tts.layers.bark.hubert.hubert_manager import HubertManager
  from TTS.tts.layers.bark.hubert.kmeans_hubert import CustomHubert
  from TTS.tts.layers.bark.hubert.tokenizer import HubertTokenizer
  from TTS.tts.layers.bark.load_model import clear_cuda_cache, inference_mode
label_desc: Use image node_id 10 for calling a global function with example usage: generate_voice(audio, model, output_path) without return types