ХабрПостыНовостиМегапосты?

High-Quality Text-to-Speech Made Accessible, Simple and Fast

image


There is a lot of commotion in text-to-speech now. There is a great variety of toolkits, a plethora of commercial APIs from GAFA companies (based both on new and older technologies). There are also a lot of Silicon Valley startups trying to ship products akin to "deep fakes" in speech.


But despite all this ruckus we have not yet seen open solutions that would fulfill all of these criteria:



We decided to share our open non-commercial solution that fits all of these criteria with the community. Since we have published the whole pipeline we do not focus much on cherry picked examples and we encourage you to visit our project GitHub repo to test our TTS for yourself.


Solutions Review


This summary is not supposed to provide an in-depth technical overview of all available solutions. We just want to do a brief introductory summary of the available approaches. We do not list numerous toolkits in favor of more or less batteries-included solutions with a decent library of voices and some kind of support / community:



Quality Assessment and Audio Examples


We decided to keep the quality assessment really simple: we generated audio from the validation subsets of our data (~200 files per speaker), shuffled them with the original recorded audios of the same speakers, and gave it to a group of 24 assessor to evaluate the sound quality on a five-point scale. For 8kHz and 16kHz the scores were collected separately (both for synthesized and original speech). For simplicity we had the following grades — [1, 2, 3, 4-, 4, 4+, 5-, 5] — the higher the quality the more detailed our scale is. Then, for each speaker, we simply calculated the mean.


In total people scored audios 37,403 times. 12 people annotated the whole dataset. 12 other people managed to annotate from 10% to 75% of audios. For each speaker we calculated mean (standard deviation is shown in brackets). We also tried first calculating median scores for each audio and then averaging them. But this just increases the mean values without affecting the ratios, so we just used plain averages in the end. The key metric here of course is the ratio between the mean score for synthesis vs the original audio. Some users had much lower scores overall (hence high dispersion), but we decided to keep all scores as is without cleaning outliers.


Speaker Original Synthesis Ratio Examples
aidar_8khz 4.67 (.45) 4.52 (.55) 96.8% link
baya_8khz 4.52 (.57) 4.25 (.76) 94.0% link
kseniya_8khz 4.80 (.40) 4.54 (.60) 94.5% link
aidar_16khz 4.72 (.43) 4.53 (.55) 95.9% link
baya_16khz 4.59 (.55) 4.18 (.76) 91.1% link
kseniya_16khz 4.84 (.37) 4.54 (.59) 93.9% link

We asked our assessors to rate the "naturalness of the speech" (not the audio quality). Nevertheless we were surprised that based on anecdotes people cannot tell 8 kHz from 16 kHz on their everyday devices (which is also confirmed by metrics). Baya has the lowest absolute and relative scores. Kseniya has the highest absolute scores, Aidar has the highest relative scores. Baya also has higher score dispersion.


Manually inspecting audios with high score dispersion reveals several patterns. Speaker errors, tacotron errors (pauses), proper names and hard-to-read words are the most common causes. Of course 75% of such differences are in synthesized audios and sampling rate does not seem to affect it.


We tried to rate "naturalness". But it is only natural to try estimating "unnaturalness" or "robotness" as well. It can be measured by asking people to choose between to audios. But we went one step beyond and essentially applied a double blind test. We asked our assessors to rate the same audio 4 times in random order — original and synthesis with different sampling rates. For assessors who annotated the whole dataset we calculated the following table:


Comparison Worse Same Better
16k vs 8k, original 957 4811 1512
16k vs 8k, synthesis 1668 4061 1551
Original vs synthesis, 8k 816 3697 2767
Original vs synthesis, 16k 674 3462 3144

Several conclusions can be drawn:



