Exemplo n.º 1
0
        private void saveWavDialog_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            InitTTSObjects();
            string text = textBox1.Text;

            if (textBox1.SelectionLength > 0)
            {
                text = textBox1.SelectedText;
            }

            target = new WaveFileAudioTarget();

            ((WaveFileAudioTarget)target).Filename = saveWavDialog.FileName;

            target.AudioFinished += OnFileAudioFinished;

            tokenizer.Run(text);
            parser.Run(tokenizer);
            segmenter.Run(parser);
            phonetizer.Run(segmenter);
            fujisaki.Run(phonetizer);
            translator.Run(fujisaki);
            synth.Run(translator);
            target.Run(synth);
        }
Exemplo n.º 2
0
        void Speak(TextReader text, AudioTarget audioTarget)
        {
            TextReaderCharProducer trcp = new TextReaderCharProducer();

            trcp.Run(text);
            Speak(trcp, audioTarget);
        }
Exemplo n.º 3
0
        public void Speak(string text, AudioTarget audioTarget)
        {
            if (audioTarget == null)
            {
                return;
            }
            _IsSpeaking = true;
            StringCharProducer sp = new StringCharProducer(text);

            Speak(sp, audioTarget);
        }
Exemplo n.º 4
0
 void Speak(Producer <char> producer, AudioTarget audioTarget)
 {
     if (audioTarget == null)
     {
         return;
     }
     Frontend.Run(producer);
     Backend.Run(Frontend);
     this.audioTarget = audioTarget;
     audioTarget.Run(Backend);
 }
Exemplo n.º 5
0
    public AudioObject(AudioCfg audioCfg, Transform root)
    {
        this.audioCfg = audioCfg;
        AudioID       = audioCfg.ID;
        gameObject    = new GameObject(audioCfg.ID.ToString());
        Disable();
        transform = gameObject.transform;
        transform.SetParent(root);

        audioTarget = new AudioTarget();

        audioSource = gameObject.AddComponent <AudioSource>();
        audioSource.outputAudioMixerGroup = AudioManager.GetMixerGroup((AudioGroupTypes)audioCfg.Priority);
        audioSource.volume       = audioCfg.Volume;
        audioSource.loop         = audioCfg.Loop;
        audioSource.dopplerLevel = 0;

        assetBundleName    = string.Format(audioBundlePath, audioCfg.AssetName.ToLower());
        assetLoadOperation = AssetLoadManager.LoadAssetAsync(assetBundleName, audioCfg.AssetName, typeof(AudioClip));
    }
Exemplo n.º 6
0
        private void ãáøToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InitTTSObjects();
            string text = textBox1.Text;

            if (textBox1.SelectionLength > 0)
            {
                text = textBox1.SelectedText;
            }

            target = new DSoundAudioTarget(this);
            target.AudioFinished += OnDSoundAudioFinished;
            tokenizer.Run(text);
            parser.Run(tokenizer);
            segmenter.Run(parser);
            phonetizer.Run(segmenter);
            fujisaki.Run(phonetizer);
            translator.Run(fujisaki);
            synth.Run(translator);
            target.Run(synth);
        }
Exemplo n.º 7
0
 void _audioTarget_AudioFinished()
 {
     _IsSpeaking  = false;
     _audioTarget = null;
 }