Exemplo n.º 1
0
        private static void OneShotPlayMode(string libraryName, string text, EngineParameters ep)
        {
            var engines = SpeechController.GetAllSpeechEngine();
            var engine  = SpeechController.GetInstance(libraryName);

            if (engine == null)
            {
                Console.WriteLine($"{libraryName} を起動できませんでした。");
                return;
            }
            engine.Activate();
            engine.Finished += (s, a) =>
            {
                engine.Dispose();
            };
            if (ep.Volume > 0)
            {
                engine.SetVolume(ep.Volume);
            }
            if (ep.Speed > 0)
            {
                engine.SetSpeed(ep.Speed);
            }
            if (ep.Pitch > 0)
            {
                engine.SetPitch(ep.Pitch);
            }
            if (ep.PitchRange > 0)
            {
                engine.SetPitchRange(ep.PitchRange);
            }
            engine.Play(text);
        }
Exemplo n.º 2
0
        public static void RecordMode(string libraryName, string text, string outputFilename)
        {
            SoundRecorder recorder = new SoundRecorder(outputFilename);

            recorder.PostWait = 300;

            var engines = SpeechController.GetAllSpeechEngine();
            var engine  = SpeechController.GetInstance(libraryName);

            if (engine == null)
            {
                Console.WriteLine($"{libraryName} を起動できませんでした。");
                return;
            }

            engine.Activate();
            engine.Finished += (s, a) =>
            {
                Task t = recorder.Stop();
                t.Wait();
                finished = true;
                engine.Dispose();
            };
            recorder.Start();
            engine.Play(text);
        }
Exemplo n.º 3
0
    IEnumerator Startup()
    {
        ViewController.GetInstance().Initialize(ViewAnchorRef.transform);
        UserDataController.GetInstance().Initialize();
        while (UserDataController.GetInstance().ContactsUsers == null)
        {
            yield return(null);
        }

        SoundManager.GetInstance();
        yield return(new WaitForSeconds(.1f));

        StartCoroutine(NetworkController.GetInstance().Connect());
        SpeechController.GetInstance().Initialize();
        PhotoController.GetInstance().Initialize();



        CheatController.GetInstance().Initialize(ViewAnchorRef.transform);

        ContactsList cl = ViewController.GetInstance().CurrentView.GetComponent <ContactsList>();

        cl.Initialize();
        //Initiate The Singletons
        //Transaction<List<TcgCard>> t = new Transaction<List<TcgCard>>();
    }
Exemplo n.º 4
0
        private void Play()
        {
            var item = Items.Dequeue();
            var text = GetArticle(item);

            engine = SpeechController.GetInstance(LibraryName);
            engine.Activate();
            engine.Finished += Engine_Finished;
            IsPlaying        = true;
            engine.Play(text);
        }
Exemplo n.º 5
0
        private static void InteractiveMode()
        {
            // 利用可能な音声合成エンジンを列挙
            // Windows 10 (x64) 上での VOICEROID+, VOICEROID2, SAPI5 に対応
            // CeVIO(SAPI5) は Windows 10 (x64) では動作しないため表示されません
            Console.WriteLine("* 利用可能な音声合成エンジン *\r\n");
            Console.WriteLine("LibraryName,EngineName,EnginePath");
            var engines = SpeechController.GetAllSpeechEngine();

            foreach (var c in engines)
            {
                Console.WriteLine($"{c.LibraryName},{c.EngineName},{c.EnginePath}");
            }

            // ライブラリ名を入力(c.LibraryName列)
            Console.Write("\r\nLibraryName> ");
            name = Console.ReadLine().Trim();

            // 対象となるライブラリを実行
            var engine = SpeechController.GetInstance(name);

            if (engine == null)
            {
                Console.WriteLine($"{name} を起動できませんでした。");
                Console.ReadKey();
                return;
            }
            // 設定した音声の再生が終了したときに呼び出される処理を設定
            engine.Finished += Engine_Finished;

            // 音声合成エンジンを起動
            engine.Activate();
            string message = $"音声合成エンジン {engine.Info.EngineName}、{engine.Info.LibraryName}を起動しました。";

            engine.Play(message); // 音声再生は非同期実行される
            Console.WriteLine(message);
            engine.SetVolume(1.0f);

            string line = "";

            while (true)
            {
                line = Console.ReadLine();
                if (line.Trim() == "")
                {
                    engine.Dispose();
                    return;
                }
                engine.Stop();     // 喋っている途中に文字が入力されたら再生をストップ
                engine.Play(line); // 音声再生は非同期実行される
                Console.WriteLine($"Volume: {engine.GetVolume()}, Speed: {engine.GetSpeed()}, Pitch: {engine.GetPitch()}, PitchRange: {engine.GetPitchRange()}");
            }
        }
