# \[WPF/.NET 3.0\] Simple Text-to-Speech App

**URL:** https://forum.kirupa.com/t/wpf-net-3-0-simple-text-to-speech-app/235201
**Category:** open source
**Created:** [August 9, 2007, 8:42am UTC](https://forum.kirupa.com/t/wpf-net-3-0-simple-text-to-speech-app/235201 "2007-08-09T08:42:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)
#### Post date: [August 9, 2007, 8:42am UTC](https://forum.kirupa.com/t/wpf-net-3-0-simple-text-to-speech-app/235201/1 "2007-08-09T08:42:17Z")

</div>

You can test it out here: [[U]http://www.kirupafx.com/ItSpeaks/publish.htm[/U] ([URL=“https://addons.mozilla.org/firefox/addon/1608”]FFClickOnce if you are running FF](http://www.kirupafx.com/ItSpeaks/publish.htm)). Btw, the application does not require .NET 3.5. Version 3.0 is good enough: ![](http://img186.imageshack.us/img186/3307/texttospeechyu9.png)

The code is pretty straightforward. The XAML is:

```auto
<Window
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
 x:Class="ItSpeaks.Window1"
 x:Name="Window"
 Title="Speech Synthesizer"
 Width="361" Height="159" Icon="sound.png" ResizeMode="NoResize">
 <Window.Background>
  <LinearGradientBrush EndPoint="0.5,0.975" StartPoint="0.5,0.025">
   <GradientStop Color="#FF0D3743" Offset="0"/>
   <GradientStop Color="#FF8CD0F0" Offset="1"/>
  </LinearGradientBrush>
 </Window.Background>
 <Grid x:Name="LayoutRoot">
  <TextBox Margin="33,52,93.447,49.04" x:Name="whatToSay" Text="" TextWrapping="Wrap" d:LayoutOverrides="Height" FontSize="18" FontWeight="Bold"/>
  <Button HorizontalAlignment="Right" Margin="0,52,15.377,49.04" x:Name="SpeakNow" Content="Speak" Click="Speak" d:LayoutOverrides="Height" Width="67.773" IsDefault="True"/>
  <Label HorizontalAlignment="Left" Margin="8,17,0,0" VerticalAlignment="Top" Width="97" Height="29" Content="what to say:" FontSize="14" FontWeight="Bold" Foreground="#FFE4E4E4"/>
 </Grid>
</Window>

```

And the C# is:

```auto
using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Speech.Synthesis;
namespace ItSpeaks
{
 public partial class Window1
 {
        private SpeechSynthesizer foo;
  public Window1()
  {
   this.InitializeComponent();
 
   // Insert code required on object creation below this point.
            foo = new SpeechSynthesizer();
  }
        private void Speak(object sender, System.Windows.RoutedEventArgs e)
        {
            // Speak
            foo.SpeakAsync(whatToSay.Text);
            // 0 to 100
            foo.Volume = 100;
            // -10 to 10
            foo.Rate = -2;
        }
 }
}

```

[SIZE=2]There is also a voice-to-text engine, so I might give that a shot later.[/SIZE]

[SIZE=2]👽 [/SIZE]
