How does your assistant device work based-on Text-to-Speech technology?
Tags: ai, datascience, texttospeech
Published: 2019-08-09 00:24:34

---
title: How does your assistant device work based-on Text-to-Speech technology?
published: true
tags: ai,data-science,text-to-speech,artificial-intellige
canonical_url: https://becominghuman.ai/how-does-your-assistant-device-work-based-on-text-to-speech-technology-5f31e56eae7e
---

#### Speech synthesis

![](https://cdn-images-1.medium.com/max/1024/0*UsIXmmxFHg5reGcE)<figcaption>Photo by <a href="https://unsplash.com/@howardlawrenceb?utm_source=medium&amp;utm_medium=referral">Howard Lawrence B</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Speech synthesis is the artificial production of human speech. Text-to-Speech (TTS) is way to converts language to human voice (or speech). The goal of TTS is to render naturally sounding speech signals for downstream such as assistant device (Google’s Assistant, Amazon’s Echo, Apple’s Siri). This story will talk about how we can generate a human-like voice. Concatenative TTS and Parametric TTS are the traditional ways to generate audio but there are some limitations. Google released a generative model, WaveNet, which is a break through on TTS. It can generate a very good audio and overcoming traditional ways’ limitation.

This story will discuss about [WaveNet: A Generative Model for Raw Audio](https://arxiv.org/pdf/1609.03499.pdf) (van den Oord et al., 2016) and the following are will be covered:

- Text-to-Speech
- Technique of Classical Speech Synthesis
- WaveNet
- Experiment

### Trending AI Articles:

> [1. Basics of Neural Network](https://becominghuman.ai/basics-of-neural-network-bef2ba97d2cf)

> [2. Making a Simple Neural Network](https://becominghuman.ai/making-a-simple-neural-network-2ea1de81ec20)

> [3. Are you using the term ‘AI’ incorrectly?](https://becominghuman.ai/are-you-using-the-term-ai-incorrectly-911ac23ab4f5)

> [4. From Perceptron to Deep Neural Nets](https://becominghuman.ai/from-perceptron-to-deep-neural-nets-504b8ff616e)

### Text-to-Speech (TTS)

Technically, we can treat TTS as a sequence-to-sequence problem. It includes 2 major stages which are text analysis and speech synthesis. Text analysis is quite similar to generic natural language processing (NLP) steps (Although we may not need heave preprocessing when using deep neural network). For example, sentence segmentation, word segmentation, part-of-speech(POS). The output of first stage is grapheme-to-phoneme (G2P) which is the input of second stage. In speech synthesis, it takes the output from first stage and generating waveform.

### Technique of Classical Speech Synthesis

Concatenative TTS and Parametric TTS are the traditional ways to generate audio by feeding text. As named mentioned, Concatenative TTS concatenate a short clip to form a speech. As short clips are recorded by human, quality is good and voice is clear. However, the limitations are huge human effort for recordings and re-recording if transcript is changed. Parametric TTS can generate voice easily as it stores all base information such as fundamental frequency, magnitude spectrum. As voice is generated, voice is more unnatural than Concatenative TTS.

### WaveNet

WaveNet is introduced by van den Oord et al. It can generate audio from text and achieving very good result which you may not able to distinguish generated audio and human voice. On the other hand, dilated causal convolutions architecture is leveraged to deal with long-range temporal dependencies. Also, a single model can generate multiple voices

It is based on PixelCNN ( van den Oord et al., 2016) architecture. By leveraging dilated causal convolutions, it contributes to increasing receptive field without greatly increasing computational cost. A dilated convolution is similar to normal convolution but the filter is applied over an area larger than its length and causing some of input values are skipped. It is similar to larger filter but less computational cost.

From the following figure, you notice that second layer (Hidden Layer , Dilation=2) get current input and the one of previous one input. In next layer (Hidden Layer, Dilation =4), current input and 4 previous one input. During the experiment, van den Oord et al. doubled for every layer up to a limit and then repeated. So dilation sequence is

> 1, 2, 4, 8, 512, 1, 2, 4 ….

![](https://cdn-images-1.medium.com/max/675/1*8UnrsD-QFaKp7FO0fuKf_w.png)<figcaption>Dilated Causal Convolutions (from van den Oord et al., 2016)</figcaption>

The following animation show the operation of dilated causal convolutions. Previous output becomes input and it combines previous input to generate new outputs.

![](https://cdn-images-1.medium.com/max/570/0*LgGxxpenJyzo4t4W.gif)<figcaption>Dilated Causal Convolutions (from <a href="https://deepmind.com/blog/wavenet-generative-model-raw-audio/">DeepMind</a>)</figcaption>

### Experiment

van den Oord et al. conducts four experiments to validate this model. First experiment is multi-speaker speech generation. By leveraging CSTR Voice Cloning Toolkit dataset, it can generate up to 109 speaker voices. More speaker training data lead to a better result as WaveNet’s internal representation are shares among speaker voices.

The second experiment is TTS. van den Oord et al. use Google’s North American English and Mandarin Chinese TTS systems as a training data to compare different models. To make the comparison fairly, researchers use hidden Markov model (HMM) and LSTM-RNN-based statistical parametric model as baseline models. Mean Opinion Score (MOS) is used to measure the performance. It is a five-point scale score (1: Bad, 2: Poor, 3: Fair, 4: Good, 5: Excellent). From the following, although WaveNet’s score is still lower than human natural voice but it is better than those baseline models a lot.

![](https://cdn-images-1.medium.com/max/828/1*hpc01ZLJPP1mzbeZSgAQng.png)<figcaption>Model performance comparison (van den Oord et al., 2016)</figcaption>

The third and forth experiments are music generation and speech recognition. Resear

The following figures hows the latest Google DeepMind’s WaveNet performance.

{% youtube JjK8apEishQ %}

![](https://cdn-images-1.medium.com/max/1024/0*PnJUIpTXlKV2hsk1.png)<figcaption>Comparison result among different model in US English and Mandarin Chinese (from <a href="https://deepmind.com/blog/wavenet-generative-model-raw-audio/">DeepMind</a>)</figcaption>

### Take Away

- Google applied WaveNet on Google Assistant such that it can response to our voice command without storing all of the audio but generating it in realtime.

### Like to learn?

I am Data Scientist in Bay Area. Focusing on state-of-the-art in Data Science, [Artificial Intelligence](https://becominghuman.ai/) , especially in NLP and platform related. Feel free to connect with [me](https://makcedward.github.io/) on [LinkedIn](https://www.linkedin.com/in/edwardma1026) or following me on [Medium](http://medium.com/@makcedward/) or [Github](https://github.com/makcedward). I am offering short advise on [machine learning](https://becominghuman.ai/) problem or data science platform for small fee.

### Extension Reading

- [DeepMind’s WaveNet](https://deepmind.com/blog/wavenet-generative-model-raw-audio/)

### Reference

- Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, Koray Kavukcuoglu. [WaveNet: A Generative Model for Raw Audio](https://arxiv.org/pdf/1609.03499.pdf). 2016
- Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, Koray Kavukcuoglu. [Conditional Image Generation with PixelCNN Decoders](https://arxiv.org/pdf/1606.05328.pdf). 2016

### Don’t forget to give us your 👏 !

![](https://cdn-images-1.medium.com/max/780/0*WNel-PqkxnjN3yKj)

<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F8f5f8b%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F8f5f8b&amp;image=http%3A%2F%2Fapi.screenshotlayer.com%2Fapi%2Fcapture%3Faccess_key%3Dfe59908dad3baab69ffab249a2224b03%26viewport%3D1024x612%26width%3D1000%26url%3Dhttps%253A%252F%252Fupscri.be%252F8f5f8b%253Fscreenshot&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c43026df6fee7cdb1aab8aaf916125ea/href">https://medium.com/media/c43026df6fee7cdb1aab8aaf916125ea/href</a></iframe>

[![](https://cdn-images-1.medium.com/max/255/1*2f7OqE2AJK1KSrhkmD9ZMw.png)](https://becominghuman.ai/artificial-intelligence-communities-c305f28e674c)

[![](https://cdn-images-1.medium.com/max/255/1*v-PpfkSWHbvlWWamSVHHWg.png)](https://upscri.be/8f5f8b)

[![](https://cdn-images-1.medium.com/max/255/1*Wt2auqISiEAOZxJ-I7brDQ.png)](https://becominghuman.ai/write-for-us-48270209de63)

* * *