Added support for multiple speakers in mrs

pull/45/head
Thorsten Mueller 2020-02-21 11:29:39 +01:00
parent edeadefe75
commit be9ec8275e
2 changed files with 15 additions and 5 deletions

View File

@ -7,7 +7,7 @@ import sqlite3
import sys
def build_from_path(in_dir, out_dir, num_workers=1, tqdm=lambda x: x):
def build_from_path(in_dir, out_dir, username, num_workers=1, tqdm=lambda x: x):
'''Preprocesses the recordings from mimic-recording-studio (based on sqlite db) into a given output directory.
Args:
@ -32,11 +32,19 @@ def build_from_path(in_dir, out_dir, num_workers=1, tqdm=lambda x: x):
conn = sqlite3.connect(dbfile)
c = conn.cursor()
# Get user id from sqlite to find recordings in directory structure
# TODO: Currently just works with one user
for row in c.execute('SELECT uuid FROM usermodel LIMIT 1;'):
uid = ''
sql_get_guid = "SELECT uuid FROM usermodel LIMIT 1;"
if username:
print("Query user guid for " + username + " in sqlite db")
sql_get_guid = "SELECT uuid FROM usermodel WHERE UPPER(user_name) = '" + username.upper() + "' LIMIT 1;"
for row in c.execute(sql_get_guid):
uid = row[0]
if uid == '':
print("No userid could be found in sqlite db.")
sys.exit()
print("Found speaker user guid in sqlite: " + uid)
wav_dir = os.path.join(in_dir,"backend","audio_files",uid)

View File

@ -28,9 +28,10 @@ def preprocess_ljspeech(args):
def preprocess_mrs(args):
in_dir = args.mrs_dir
out_dir = os.path.join(args.base_dir, args.output)
username = args.mrs_username
os.makedirs(out_dir, exist_ok=True)
metadata = mrs.build_from_path(
in_dir, out_dir, args.num_workers, tqdm=tqdm)
in_dir, out_dir, username, args.num_workers, tqdm=tqdm)
write_metadata(metadata, out_dir)
def preprocess_amy(args):
@ -87,6 +88,7 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('--base_dir', default=os.path.expanduser('~/tacotron'))
parser.add_argument('--mrs_dir', required=False)
parser.add_argument('--mrs_username', required=False)
parser.add_argument('--output', default='training')
parser.add_argument(
'--dataset', required=True, choices=['amy', 'blizzard', 'ljspeech', 'kusal', 'mailabs','mrs']