Skip to content

Commit

Permalink
Improve support for Windows use
Browse files Browse the repository at this point in the history
Several changes to make this easier to use on Windows
* Edited and expanded the instructions
* Added a one-click start-windows.bat.  This installs all needed components then runs the app.
* Corrected some non-ASCII characters in the corpus

NOTE: The start-windows.bat was only tested under Windows 10
  • Loading branch information
penrods committed Nov 16, 2018
1 parent 52b7bdb commit 7909951
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 42 deletions.
141 changes: 103 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,89 +2,124 @@

![demo](demo.gif)

Mycroft's open source Mimic technologies are Text-to-Speech engines, which take a piece of written text and convert it into spoken audio. The latest generation of this technology, [Mimic 2](https://github.com/MycroftAI/mimic2), uses machine learning techniques to create a model, which can speak a specific language, sounding like the voice on which it was trained.
The [Mycroft](https://mycroft.ai) open source Mimic technologies are
Text-to-Speech engines which take a piece of written text and convert it into
spoken audio. The latest generation of this technology,
[Mimic 2](https://github.com/MycroftAI/mimic2), uses machine learning techniques
to create a model which can speak a specific language, sounding like the voice
on which it was trained.

The Mimic Recording Studio simplifies the collection of training data from individuals, each of which can be used to produce a distinct voice for Mimic.
The Mimic Recording Studio simplifies the collection of training data from
individuals, each of which can be used to produce a distinct voice for Mimic.

## Quick Start

### Dependencies

## Software Quick Start

### Windows self-hosted Quick Start

* `git clone https://github.com/MycroftAI/mimic-recording-studio.git`
* `cd mimic-recording-studio`
* `start-windows.bat`


### Linux/Mac self-hosted Quick Start

#### Install Dependencies
* [Docker](https://docs.docker.com/) (community edition is fine)
* [Docker Compose](https://docs.docker.com/compose/install/)

Why docker? To make this super easy to set up and run cross platforms.

### Build & Run
#### Build and Run

* `git clone https://github.com/MycroftAI/mimic-recording-studio.git`
* `cd mimic-recording-studio`
* `docker-compose up` to build and run
* Alternatively, you can build and run separately. `docker-compose build`, `docker-compose up`
Alternatively, you can build and run separately. `docker-compose build` then `docker-compose up`
* In browser, go to `http://localhost:3000`

**Note:**
First `docker-compose up` will take a while as this command will also build the docker containers. Subsequent `docker-compose up` should be quicker to boot.
The first execution of `docker-compose up` will take a while as this command
will also build the docker containers. Subsequent executions of `docker-compose up`
should be quicker to boot.

## Manual Build and Start
### Manual Install, Build and Start

Windows machine may need to default to this process. There is a known issue with windows and docker toolbox when trying to run the frontend container.
#### Backend

### Frontend
##### Dependencies

* python 3.5 +
* [ffmpeg](https://www.ffmpeg.org/)

##### Build & Run

* `cd backend/`
* `pip install -r requirements.txt`
* `python run.py`

#### Dependencies
#### Frontend

##### Dependencies

* [node & npm](https://nodejs.org/en/)
* [create-react-app](https://github.com/facebook/create-react-app)
* [yarn](https://yarnpkg.com/en/) - optional for faster build, install, and start

#### Build & Run
##### Build & Run

* `cd frontend/`
* `npm install`, alternatively `yarn install`
* `npm start`, alternatively `yarn start`

### Backend

#### Dependencies
### Coming soon!
Online, http://mimic.mycroft.ai hosted version requiring zero setup.

* python 3.5 +
* [ffmpeg](https://www.ffmpeg.org/)

#### Build & Run

* `cd backend/`
* `pip install -r requirements.txt`
* `python run.py`

## Data

### Audios
### Audio Recordings

#### wav files
#### WAV files

Audios can be found in the `backend/audio_file/{uuid}/` directory. The backend automatically trims the beginning and ending silence for all wav files using [ffmpeg](https://www.ffmpeg.org/).
Audio is saved as WAV files to the `backend/audio_file/{uuid}/` directory. The
backend automatically trims the beginning and ending silence for all WAV files
using [ffmpeg](https://www.ffmpeg.org/).

#### {uuid}-metadata.txt

Can also be found in `backend/audio_file/{uuid}/`. This file maps the wav file name to the phrase spoken. This along with the wav files are what you needed to get started on training [Mimic 2](https://github.com/MycroftAI/mimic2).
Metadata is also saved to `backend/audio_file/{uuid}/`. This file maps the WAV
file name to the phrase spoken. This along with the WAV files are what you
needed to get started on training [Mimic 2](https://github.com/MycroftAI/mimic2).

### Corpus

For now, we have an english corpus, `english_corpus.csv` made available which can be found in `backend/prompt/`. To use your own corpus follow these steps.
For now, we have an English corpus, `english_corpus.csv` made available which
can be found in `backend/prompt/`. To use your own corpus follow these steps.

1. create a csv file in the same format as `english_corpus.csv` using tabs (`\t`) as the delimiter.
2. add your corpus to the `backend/prompt` directory.
3. change the `CORPUS` environment variable in `docker-compose.yml` to your corpus name.
1. Create a csv file in the same format as `english_corpus.csv` using tabs
(`\t`) as the delimiter.
2. Add your corpus to the `backend/prompt` directory.
3. Change the `CORPUS` environment variable in `docker-compose.yml` to your
corpus name.

**IMPORTANT:**
For now, this requires you to reset the sqlite database to use the new corpus. If you've recorded on another corpus and would like to save that data, you can simply rename your sqlite db found in `backend/db/` to another name. The backend will detect that `mimicstudio.db` is not there and create a new one for you. You may continue recording data for your new corpus.
For now, you must reset the sqlite database to use a new corpus. If you've
recorded on another corpus and would like to save that data, you can simply
rename your sqlite db found in `backend/db/` to another name. The backend will
detect that `mimicstudio.db` is not there and create a new one for you. You may
continue recording data for your new corpus.



## Technologies

### Frontend

The web UI is built using javascript and [React](https://reactjs.org/) and [create-react-app](https://github.com/facebook/create-react-app) as a scaffolding tool. Refer to [CRA.md](/frontend/CRA.md) to find out more on how to use create-react-app.
The web UI is built using Javascript and [React](https://reactjs.org/) and
[create-react-app](https://github.com/facebook/create-react-app) as a
scaffolding tool. Refer to [CRA.md](/frontend/CRA.md) to find out more on how to
use create-react-app.

#### Functions

Expand All @@ -94,7 +129,9 @@ The web UI is built using javascript and [React](https://reactjs.org/) and [crea

### Backend

The web service is built using python, [Flask](http://flask.pocoo.org/) as the backend framework, [gunicorn](https://gunicorn.org/) as a http webserver, and [sqlite](https://www.sqlite.org/index.html) as the database.
The web service is built using Python, [Flask](http://flask.pocoo.org/) as the
backend framework, [gunicorn](https://gunicorn.org/) as a http webserver, and
[sqlite](https://www.sqlite.org/index.html) as the database.

#### Functions

Expand All @@ -105,8 +142,36 @@ The web service is built using python, [Flask](http://flask.pocoo.org/) as the b

### Docker

Docker is used to containerized both applications. By default, frontend uses network port `3000` while the backend uses networking port `5000`. You can configure these in the `docker-compose.yml` file.
Docker is used to containerize both applications. By default, the frontend uses
network port `3000` while the backend uses networking port `5000`. You can
configure these in the `docker-compose.yml` file.



# Recording Tips

Creating a voice requires an achievable, but significant effort. An individual
will need to record 15,000 - 20,000 phrases. In order to get the best possible
Mimic voice, the recordings need to be clean and consistent. To that end,
follow these recommendations:

* Record in a quiet environment with noise-dampening material.
If your ears can hear outside noise, so can the microphone. For best results,
even the sound of air conditioning blowing through a vent should be avoided.
Bare walls create subtle echoes and reverberation. A sound dampening booth
is ideal, but you can also create a homemade recording studio using soft
materials such as acoustic foam in a closet. Comforters and mattresses can
also be used effectively!
* Speak at a consistent volume and speed. Rushing through the phrases will only
result in a lower quality voice.
* Use a quality microphone.
To obtain consistent results, we recommend a headset microphone so your mouth
is always the same distance from the mic.
* Avoid vocal fatigue.
Record a maximum of 4 hours a day, taking a break every half hour.

## Contributions


# Contributions

PR's are accepted!
PR's are gladly accepted!
8 changes: 4 additions & 4 deletions backend/prompts/english_corpus.csv
Original file line number Diff line number Diff line change
Expand Up @@ -13536,7 +13536,7 @@ On November fifteen, nineteen sixty-three, the same day that his wife told him n
I will tell her what we decided. 32
The pencils have all been used. 31
But for the beauty of the earlier work they might have seemed tolerable. 72
Bread raised with what is known to bakers as a sponge, requires more time and a trifle more work than the simpler form for which I have just already given directions. 168
Bread raised with what is known to bakers as a "sponge," requires more time and a trifle more work than the simpler form for which I have just already given directions. 168
The nurse is unwilling to give him the medicine. 48
Sean stood there tapping his foot impatiently. 46
This mission is used to organize, assist and train the military and national defense forces of foreign governments to protect their citizens from aggressors. 157
Expand Down Expand Up @@ -17882,7 +17882,7 @@ Dude, you've got swag! 22
laughed and jested with the officers about "Jack Ketch," who, through the postponement of the execution, would lose his Christmas dinner. 137
but I am jealous of the right of every citizen to call to the attention of his or her government 96
His unhappy experience with the Cuban consul seems thus to have reduced his enthusiasm for the Castro regime and his desire to go to Cuba. 138
Why does the ice cream truck keep playing such a sad song send in the clowns? 79
Why does the ice cream truck keep playing such a sad song "send in the clowns"? 79
A group of men chat and drink water from water bottles while standing by their bicycles. 88
Activity has focused on the importation of cheap or unfree labor, involvement with union and public officials, and counterfeiting. 130
Simone employed a broad range of musical styles including classical, jazz, blues, folk, gospel, and pop. 104
Expand Down Expand Up @@ -18993,7 +18993,7 @@ Boxes and cases were stacked behind him. 40
Give me a couple of minutes. 28
made certain recommendations which it believes would, if adopted, 65
When she tried to withdraw some money from her bank account, the A.T.M. claimed her card was invalid. 101
Into the crater dug out in the middle, pour the sponge, warm water, the molasses, and soda dissolved in hot water. 116
Into the "crater" dug out in the middle, pour the sponge, warm water, the molasses, and soda dissolved in hot water. 116
In fact his looks denoted extreme sorrow and contrition, 56
Columbanus is the patron saint of motorcyclists. 48
Older lady in a motorized wheelchair on a corner with a man walking in front of her. 84
Expand Down Expand Up @@ -26672,7 +26672,7 @@ Like his great predecessor Old Patch, he never went to a bank himself, nor did a
Mix cream cheese, sugar, eggs, and vanilla together in a bowl until smooth and well blended. 92
They included certain insurance policies, and his share of the house. 69
In England about this time, an attempt was made to improve the letter in form. 78
The phosphates which the process of bolting removes to a large extent from white flour, go directly to the manufacture of bone, 129
The phosphates which the process of "bolting" removes to a large extent from white flour, go directly to the manufacture of bone, 129
The sand drifts over the sills of the old house. 48
he may not have intended to go to the Soviet Union directly, if at all. It appears that he really wanted to go to Cuba. 119
Why are we here? 16
Expand Down
87 changes: 87 additions & 0 deletions start-windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
pushd .
setlocal


rem ======================================================================
rem Python Setup
rem ======================================================================
rem This defaults to using the C:\Python34 path, but you can optionally
rem hard-code a different path here or set it before calling this script.

rem set python3_dir="C:\Custom\Path"
if not defined python3_dir (
if not exist "c:\Python37" (
echo "Downloading Python37..."
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 ; wget https://www.python.org/ftp/python/3.7.1/python-3.7.1.exe -outfile python-3.7.1.exe"

echo "Installing Python37..."
start "Installing Python3.7.1 ..." /wait python-3.7.1.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 TargetDir=c:\Python37
)
set python3_dir=C:\Python37
)

rem ======================================================================
rem NodeJS Setup
rem ======================================================================

rem set nodejs_dir="C:\Custom\Path"
if not defined nodejs_dir (
rem Download and install NodeJS
if not exist "c:\Program Files\nodejs" (
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 ; wget https://nodejs.org/dist/v10.13.0/node-v10.13.0-x64.msi -outfile node-v10.13.0-x64.msi"
start "Installing NodeJS..." /wait node-v10.13.0-x64.msi
)

set nodejs_dir=C:\Program Files\nodejs\npm
)

rem Add NodeJS to the path -- makes life easier
set path=%nodejs_dir%;%path%

rem ======================================================================
rem Yarn Setup
rem ======================================================================

rem set yarn_dir="C:\Custom\Path"
if not defined yarn_dir (
rem Download and install Yarn
if not exist "C:\Program Files (x86)\Yarn" (
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 ; wget https://yarnpkg.com/latest.msi -outfile yarn.msi"
start "Installing Yarn..." /wait yarn.msi
)
)

rem ======================================================================
rem ffmpeg Setup
rem ======================================================================

rem set ffmpeg_path="C:\Custom\Path"
rem Download and install Yarn
if not exist backend\ffmpeg.exe (
echo "Installing FFMPEG..."
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 ; wget https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20181114-1096614-win64-static.zip -outfile ffmpeg.zip"
powershell -command "Expand-Archive -Path "ffmpeg.zip" -DestinationPath "ffmpeg"
copy ffmpeg\ffmpeg-20181114-1096614-win64-static\bin\ffmpeg.exe backend\ffmpeg.exe
)

rem ======================================================================
rem Start Python backend
rem ======================================================================
cd backend
set CORPUS=english_corpus.csv
"%python3_dir%\scripts\pip.exe" install -r requirements.txt
start "Python Backend" "%python3_dir%\python.exe" run.py
cd ..

rem ======================================================================
rem Start web server
rem ======================================================================

cd frontend
"%python3_dir%\Scripts\pip.exe" install -r requirements.txt
cmd /c yarn install
yarn start


:Exit
popd

0 comments on commit 7909951

Please sign in to comment.