Exemplo n.º 6
0
        private static void InteractiveMode()
        {
            ShowVerbose();

            // ライブラリ名を入力(c.LibraryName列)
            Console.Write("\r\nLibraryName> ");
            name = Console.ReadLine().Trim();

            // 対象となるライブラリを実行
            var engine = SpeechController.GetInstance(name);

            if (engine == null)
            {
                Console.WriteLine($"{name} を起動できませんでした。");
                Console.ReadKey();
                return;
            }
            // 設定した音声の再生が終了したときに呼び出される処理を設定
            engine.Finished += Engine_Finished;

            // 音声合成エンジンを起動
            engine.Activate();
            engine.SetVolume(1.0f);
            engine.SetPitch(1.0f);
            engine.SetSpeed(1.0f);
            engine.SetPitchRange(1.0f);
            string message = $"音声合成エンジン {engine.Info.EngineName}、{engine.Info.LibraryName}を起動しました。";

            engine.Play(message); // 音声再生は非同期実行される
            Console.WriteLine(message);

            string line = "";

            while (true)
            {
                line = Console.ReadLine();
                if (line.Trim() == "")
                {
                    engine.Dispose();
                    return;
                }
                try
                {
                    engine.Stop();     // 喋っている途中に文字が入力されたら再生をストップ
                    engine.Play(line); // 音声再生は非同期実行される
                    Console.WriteLine($"Volume: {engine.GetVolume()}, Speed: {engine.GetSpeed()}, Pitch: {engine.GetPitch()}, PitchRange: {engine.GetPitchRange()}");
                }catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Exemplo n.º 7
0
        private static void WhisperMode(string libraryName, string text)
        {
            string tempFile    = "normal.wav";
            string whisperFile = "whisper.wav";

            var engines = SpeechController.GetAllSpeechEngine();
            var engine  = SpeechController.GetInstance(libraryName);

            if (engine == null)
            {
                Console.WriteLine($"{libraryName} を起動できませんでした。");
                return;
            }
            engine.Activate();

            SoundRecorder recorder = new SoundRecorder(tempFile);

            {
                recorder.PostWait = 300;

                engine.Finished += (s, a) =>
                {
                    finished = true;
                };

                recorder.Start();
                engine.Play(text);
            }

            while (!finished)
            {
                Thread.Sleep(100);
            }
            engine.Dispose();
            Task t = recorder.Stop();

            t.Wait();
            // ささやき声に変換
            Whisper whisper = new Whisper();
            Wave    wave    = new Wave();

            wave.Read(tempFile);
            whisper.Convert(wave);
            wave.Write(whisperFile, wave.Data);

            //// 変換した音声を再生
            SoundPlayer sp = new SoundPlayer();

            sp.Play(whisperFile);
        }
Exemplo n.º 8
0
        private static void OneShotPlayMode(string libraryName, string text)
        {
            var engines = SpeechController.GetAllSpeechEngine();
            var engine  = SpeechController.GetInstance(libraryName);

            if (engine == null)
            {
                Console.WriteLine($"{libraryName} を起動できませんでした。");
                return;
            }
            engine.Activate();
            engine.Finished += (s, a) =>
            {
                finished = true;
                engine.Dispose();
            };
            engine.Play(text);
        }
Exemplo n.º 9
0
 public void Initialize()
 {
     SpeechController.GetInstance().OnContextSpeechDetected += OnPhotoContextWord;
     photoLibrary = Instantiate <GameObject>(Resources.Load <GameObject>("prefabs/PhotoLibrary")).GetComponent <PhotoLibrary>();
     ActiveSet    = photoLibrary.PhotoSets[0];
 }