You can see for yourself how it sounds, both for our unique voices and for speakers from external sources (more audio for each speaker can be synthesized in the colab notebook in our repo.


If you're unfamiliar with colab notebooks or you just want a quick listen, here are some random audios for our voices:


Aidar:





Baya:





Kseniya:





Once again, please note that these ones are not cherry-picked examples, but how the synthesis actually sounds.


Speed Benchmarks


Speed is the next important defining property of the model, and to measure the speed of synthesis we use the following simple metrics:



We benchmarked the models on two devices using Pytorch 1.8 utils:



For the 16KHz models we got the following metrics:


BatchSize Device RTF RTS
1 CPU 1 thread 0.7 1.4
1 CPU 2 threads 0.4 2.3
1 CPU 4 threads 0.3 3.1
4 CPU 1 thread 0.5 2.0
4 CPU 2 threads 0.3 3.2
4 CPU 4 threads 0.2 4.9
--- ----------- --- ---
1 GPU 0.06 16.9
4 GPU 0.02 51.7
8 GPU 0.01 79.4
16 GPU 0.008 122.9
32 GPU 0.006 161.2
--- ----------- --- ---

For the 8KHz models we got the following metrics:


BatchSize Device RTF RTS
1 CPU 1 thread 0.5 1.9
1 CPU 2 threads 0.3 3.0
1 CPU 4 threads 0.2 4.2
4 CPU 1 thread 0.4 2.8
4 CPU 1 threads 0.2 4.4
4 CPU 4 threads 0.1 6.6
--- ----------- --- ---
1 GPU 0.06 17.5
4 GPU 0.02 55.0
8 GPU 0.01 92.1
16 GPU 0.007 147.7
32 GPU 0.004 227.5
--- ----------- --- ---

A number of things surprised us during benchmarking:



Available Speakers


For simplicity we decided to publish all our models as part of silero-models. The full list of current models can always be found in this yaml file.


At the time of this writing, the following voices are supported (for each speaker _16khz and _8khz versions of voices are available):


Speaker Gender Language Source Dataset License Examples Colab
aidar m ru Silero Private 8000 / 16000 Open In Colab
baya f ru Silero Private 8000 / 16000 Open In Colab
kseniya f ru Silero Private 8000 / 16000 Open In Colab
irina f ru Private contribution TBD 8000 / 16000 Open In Colab
natasha f ru source CC BY 4.0 8000 / 16000 Open In Colab
ruslan m ru source CC BY-NC-SA 4.0 8000 / 16000 Open In Colab
lj f en source Public Domain 8000 / 16000 Open In Colab
thorsten m de source Creative Commons Zero v1.0 Universal 8000 / 16000 Open In Colab
gilles m fr source Public Domain 8000 / 16000 Open In Colab
tux m es source Public Domain 8000 / 16000 Open In Colab

How To Try It


All models are published in silero-models repository, there are also examples of launching the synthesis in colab. For completeness, here is a minimalistic example:


import torch

language = 'ru'
speaker = 'kseniya_16khz'
device = torch.device('cpu')

(model,
 symbols,
 sample_rate,
 example_text,
 apply_tts) = torch.hub.load(repo_or_dir='snakers4/silero-models',
                                          model='silero_tts',
                                          language=language,
                                          speaker=speaker)

model = model.to(device)  # gpu or cpu
audio = apply_tts(texts=[example_text],
                  model=model,
                  sample_rate=sample_rate,
                  symbols=symbols,
                  device=device)

The following special characters are currently supported: !\'(),.:;?¡¿. In addition, for most speakers of the Russian language, accent marks were used in the text for voicing (the + symbol before the stressed vowel — while testing such models you still need to put the accent manually):


Speaker With stress
aidar yes
baya yes
ksenia yes
irina yes
natasha yes
ruslan yes
lj no
thorsten no
gilles no
tux no

In future we plan to convert all models to a simpler and more unified input format that does not require accents. To avoid confusion, yml file, which describes all our models, explicitly specifies a set of tokens for each model, and an example phrase to generate.


Philosophy, License, and Motivation


As model authors, we consider the following rules for using models to be fair:



The main goal of this project was to build a modern TTS system that meets the criteria described above.


Further Work


We plan to develop and improve our models, in particular:



Tongue Twisters


And as a bonus, here are some tongue twisters.


Russian:






Other languages:





@snakers4
30.03.2021 08:33 UTC
Первоисточник

Комментарии

@
30.03.2021 05:41 UTC
0
НЛО прилетело и опубликовало эту надпись здесь
30.03.2021 05:43 UTC
0

Yeah, this is hilarious that we did not catch this during proof-reading

31.03.2021 02:19 UTC
0

But on a github seems you provide both?

31.03.2021 03:10 UTC
0

Yes, kind of

@snakers4
02.04.2021 12:01 UTC
0

For people from the future, who will be reading this:


no handling of numbers, those are just omitted

there is no text normalization middleware packaged with the models
the model just produces audio from text
it was not included by design


in future releases stress will be handled automatically


issues with longer sentences, interference just stops (might be related to warning that sentence has more than 140 chars) or is getting worse at the end of longer

this is also by design
model accepts sentences and it can work with batches
see these examples


import torch
import torchaudio

language = 'ru'
speaker = 'kseniya_16khz'
device = torch.device('cpu')
model, symbols, sample_rate, example_text, apply_tts = torch.hub.load(repo_or_dir='snakers4/silero-models',
                                                                      model='silero_tts',language=language,speaker=speaker)
model = model.to(device)  # gpu or cpu

example_text="нав+ерное, существ+уют друг+ие рец+епты, но я их не зн+аю. +или он+и мне не помог+ают. х+очешь моег+о сов+ета - пож+алуйста: сад+ись раб+отать. сл+ава б+огу, так+им л+юдям, как мы с тоб+ой, для раб+оты ничег+о не н+ужно кр+оме бум+аги и карандаш+а."

for i, text in enumerate(example_text.split('. ')):
  audio = apply_tts(texts=[text],
                    model=model,
                    sample_rate=sample_rate,
                    symbols=symbols,
                    device=device)
  torchaudio.save(f'test_{str(i).zfill(2)}.wav',
                  audio[0].unsqueeze(0),
                  sample_rate=16000,
                  bits_per_sample=16)

import torch
import torchaudio

language = 'ru'
speaker = 'kseniya_16khz'
device = torch.device('cpu')
model, symbols, sample_rate, example_text, apply_tts = torch.hub.load(repo_or_dir='snakers4/silero-models',
                                                                      model='silero_tts',language=language,speaker=speaker,
                                                                      force_reload=True)
model = model.to(device)  # gpu or cpu

example_text="нав+ерное, существ+уют друг+ие рец+епты, но я их не зн+аю. +или он+и мне не помог+ают. х+очешь моег+о сов+ета - пож+алуйста: сад+ись раб+отать. сл+ава б+огу, так+им л+юдям, как мы с тоб+ой, для раб+оты ничег+о не н+ужно кр+оме бум+аги и карандаш+а."
example_text = example_text.split('. ')

print(example_text)
audio = apply_tts(texts=example_text,
                  model=model,
                  sample_rate=sample_rate,
                  symbols=symbols,
                  device=device)
@d1gital_love
17.11.2021 05:35 UTC
0

Про In synthesis 8k helps to hide some errors:

90g_best_0_20210306-003223aidar_16000.wav - первые 4 секунды чистые, а на 5 секунде какое-то сбитне голоса.

90g_best_0_20210306-003223aidar_8000.wav - такого скачка на 5 секунде нет. Общее качество плохое, 8000 Hz.

Слушал без спектрограмм.

@d1gital_love
17.11.2021 06:02 UTC
0

0000.40_16000g_best_0_20210315-154007irina_16000.wav нет слов после 3 секунды

0008.56_16000g_best_0_20210315-154007irina_16000.wav, 0003.68_16000g_best_0_20210315-154007irina_16000.wav неестественные звуки, трудно словами описать

0002.72_16000g_best_0_20210315-154007irina_16000.wav какое-то металлическое эхо с малой задержкой

@d1gital_love
17.11.2021 06:02 UTC
0

kseniya 16000 почти то, что надо. Очень небольшие неточности.