TASK 55 - TEXT TO SPEECH APPLICATION
======================================

1. PROJECT OVERVIEW
-------------------
Task 55 is a Windows desktop Text-to-Speech application developed in
VB.NET using Windows Forms and .NET 8.

The application reads text aloud using speech voices installed on the
Windows computer. It also provides custom pronunciation, alternative
pronunciation, A.txt/B.txt file handling, and voice commands for
controlling paragraph playback.


2. TECHNOLOGY USED
-------------------
- Language: VB.NET
- Framework: .NET 8
- Application Type: Windows Forms
- Speech Synthesis: Windows.Media.SpeechSynthesis
- Voice Recognition: System.Speech.Recognition
- Development Environment: Visual Studio 2022


3. MAIN FEATURES
----------------
- Text-to-Speech
- Language selection
- Automatic paragraph reading
- Word selection
- Custom pronunciation
- Alternative pronunciation
- A.txt file loading
- B.txt file creation
- Voice commands
- Voice command confirmation


4. TEXT-TO-SPEECH
-----------------
The user can enter text in the text box, select an available language,
and click Speak.

The application converts the text into speech using an installed
Windows speech voice.

Text is divided into paragraphs and paragraphs are read in order.


5. LANGUAGE AND VOICE SUPPORT
-----------------------------
The application detects the speech languages available on the
Windows computer.

The user can select an available language from the language list.

The actual available languages depend on the speech voices installed
in Windows.


6. CUSTOM PRONUNCIATION
-----------------------
A word can be selected from the text and a custom pronunciation can
be entered.

The custom pronunciation is then used when that exact word occurrence
is spoken.


7. ALTERNATIVE PRONUNCIATION
----------------------------
An alternative pronunciation can also be assigned to a selected word.

If an alternative pronunciation exists, it has priority over the
normal custom pronunciation.

Pronunciation priority is:

1. Alternative pronunciation
2. Custom pronunciation
3. Original word


8. WORD IDENTIFICATION
----------------------
Each word is identified using this format:

    WordNumber-ParagraphNumber-Word

Example:

    1-1-hello

This means:
- Word number: 1
- Paragraph number: 1
- Word: hello

Another example:

    6-2-coffee

This means:
- Word number: 6
- Paragraph number: 2
- Word: coffee

This identifier allows the application to identify the exact occurrence
of a word, including when the same word appears multiple times.


9. A.txt FILE
-------------
The application can load an A.txt text file.

When the file is loaded:
- The text is displayed in the application.
- Word identifiers are generated from the text.
- The text can then be read using Text-to-Speech.


10. B.txt FILE
-------------
Selected words can be recorded as identifiers and saved into B.txt.

Example B.txt entry:

    6-2-coffee

B.txt is used to keep the identifiers of words that require special
pronunciation handling.


11. VOICE COMMANDS
------------------
The application supports these voice commands:

- Play
- Pause
- Stop
- Back
- Next

Each command uses a confirmation process before it is executed.


12. VOICE COMMAND CONFIRMATION
------------------------------
The confirmation workflow is:

    User says: "Play"
             |
             v
    Application says: "Play"
             |
             v
    User says: "Okay"
             |
             v
    Application says: "Play"
             |
             v
    Play command is executed

The same process is used for:

- Play
- Pause
- Stop
- Back
- Next

"OK" and "Okay" are both accepted as confirmation.


13. VOICE COMMAND FUNCTIONS
---------------------------
PLAY
----
Starts the current paragraph.

If playback has not started yet, the application starts reading
the text.


PAUSE
-----
Pauses the current speech playback.


STOP
----
Stops the current playback and resets the playback position to the
beginning.


BACK
----
Reads the current paragraph again from the beginning.


NEXT
----
Moves to the next paragraph and starts reading it.

If there is no next paragraph, nothing is changed.


14. TYPICAL USER WORKFLOW
-------------------------
Step 1:
Enter text manually or load an A.txt file.

Step 2:
Select the required language.

Step 3:
If a word needs special pronunciation, select the word.

Step 4:
Enter and save its custom pronunciation or alternative pronunciation.

Step 5:
If required, save the selected word identifiers to B.txt.

Step 6:
Click Speak.

Step 7:
Use Play, Pause, Stop, Back, or Next through voice commands.

Step 8:
Confirm the command by saying "OK" or "Okay".


15. EXAMPLE
-----------
Suppose the text contains:

    Hello welcome to coffee shop

If "coffee" requires a different pronunciation, select that word and
save its pronunciation.

The application identifies the exact word using its position, for
example:

    4-1-coffee

This allows the pronunciation to be associated with that exact word
occurrence.


16. IMPORTANT NOTES
-------------------
- Speech voices must be installed on the Windows computer.
- Available languages depend on the installed Windows speech voices.
- Voice recognition uses the computer's default audio input device.
- The current version uses a speech-recognition confidence threshold.
- Dedicated noise suppression/voice isolation is NOT included in this
  current version.
- The current version should be kept as the working baseline before
  adding future audio-processing improvements.


17. MAIN FORM AND CONTROLS
--------------------------
Main form:

    Frm_TextToSpeech

Important controls:

    Txt_Text
    Cmb_Language
    Btn_Speak
    Btn_SelectWord
    Lbl_SelectedWord
    Lbl_Pronunciation
    Txt_Pronunciation
    Btn_SavePronunciation
    Lbl_AlternativePronunciation
    Txt_AlternativePronunciation
    Btn_SaveAlternative
    Btn_LoadFile
    Lbl_FileName
    Btn_SaveBFile
    Lbl_BFileName


18. HOW TO RUN
--------------
1. Open the project in Visual Studio 2022.
2. Make sure the required .NET 8 Windows development components are
   installed.
3. Build the solution.
4. Run the application.
5. Make sure at least one Windows speech voice is installed.
6. Select a language.
7. Enter text or load A.txt.
8. Test Text-to-Speech.
9. Test the voice command confirmation workflow.


19. CURRENT TESTED FUNCTIONALITY
--------------------------------
The current working version has been tested for:

- Basic Text-to-Speech
- Language selection
- Paragraph reading
- Word selection
- Custom pronunciation
- Alternative pronunciation
- Exact word identification
- Repeated words at different positions
- A.txt loading
- B.txt saving
- Voice commands
- Voice command confirmation
- Play
- Pause
- Stop
- Back
- Next


20. CURRENT VERSION STATUS
--------------------------
This is the current working Task 55 implementation.

The voice-command process is:

    Command
       |
       v
    Application repeats command
       |
       v
    User says "Okay" / "OK"
       |
       v
    Application repeats command
       |
       v
    Command is executed

This version should be treated as the working baseline for client
review.

Any future features or improvements, such as noise suppression or
voice isolation, should be added separately after the current version
has been reviewed.


21. PURPOSE OF THIS README
--------------------------
This README is written so that a client, developer, tester, or other
person can understand the purpose, features, workflow, and current
status of Task 55 without first reading the source code.
