I am following
https://colab.research.google.com/drive/1tzUmbS4lFP3xr6khSojg2vFCAx6xfW5r#scrollTo=EfkTM9TjUCRx
Real Time Voice Cloning.
I need help with Second section of this notebook where we have to record or upload file. I have multiple files in my google drive which i have mounted in colab and want to use them rather than uploading same from pc ( which is very slow )
can anyone help me with solution for this code block ? like using wav/mp3 from our drive rather than uploading them via upload file button ?
want to change this code to use local files rather than uploading from pc :
#@title Run this cell to Record or Upload Audio
#@markdown * Either record audio from microphone or upload audio from file (.mp3 or .wav)
SAMPLE_RATE = 22050
record_or_upload = "Upload (.mp3 or .wav)" #@param ["Record", "Upload (.mp3 or .wav)"]
record_seconds = 13111#@param {type:"number", min:219, max:10, step:3}
embedding = None
def _compute_embedding(audio):
display(Audio(audio, rate=SAMPLE_RATE, autoplay=True))
global embedding
embedding = None
embedding = encoder.embed_utterance(encoder.preprocess_wav(audio, SAMPLE_RATE))
def _record_audio(b):
clear_output()
audio = record_audio(record_seconds, sample_rate=SAMPLE_RATE)
_compute_embedding(audio)
def _upload_audio(b):
clear_output()
audio = upload_audio(sample_rate=SAMPLE_RATE)
_compute_embedding(audio)
if record_or_upload == "Record":
button = widgets.Button(description="Record Your Voice")
button.on_click(_record_audio)
display(button)
else:
#button = widgets.Button(description="Upload Voice File")
#button.on_click(_upload_audio)
_upload_audio("")
I have done :
from google.colab import drive
drive.mount('/content/drive/')
then
%cp -av "/content/drive/MyDrive/test.wav" "/content/"
test.wav is copied now I want to use that directly rather than upload or record.