-
Notifications
You must be signed in to change notification settings - Fork 468
Description
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.animation import FuncAnimation
from resemblyzer.audio import sampling_rate
from matplotlib import cm
from time import sleep, perf_counter as timer
from umap import UMAP
from sys import stderr
import matplotlib.pyplot as plt
import numpy as np
from itertools import groupby
from pathlib import Path
from tqdm import tqdm
from resemblyzer import preprocess_wav, VoiceEncoder
from itertools import groupby
wav_fpaths = list(Path("audio_data", "librispeech_test-other").glob("**/*.flac"))
speakers = list(map(lambda wav_fpath: wav_fpath.parent.stem, wav_fpaths))
wavs = np.array(list(map(preprocess_wav, tqdm(wav_fpaths, "Preprocessing wavs", len(wav_fpaths)))))
speaker_wavs = {speaker: wavs[list(indices)] for speaker, indices in
groupby(range(len(wavs)), lambda i: speakers[i])}
encoder = VoiceEncoder()
utterance_embeds = np.array(list(map(encoder.embed_utterance, wavs)))
def plot_projections(embeds, speakers, ax=None, colors=None, markers=None, legend=True, title="", **kwargs):(utterance_embeds, speakers, title="Embedding projections")
plt.show()
MATPLOTLIB FIGURES ARE NOT DISPLAYING.