diff --git a/.vs/TextToSpeech/v16/.suo b/.vs/TextToSpeech/v16/.suo deleted file mode 100644 index e67d242..0000000 Binary files a/.vs/TextToSpeech/v16/.suo and /dev/null differ diff --git a/README.md b/README.md index c4f2865..653db6f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A windows forms text to speech program [![License](https://img.shields.io/badge/License-Mit-blue.svg?style=for-the-badge&logo=mit)](LICENSE.md) -![alt text](https://github.com/bigboybamo/Text2speeech/blob/main/TextToSpeech/images/text_speech.JPG) +![alt text](https://github.com/bigboybamo/Text2speeech/blob/main/TextToSpeech/images/text_speech.png) ## Features * Convert written text to spoken sentences. diff --git a/TextToSpeech/Common/ErrorMessages.cs b/TextToSpeech/Common/ErrorMessages.cs new file mode 100644 index 0000000..da49a6b --- /dev/null +++ b/TextToSpeech/Common/ErrorMessages.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TextToSpeech.Common +{ + public static class ErrorMessages + { + public const string NoVoiceSelected = "Please select a voice."; + public const string NoTextProvided = "Please provide text to speak."; + public const string NoTextHighlighted = "Please Highlight Some Text."; + public const string TextStillSpeaking = "Please Wait for the current speech to finish or Stop."; + public const string ErrorOpeningFile = "There was an error opening the current file."; + public const string InvalidRate = "Invalid rate value. Please enter a value between -10 and 10."; + public const string InvalidVolume = "Invalid volume value. Please enter a value between 0 and 100."; + public const string FileNotFound = "The specified file was not found."; + public const string FileAlreadyExists = "The specified file already exists. Please choose a different name."; + public const string SaveAudioError = "Error saving audio file. Please check the file path and permissions."; + } +} diff --git a/TextToSpeech/Form1.Designer.cs b/TextToSpeech/Form1.Designer.cs index 504a100..2a8a476 100644 --- a/TextToSpeech/Form1.Designer.cs +++ b/TextToSpeech/Form1.Designer.cs @@ -29,6 +29,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.BtnSpeech = new System.Windows.Forms.Button(); this.BtnOpenFile = new System.Windows.Forms.Button(); @@ -50,6 +51,9 @@ private void InitializeComponent() this.cmbVoice = new System.Windows.Forms.ComboBox(); this.ofd1 = new System.Windows.Forms.OpenFileDialog(); this.SaveAudio = new System.Windows.Forms.CheckBox(); + this.MonthCalendar = new System.Windows.Forms.MonthCalendar(); + this.ClockTimer = new System.Windows.Forms.Timer(this.components); + this.ClockLabel = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); this.groupBox2.SuspendLayout(); @@ -278,12 +282,34 @@ private void InitializeComponent() this.SaveAudio.Text = "Save Audio File"; this.SaveAudio.UseVisualStyleBackColor = true; // + // MonthCalendar + // + this.MonthCalendar.Location = new System.Drawing.Point(1122, 138); + this.MonthCalendar.Name = "MonthCalendar"; + this.MonthCalendar.TabIndex = 12; + // + // ClockTimer + // + this.ClockTimer.Tick += new System.EventHandler(this.ClockTimer_Tick); + // + // ClockLabel + // + this.ClockLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.ClockLabel.Location = new System.Drawing.Point(1118, 44); + this.ClockLabel.Name = "ClockLabel"; + this.ClockLabel.Size = new System.Drawing.Size(316, 50); + this.ClockLabel.TabIndex = 13; + this.ClockLabel.Text = "Clock time"; + this.ClockLabel.Visible = false; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.ClientSize = new System.Drawing.Size(1449, 851); + this.ClientSize = new System.Drawing.Size(1536, 851); + this.Controls.Add(this.ClockLabel); + this.Controls.Add(this.MonthCalendar); this.Controls.Add(this.SaveAudio); this.Controls.Add(this.cmbVoice); this.Controls.Add(this.BtnPronounce); @@ -298,6 +324,7 @@ private void InitializeComponent() this.Cursor = System.Windows.Forms.Cursors.Hand; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.MaximizeBox = false; this.Name = "Form1"; this.Text = "Text2Speech"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); @@ -335,6 +362,9 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox cmbVoice; private System.Windows.Forms.OpenFileDialog ofd1; private System.Windows.Forms.CheckBox SaveAudio; + private System.Windows.Forms.MonthCalendar MonthCalendar; + private System.Windows.Forms.Timer ClockTimer; + private System.Windows.Forms.Label ClockLabel; } } diff --git a/TextToSpeech/Form1.cs b/TextToSpeech/Form1.cs index 39a4e09..d9bb8ba 100644 --- a/TextToSpeech/Form1.cs +++ b/TextToSpeech/Form1.cs @@ -6,6 +6,7 @@ using TextToSpeech.Interfaces; using TextToSpeech.Implementations; using TextToSpeechLogger; +using TextToSpeech.Common; namespace TextToSpeech { @@ -17,6 +18,7 @@ public Form1() // Set the form size this.Height = 600; this.Width = 1000; + StartTimer(); } private ISpeechSynthesizer synthVoice; @@ -110,7 +112,7 @@ private void BtnOpenFile_Click(object sender, EventArgs e) } else { - MessageBox.Show("Error"); + MessageBox.Show(ErrorMessages.ErrorOpeningFile); } } } @@ -180,24 +182,24 @@ public void LoadVoices() private void CheckVoiceandText(bool ishighLighted = false) { - if (cmbVoice.Text == "Select Voice" || cmbVoice.SelectedIndex == 0) + if (cmbVoice.Text == ErrorMessages.NoVoiceSelected || cmbVoice.SelectedIndex == 0) { - throw new InvalidOperationException("Please Select a Voice"); + throw new InvalidOperationException(ErrorMessages.NoVoiceSelected); } if (txtSpechText.Text.Trim().Length == 0) { - throw new InvalidOperationException("Please Enter Some Text"); + throw new InvalidOperationException(ErrorMessages.NoTextProvided); } if (ishighLighted && txtSpechText.SelectionLength == 0) { - throw new InvalidOperationException("Please Highlight Some Text"); + throw new InvalidOperationException(ErrorMessages.NoTextHighlighted); } if (synthVoice.State == SynthesizerState.Speaking) { - throw new InvalidOperationException("Please Wait for the current speech to finish or Stop"); + throw new InvalidOperationException(ErrorMessages.TextStillSpeaking); } } @@ -218,5 +220,21 @@ private void trackBar2_Scroll(object sender, EventArgs e) synthVoice.RestartFromCurrentPosition(txtSpechText.Text); } } + + private void StartTimer() + { + ClockTimer = new Timer + { + Interval = 500 + }; + ClockTimer.Tick += ClockTimer_Tick; + ClockTimer.Enabled = true; + } + + private void ClockTimer_Tick(object sender, EventArgs e) + { + ClockLabel.Text = DateTime.Now.ToString("HH:mm:ss"); + ClockLabel.Visible = true; + } } } \ No newline at end of file diff --git a/TextToSpeech/Form1.resx b/TextToSpeech/Form1.resx index fbedae2..e080f7c 100644 --- a/TextToSpeech/Form1.resx +++ b/TextToSpeech/Form1.resx @@ -120,6 +120,9 @@ 17, 17 + + 112, 22 + diff --git a/TextToSpeech/Implementations/SpeechSynthesizerWrapper.cs b/TextToSpeech/Implementations/SpeechSynthesizerWrapper.cs index d39afdb..2acf3f4 100644 --- a/TextToSpeech/Implementations/SpeechSynthesizerWrapper.cs +++ b/TextToSpeech/Implementations/SpeechSynthesizerWrapper.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Speech.Synthesis; using TextToSpeech.Interfaces; @@ -153,6 +154,7 @@ public void SaveAudioFile() _speechSynthesizer.SetOutputToWaveFile(outputPath); _speechSynthesizer.Speak(text); _speechSynthesizer.SetOutputToNull(); + Process.Start(textToSpeechPath); } ~SpeechSynthesizerWrapper() diff --git a/TextToSpeech/TextToSpeech.csproj b/TextToSpeech/TextToSpeech.csproj index 1c1d552..cb135c2 100644 --- a/TextToSpeech/TextToSpeech.csproj +++ b/TextToSpeech/TextToSpeech.csproj @@ -67,6 +67,7 @@ + Form diff --git a/TextToSpeech/bin/Debug/TextToSpeech.exe b/TextToSpeech/bin/Debug/TextToSpeech.exe index 4695382..49c38e0 100644 Binary files a/TextToSpeech/bin/Debug/TextToSpeech.exe and b/TextToSpeech/bin/Debug/TextToSpeech.exe differ diff --git a/TextToSpeech/bin/Debug/TextToSpeech.pdb b/TextToSpeech/bin/Debug/TextToSpeech.pdb index 74d1b77..9cc09ab 100644 Binary files a/TextToSpeech/bin/Debug/TextToSpeech.pdb and b/TextToSpeech/bin/Debug/TextToSpeech.pdb differ diff --git a/TextToSpeech/bin/Release/TextToSpeech.exe b/TextToSpeech/bin/Release/TextToSpeech.exe index dbb2ae2..45c4c8d 100644 Binary files a/TextToSpeech/bin/Release/TextToSpeech.exe and b/TextToSpeech/bin/Release/TextToSpeech.exe differ diff --git a/TextToSpeech/bin/Release/TextToSpeech.pdb b/TextToSpeech/bin/Release/TextToSpeech.pdb index 61a4883..196df9b 100644 Binary files a/TextToSpeech/bin/Release/TextToSpeech.pdb and b/TextToSpeech/bin/Release/TextToSpeech.pdb differ diff --git a/TextToSpeech/images/text_speech.JPG b/TextToSpeech/images/text_speech.JPG deleted file mode 100644 index 7e71f0e..0000000 Binary files a/TextToSpeech/images/text_speech.JPG and /dev/null differ diff --git a/TextToSpeech/images/text_speech.png b/TextToSpeech/images/text_speech.png new file mode 100644 index 0000000..79434fa Binary files /dev/null and b/TextToSpeech/images/text_speech.png differ diff --git a/TextToSpeech/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/TextToSpeech/obj/Debug/DesignTimeResolveAssemblyReferences.cache index aa9ce3b..75dda31 100644 Binary files a/TextToSpeech/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/TextToSpeech/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/TextToSpeech/obj/Debug/TextToSpeech.csproj.AssemblyReference.cache b/TextToSpeech/obj/Debug/TextToSpeech.csproj.AssemblyReference.cache index 3827186..59655fc 100644 Binary files a/TextToSpeech/obj/Debug/TextToSpeech.csproj.AssemblyReference.cache and b/TextToSpeech/obj/Debug/TextToSpeech.csproj.AssemblyReference.cache differ diff --git a/TextToSpeech/obj/Debug/TextToSpeech.csproj.CoreCompileInputs.cache b/TextToSpeech/obj/Debug/TextToSpeech.csproj.CoreCompileInputs.cache index 5a5bcad..c8fe534 100644 --- a/TextToSpeech/obj/Debug/TextToSpeech.csproj.CoreCompileInputs.cache +++ b/TextToSpeech/obj/Debug/TextToSpeech.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -40cda065bc98d7a1ee342fa1d437a41d17d2c18a38d6ff112132fa3743a7c9d8 +578f5453fd71c687fbf022c2f7134e2ea371e47b34b0d0953859fda1abe3e10d diff --git a/TextToSpeech/obj/Debug/TextToSpeech.csproj.GenerateResource.cache b/TextToSpeech/obj/Debug/TextToSpeech.csproj.GenerateResource.cache index f97af95..6a50997 100644 Binary files a/TextToSpeech/obj/Debug/TextToSpeech.csproj.GenerateResource.cache and b/TextToSpeech/obj/Debug/TextToSpeech.csproj.GenerateResource.cache differ diff --git a/TextToSpeech/obj/Debug/TextToSpeech.exe b/TextToSpeech/obj/Debug/TextToSpeech.exe index 4695382..49c38e0 100644 Binary files a/TextToSpeech/obj/Debug/TextToSpeech.exe and b/TextToSpeech/obj/Debug/TextToSpeech.exe differ diff --git a/TextToSpeech/obj/Debug/TextToSpeech.pdb b/TextToSpeech/obj/Debug/TextToSpeech.pdb index 74d1b77..9cc09ab 100644 Binary files a/TextToSpeech/obj/Debug/TextToSpeech.pdb and b/TextToSpeech/obj/Debug/TextToSpeech.pdb differ diff --git a/TextToSpeech/obj/Release/TextToSpeech.csproj.AssemblyReference.cache b/TextToSpeech/obj/Release/TextToSpeech.csproj.AssemblyReference.cache index 805f9f7..3d25bec 100644 Binary files a/TextToSpeech/obj/Release/TextToSpeech.csproj.AssemblyReference.cache and b/TextToSpeech/obj/Release/TextToSpeech.csproj.AssemblyReference.cache differ diff --git a/TextToSpeech/obj/Release/TextToSpeech.csproj.GenerateResource.cache b/TextToSpeech/obj/Release/TextToSpeech.csproj.GenerateResource.cache index f97af95..6a50997 100644 Binary files a/TextToSpeech/obj/Release/TextToSpeech.csproj.GenerateResource.cache and b/TextToSpeech/obj/Release/TextToSpeech.csproj.GenerateResource.cache differ diff --git a/TextToSpeech/obj/Release/TextToSpeech.exe b/TextToSpeech/obj/Release/TextToSpeech.exe index dbb2ae2..45c4c8d 100644 Binary files a/TextToSpeech/obj/Release/TextToSpeech.exe and b/TextToSpeech/obj/Release/TextToSpeech.exe differ diff --git a/TextToSpeech/obj/Release/TextToSpeech.pdb b/TextToSpeech/obj/Release/TextToSpeech.pdb index 61a4883..196df9b 100644 Binary files a/TextToSpeech/obj/Release/TextToSpeech.pdb and b/TextToSpeech/obj/Release/TextToSpeech.pdb differ diff --git a/TextToSpeechInstaller/bin/Debug/en-us/TextToSpeechInstaller.msi b/TextToSpeechInstaller/bin/Debug/en-us/TextToSpeechInstaller.msi index fc69a77..2ebdf1f 100644 Binary files a/TextToSpeechInstaller/bin/Debug/en-us/TextToSpeechInstaller.msi and b/TextToSpeechInstaller/bin/Debug/en-us/TextToSpeechInstaller.msi differ diff --git a/TextToSpeechInstaller/bin/Debug/en-us/TextToSpeechInstaller.wixpdb b/TextToSpeechInstaller/bin/Debug/en-us/TextToSpeechInstaller.wixpdb index cf88385..6350139 100644 Binary files a/TextToSpeechInstaller/bin/Debug/en-us/TextToSpeechInstaller.wixpdb and b/TextToSpeechInstaller/bin/Debug/en-us/TextToSpeechInstaller.wixpdb differ diff --git a/TextToSpeechInstaller/bin/Release/en-us/TextToSpeechInstaller.msi b/TextToSpeechInstaller/bin/Release/en-us/TextToSpeechInstaller.msi index b22dfb5..ea21689 100644 Binary files a/TextToSpeechInstaller/bin/Release/en-us/TextToSpeechInstaller.msi and b/TextToSpeechInstaller/bin/Release/en-us/TextToSpeechInstaller.msi differ diff --git a/TextToSpeechInstaller/bin/Release/en-us/TextToSpeechInstaller.wixpdb b/TextToSpeechInstaller/bin/Release/en-us/TextToSpeechInstaller.wixpdb index 9db191f..bc55aa7 100644 Binary files a/TextToSpeechInstaller/bin/Release/en-us/TextToSpeechInstaller.wixpdb and b/TextToSpeechInstaller/bin/Release/en-us/TextToSpeechInstaller.wixpdb differ diff --git a/TextToSpeechInstaller/obj/Release/TextToSpeechInstaller.wixproj.BindContentsFileListen-us.txt b/TextToSpeechInstaller/obj/Release/TextToSpeechInstaller.wixproj.BindContentsFileListen-us.txt new file mode 100644 index 0000000..5050359 --- /dev/null +++ b/TextToSpeechInstaller/obj/Release/TextToSpeechInstaller.wixproj.BindContentsFileListen-us.txt @@ -0,0 +1,2 @@ +..\TextToSpeech\bin\Release\TextToSpeech.exe +..\TextToSpeechLogger\bin\Release\TextToSpeechLogger.dll diff --git a/TextToSpeechInstaller/obj/Release/TextToSpeechInstaller.wixproj.BindOutputsFileListen-us.txt b/TextToSpeechInstaller/obj/Release/TextToSpeechInstaller.wixproj.BindOutputsFileListen-us.txt new file mode 100644 index 0000000..9fca2ff --- /dev/null +++ b/TextToSpeechInstaller/obj/Release/TextToSpeechInstaller.wixproj.BindOutputsFileListen-us.txt @@ -0,0 +1,2 @@ +C:\Users\oyetu\source\repos\Text2speeech\TextToSpeechInstaller\bin\Release\en-us\TextToSpeechInstaller.msi +C:\Users\oyetu\source\repos\Text2speeech\TextToSpeechInstaller\bin\Release\en-us\TextToSpeechInstaller.wixpdb