XAMLab(ザムラボ)
ザムラボ - XAML研究室、WPF、Silverlight関連など。

目次

Blog 利用状況
  • 投稿数 - 202
  • 記事 - 1
  • コメント - 1191
  • トラックバック - 43
ニュース

書庫

日記カテゴリ

ギャラリ

なか-chan関連サイト

他の方へのリンク

 

世の中、初音ミクというバーチャル・アイドル歌手が流行っているらしいですが、WPFでも簡単にパソコンで音声合成を楽しめるという記事を見つけました。こちらです。学び、そして考えるWPFがしゃべったー。という記事です。実際にやってみると実に簡単で面白いです。

では、実際にExpression BlendとVisual Studio 2005 を使ってしゃべらせてみましょう。

まず、Expression Blendを起動し、新規プロジェクトを作成します。
左側の、TextBoxコントロールをダブルクリックし、Windowに配置します。

①ウィンドウサイズを、テキストボックスに合わせて小さくしておきましょう。
②種類がTextBoxになっていることを確認し、名前を「textBox1」とつけます。
③そのままイベントボタンを押して、イベントウィンドウに切り替えます。
④KeyDownプロパティをダブルクリックすると、KeyDownのイベント
 が自動的に作成され、Visual Studioが開きます。

Visual Studioの右側、参照設定を右クリックし[参照の追加...]を選択します。

参照の追加ダイアログで、「.NET」から「System.Speech」を追加します。

以下のコードを入力します。

// テキストボックスのキーが押されたとき
private void textBox1_KeyDown(object sender, 
     System.Windows.Input.KeyEventArgs e) { // リターンキー以外は戻る if (e.Key != System.Windows.Input.Key.Return) return;

// (参照設定にSystem.Speechが追加されていること)
// スピーチシンセサイザを作成 System.Speech.Synthesis.SpeechSynthesizer ss = new System.Speech.Synthesis.SpeechSynthesizer();

// textBox1の言葉を話す ss.Speak(textBox1.Text); }

以上で完成です。[F5]キーを押して、実行してみましょう。
何か文字を入力して、リターンキーを押すと、入力した文字をしゃべります。このままだととりあえず、英語のみのようです。


投稿日時 : 2007年9月15日 16:07
コメント
  • # XAMLab目次
    XAMLab(ザムラボ)
    Posted @ 2007/09/15 16:10
    XAMLab目次
  • # re: [Expression Blend Tips]初音ミクに対抗してWPFでおしゃべり!
    p-nix
    Posted @ 2007/09/16 0:05
    あ、ご紹介ありがとうございます。作成者p-nixです。
    やってみると面白いでしょ。
    私は、あいつは英語だけじゃなく、フランス語、ドイツ語はしゃべれると思っています。(近々詳しく検証するつもりです。)

    逆に、音声認識(Speech.Recognition)試されてはいかがでしょう。自分はまだ着手していない領域なので。マイクでしゃべると、それを文字にする機能です。
    もしかして日本語非対応で、英語でしゃべってあげないと反応しないのでは・・・と予想しています。。
  • # re: [Expression Blend Tips]初音ミクに対抗してWPFでおしゃべり!
    なか-chan@最愛のiMac
    Posted @ 2007/09/16 13:48
    p-nixさんこんにちは。フランス語もいけそうですか。 認識は、

    http://www.vbstation.net/wpf/index.php/%E9%9F%B3%E5%A3%B0%E8%AA%8D%E8%AD%98-%E5%9F%BA%E6%9C%AC

    このあたりを参考にやってみようと思いましたが、タイミングがわるいのか?
    どうもうまくいきません。
  • # Howdy just wanted to give you a quick heads up and let you know a few of the pictures aren't loading properly. I'm not sure why but I think its a linking issue. I've tried it in two different internet browsers and both show the same results.
    Howdy just wanted to give you a quick heads up and
    Posted @ 2018/05/02 19:08
    Howdy just wanted to give you a quick heads up and let you know a few of the pictures
    aren't loading properly. I'm not sure why but I think its a linking issue.
    I've tried it in two different internet browsers and both show the same results.
  • # re: [Expression Blend Tips]初音ミクに対抗してWPFでおしゃべり!
    www.office.com/setup
    Posted @ 2018/12/21 2:56
    OKC bitches read this before 2018:
    -Never do what you don't want to do. You make the money, you decide where you are going and what you are doing.
    -Don't ask a woman what she wants to do.
    -Never get involved with a co-worker unless you don't mind losing your job over it.
    -Never spend more than $40 on a date. If possible, let her pay for everything or 50/50.
    -If she doesn't bang you by the third date, Dump That Bitch (DTB).
    -No spooning, cuddling, hugging, or staying over. Get in, get out!
    -Never be in a committed relationship UNTIL you are 25+ or really ready to settle down.
    -Men age like fine wine, women age like milk.
  • # Hi to every single one, it's actually a fastidious for me to pay a visit this web site, it includes useful Information.
    Hi to every single one, it's actually a fastidious
    Posted @ 2019/04/20 20:11
    Hi to every single one, it's actually a fastidious for me to pay
    a visit this web site, it includes useful Information.
  • # eCynLJjTYEswaltNFVs
    johnanz
    Posted @ 2022/04/19 12:04
    http://imrdsoacha.gov.co/silvitra-120mg-qrms
タイトル
名前
Url
コメント