달력

62024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
반응형

일단은 System.Speech를 참조 추가하다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace TextToSpeech
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            SpeechSynthesizer speechSynth = new SpeechSynthesizer();
            PromptBuilder builder = new PromptBuilder();
            builder.ClearContent();
            builder.AppendText(textBox1.Text);
            speechSynth.Speak(builder);
        }
    }
}
cs

실행화면

이건 소리로 출력되는거라 실행은 각자 자신의 윈도우에서 컴파일해보세요.

Posted by 유령회사
|