├── Android_App ├── app │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── values │ │ │ │ │ ├── dimens.xml │ │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ │ ├── preloaded_fonts.xml │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── themes.xml │ │ │ │ │ └── font_certs.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── xml │ │ │ │ │ └── provider_paths.xml │ │ │ │ ├── drawable-hdpi │ │ │ │ │ └── ic_action_name.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── ic_action_name.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ └── ic_action_name.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ └── ic_action_name.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ │ └── ic_action_name.png │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── font │ │ │ │ │ └── maven_pro.xml │ │ │ │ ├── drawable │ │ │ │ │ ├── ic_baseline_delete_24.xml │ │ │ │ │ ├── button_state.xml │ │ │ │ │ ├── ic_baseline_play_circle_24.xml │ │ │ │ │ ├── ic_baseline_pause_circle_24.xml │ │ │ │ │ ├── ic_baseline_folder_24.xml │ │ │ │ │ ├── play_button_pressed.xml │ │ │ │ │ ├── play_button_default.xml │ │ │ │ │ ├── play_button_focused.xml │ │ │ │ │ ├── ic_baseline_power_settings_new_24.xml │ │ │ │ │ ├── ic_baseline_select_all_24.xml │ │ │ │ │ ├── ic_italy.xml │ │ │ │ │ ├── ic_baseline_share_24.xml │ │ │ │ │ ├── ic_baseline_settings_24.xml │ │ │ │ │ ├── ic_united_kingdom.xml │ │ │ │ │ └── ic_launcher_background.xml │ │ │ │ ├── menu │ │ │ │ │ ├── menu.xml │ │ │ │ │ └── menu_select.xml │ │ │ │ ├── values-night │ │ │ │ │ └── themes.xml │ │ │ │ ├── layout │ │ │ │ │ ├── activity_recordings.xml │ │ │ │ │ ├── example_row.xml │ │ │ │ │ └── activity_main.xml │ │ │ │ └── drawable-v24 │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── android │ │ │ │ │ └── simsax │ │ │ │ │ ├── MainViewModel.java │ │ │ │ │ ├── ExampleRow.java │ │ │ │ │ ├── RecordingsActivity.java │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── AudioListAdapter.java │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── android │ │ │ │ └── simsax │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── com │ │ │ └── android │ │ │ └── simsax │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── settings.gradle ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── vcs.xml │ ├── misc.xml │ ├── gradle.xml │ └── jarRepositories.xml ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── gradle.properties ├── gradlew.bat └── gradlew ├── logdir ├── LJ01-2 │ └── here the pretrained SSRN.txt └── LJ01-1 │ └── here the pretrained text2mel.txt ├── LJSpeech-1.1 ├── wavs │ └── put your audio files here.txt └── transcript.csv ├── demo.gif ├── .gitignore ├── prepo.py ├── harvard_sentences.txt ├── record.py ├── hyperparams.py ├── server.py ├── synthesize.py ├── utils.py ├── data_load.py ├── README.md ├── train.py ├── modules.py ├── networks.py └── LICENSE /Android_App/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /logdir/LJ01-2/here the pretrained SSRN.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LJSpeech-1.1/wavs/put your audio files here.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logdir/LJ01-1/here the pretrained text2mel.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Android_App/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "Simsax" -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/demo.gif -------------------------------------------------------------------------------- /Android_App/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | -------------------------------------------------------------------------------- /Android_App/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/xml/provider_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable-hdpi/ic_action_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/drawable-hdpi/ic_action_name.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable-mdpi/ic_action_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/drawable-mdpi/ic_action_name.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable-xhdpi/ic_action_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/drawable-xhdpi/ic_action_name.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable-xxhdpi/ic_action_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/drawable-xxhdpi/ic_action_name.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable-xxxhdpi/ic_action_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/drawable-xxxhdpi/ic_action_name.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simsax/Voice_cloner/HEAD/Android_App/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android_App/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3DDC84 4 | -------------------------------------------------------------------------------- /Android_App/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Android_App/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/values/preloaded_fonts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @font/maven_pro 5 | 6 | 7 | -------------------------------------------------------------------------------- /Android_App/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Mar 04 23:06:07 CET 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip 7 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Android_App/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/font/maven_pro.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_baseline_delete_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/menu/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | /Android_App/.gradle 3 | /Android_App/local.properties 4 | /Android_App/.idea/caches 5 | /Android_App/.idea/libraries 6 | /Android_App/.idea/modules.xml 7 | /Android_App/.idea/workspace.xml 8 | /Android_App/.idea/navEditor.xml 9 | /Android_App/.idea/assetWizardSettings.xml 10 | /Android_App/.DS_Store 11 | /Android_App/build 12 | /Android_App/captures 13 | /Android_App/.externalNativeBuild 14 | /Android_App/.cxx 15 | /Android_App/local.properties 16 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/button_state.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_baseline_play_circle_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_baseline_pause_circle_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /Android_App/app/src/test/java/com/android/simsax/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.android.simsax; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_baseline_folder_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /Android_App/app/src/main/java/com/android/simsax/MainViewModel.java: -------------------------------------------------------------------------------- 1 | package com.android.simsax; 2 | 3 | import androidx.lifecycle.MutableLiveData; 4 | import androidx.lifecycle.ViewModel; 5 | 6 | public class MainViewModel extends ViewModel { 7 | MutableLiveData mutableLiveData = new MutableLiveData<>(); 8 | 9 | public void setText(String s) { 10 | mutableLiveData.setValue(s); 11 | } 12 | 13 | public MutableLiveData getText() { 14 | return mutableLiveData; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/play_button_pressed.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/play_button_default.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/play_button_focused.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_baseline_power_settings_new_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /Android_App/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath "com.android.tools.build:gradle:4.1.2" 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_baseline_select_all_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/menu/menu_select.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 18 | -------------------------------------------------------------------------------- /prepo.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #/usr/bin/python2 3 | ''' 4 | By kyubyong park. kbpark.linguist@gmail.com. 5 | https://www.github.com/kyubyong/dc_tts 6 | ''' 7 | 8 | from __future__ import print_function 9 | 10 | from utils import load_spectrograms 11 | import os 12 | from data_load import load_data 13 | import numpy as np 14 | import tqdm 15 | 16 | # Load data 17 | fpaths, _, _ = load_data() # list 18 | 19 | for fpath in tqdm.tqdm(fpaths): 20 | fname, mel, mag = load_spectrograms(fpath) 21 | if not os.path.exists("mels"): os.mkdir("mels") 22 | if not os.path.exists("mags"): os.mkdir("mags") 23 | 24 | np.save("mels/{}".format(fname.replace("wav", "npy")), mel) 25 | np.save("mags/{}".format(fname.replace("wav", "npy")), mag) -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_italy.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_baseline_share_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /Android_App/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /Android_App/app/src/main/java/com/android/simsax/ExampleRow.java: -------------------------------------------------------------------------------- 1 | package com.android.simsax; 2 | 3 | import java.io.File; 4 | 5 | public class ExampleRow { 6 | private int imageButton; 7 | private String audioName; 8 | private File file; 9 | 10 | public ExampleRow(int imageButton, String audioName, File file) { 11 | this.imageButton = imageButton; 12 | this.audioName = audioName; 13 | this.file = file; 14 | } 15 | 16 | public int getImageButton() { 17 | return imageButton; 18 | } 19 | 20 | public void setImageButton(int imageButton) { 21 | this.imageButton = imageButton; 22 | } 23 | 24 | public String getAudioName() { 25 | return audioName; 26 | } 27 | 28 | public void setAudioName(String name) {this.audioName = name;} 29 | 30 | public File getFile() { 31 | return file; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Android_App/app/src/androidTest/java/com/android/simsax/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.android.simsax; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.android.simsax", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /Android_App/app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /Android_App/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /harvard_sentences.txt: -------------------------------------------------------------------------------- 1 | http://www.cs.columbia.edu/~hgs/audio/harvard.html 2 | 1. The birch canoe slid on the smooth planks. 3 | 2. Glue the sheet to the dark blue background. 4 | 3. It's easy to tell the depth of a well. 5 | 4. These days a chicken leg is a rare dish. 6 | 5. Rice is often served in round bowls. 7 | 6. The juice of lemons makes fine punch. 8 | 7. The box was thrown beside the parked truck. 9 | 8. The hogs were fed chopped corn and garbage. 10 | 9. Four hours of steady work faced us. 11 | 10. Large size in stockings is hard to sell. 12 | 11. The boy was there when the sun rose. 13 | 12. A rod is used to catch pink salmon. 14 | 13. The source of the huge river is the clear spring. 15 | 14. Kick the ball straight and follow through. 16 | 15. Help the woman get back to her feet. 17 | 16. A pot of tea helps to pass the evening. 18 | 17. Smoky fires lack flame and heat. 19 | 18. The soft cushion broke the man's fall. 20 | 19. The salt breeze came across from the sea. 21 | 20. The girl at the booth sold fifty bonds. 22 | -------------------------------------------------------------------------------- /Android_App/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /Android_App/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_baseline_settings_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Simsax voice 3 | Write something... 4 | Scrivi qualcosa... 5 | play button 6 | fuck off 7 | Recordings 8 | Settings 9 | Exit 10 | Navigation drawer open 11 | Navigation drawer close 12 | RecordingsActivity 13 | 14 | First Fragment 15 | Second Fragment 16 | Next 17 | Previous 18 | 19 | Hello first fragment 20 | Hello second fragment. Arg: %1$s 21 | TextView 22 | Send to... 23 | ita button 24 | eng button 25 | -------------------------------------------------------------------------------- /Android_App/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | compileSdkVersion 29 7 | buildToolsVersion "30.0.3" 8 | 9 | defaultConfig { 10 | vectorDrawables.useSupportLibrary = true 11 | applicationId "com.android.simsax" 12 | minSdkVersion 16 13 | targetSdkVersion 29 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation 'androidx.recyclerview:recyclerview-selection:1.0.0' 34 | implementation 'androidx.cardview:cardview:1.0.0' 35 | implementation 'androidx.appcompat:appcompat:1.2.0' 36 | implementation 'com.google.android.material:material:1.3.0' 37 | implementation 'androidx.navigation:navigation-fragment:2.3.3' 38 | implementation 'androidx.navigation:navigation-ui:2.3.3' 39 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' 40 | testImplementation 'junit:junit:4.+' 41 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 42 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 43 | } -------------------------------------------------------------------------------- /record.py: -------------------------------------------------------------------------------- 1 | import pyaudio 2 | import wave 3 | import keyboard 4 | 5 | # Press enter to start the recording, then press the keyboard to stop it 6 | 7 | chunk = 1024 8 | sample_format = pyaudio.paInt16 9 | channels = 2 10 | fs = 44100 11 | seconds = 11 # max duration 12 | 13 | # read the file and cycle for each sentence 14 | with open("transcript.csv", "r") as f: 15 | for line in f: 16 | tokens = line.split("|") 17 | index = tokens[0] 18 | sentence = tokens[1] 19 | p = pyaudio.PyAudio() 20 | input(f"Next: {sentence}") 21 | print('Recording...') 22 | 23 | stream = p.open(format=sample_format, 24 | channels=channels, 25 | rate=fs, 26 | frames_per_buffer=chunk, 27 | input=True) 28 | 29 | frames = [] 30 | 31 | # Store data in chunks for 10 seconds 32 | for i in range(0, int(fs / chunk * seconds)): 33 | if (keyboard.is_pressed(' ')): 34 | break 35 | data = stream.read(chunk) 36 | frames.append(data) 37 | 38 | stream.stop_stream() 39 | stream.close() 40 | p.terminate() 41 | 42 | print('Finished recording') 43 | 44 | # Save the recorded data as a WAV file 45 | wf = wave.open(f"{index}.wav", 'wb') 46 | 47 | wf.setnchannels(channels) 48 | wf.setsampwidth(p.get_sample_size(sample_format)) 49 | wf.setframerate(fs) 50 | wf.writeframes(b''.join(frames)) 51 | wf.close() -------------------------------------------------------------------------------- /Android_App/app/src/main/res/layout/activity_recordings.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 21 | 22 | 35 | -------------------------------------------------------------------------------- /hyperparams.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #/usr/bin/python2 3 | ''' 4 | By kyubyong park. kbpark.linguist@gmail.com. 5 | https://www.github.com/kyubyong/dc_tts 6 | ''' 7 | class Hyperparams: 8 | '''Hyper parameters''' 9 | # pipeline 10 | prepro = True # if True, run `python prepro.py` first before running `python train.py`. 11 | 12 | # signal processing 13 | sr = 22050 # Sampling rate. 14 | n_fft = 2048 # fft points (samples) 15 | frame_shift = 0.0125 # seconds 16 | frame_length = 0.05 # seconds 17 | hop_length = int(sr * frame_shift) # samples. =276. 18 | win_length = int(sr * frame_length) # samples. =1102. 19 | n_mels = 80 # Number of Mel banks to generate 20 | power = 1.5 # Exponent for amplifying the predicted magnitude 21 | n_iter = 50 # Number of inversion iterations 22 | preemphasis = .97 23 | max_db = 100 24 | ref_db = 20 25 | 26 | # Model 27 | r = 4 # Reduction factor. Do not change this. 28 | dropout_rate = 0.05 29 | e = 128 # == embedding 30 | d = 256 # == hidden units of Text2Mel 31 | c = 512 # == hidden units of SSRN 32 | attention_win_size = 3 33 | 34 | # data 35 | data = r"C:\Users\Sax\Desktop\robe\Progetti\TTS\modello inglese\TTS\LJSpeech-1.1" 36 | # data = "/data/private/voice/kate" 37 | test_data = 'harvard_sentences.txt' 38 | vocab = "PE abcdefghijklmnopqrstuvwxyz'.?" # P: Padding, E: EOS. 39 | #max_N = 180 # Maximum number of characters. 40 | #max_T = 210 # Maximum number of mel frames. 41 | max_N = 143 42 | max_T = 120 43 | 44 | # training scheme 45 | lr = 0.001 # Initial learning rate. 46 | lang = "ENG" 47 | logdir = "logdir/LJ01" 48 | sampledir = 'samples' 49 | B = 16 # batch size 50 | num_iterations = 1000 51 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /Android_App/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 15 | 17 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 37 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/drawable/ic_united_kingdom.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 28 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/layout/example_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 20 | 21 | 39 | 40 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /server.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import os 3 | from playsound import playsound 4 | from pydub import AudioSegment 5 | 6 | 7 | def sendToClient(msg): 8 | msg = msg.decode('utf-8') 9 | lang = msg[:3] # ITA or ENG 10 | msg = msg[3:] # actual message 11 | words = msg.split(" ") 12 | if len(words) > 18: 13 | sentences = [] 14 | sentence = "" 15 | for i in range(len(words)): 16 | sentence += words[i] + " " 17 | if i%12 == 0 and i != 0: 18 | sentences.append(sentence) 19 | sentence = "" 20 | elif i == len(words)-1: 21 | sentences.append(sentence) 22 | 23 | with open('harvard_sentences.txt','w') as f: 24 | first = True 25 | for i, sentence in enumerate(sentences, start=1): 26 | if first: 27 | f.write("first line\n1. "+str(sentence)+"\n") 28 | first = False 29 | else: 30 | f.write(f"{i}. {str(sentence)}\n") 31 | 32 | num_sentences = len(sentences) 33 | else: 34 | with open('harvard_sentences.txt','w') as f: 35 | f.write("first line\n1. "+str(msg)+"\n") 36 | num_sentences = 1 37 | os.system('python synthesize.py '+lang) 38 | sounds = 0 39 | for i in range(0, num_sentences): 40 | sounds += AudioSegment.from_wav(f"samples/{i+1}.wav") 41 | # increase volume by 10dB 42 | sounds += 10 43 | sounds.export("backup/final.wav", format="wav") 44 | f.close() 45 | with open('backup/final.wav', 'rb') as f: 46 | audiob = f.read() 47 | clientsocket.send(audiob) 48 | clientsocket.close() 49 | f.close() 50 | 51 | 52 | if __name__ == '__main__': 53 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 54 | s.bind(("0.0.0.0", 1234)) 55 | s.listen(5) 56 | 57 | while True: 58 | print("Waiting for connection...") 59 | clientsocket, address = s.accept() 60 | print(f"Connection from {address} has been established") 61 | msg = clientsocket.recv(2048) 62 | print(msg) 63 | sendToClient(msg) 64 | 65 | -------------------------------------------------------------------------------- /Android_App/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 24 | 25 | 29 | 30 | ` 37 | 38 | 41 | 42 |