# AnythingSpeech

## AnythingSpeech Class Reference

### Public Member Functions

> `delegate void` <mark style="color:blue;">AWSpeechHandler</mark> (string testResponse)
>
> `delegate void` <mark style="color:blue;">AWSpeechDoneHandler</mark> (string testResponse)
>
> `void`` `<mark style="color:blue;">`StartListening`</mark>` ``(`<mark style="color:blue;">`AWSpeechHandler`</mark>` ``responseCallback,`` `<mark style="color:blue;">`AWSpeechDoneHandler`</mark>` ``doneCallback)`
>
> `void`` `<mark style="color:blue;">`StartListening`</mark>` ``(`<mark style="color:blue;">`AWSpeechDoneHandler`</mark>` ``doneCallback)`
>
> `void`` `<mark style="color:blue;">`StopListening`</mark>` ``()`
>
> `void`` `<mark style="color:blue;">`Speak`</mark>` ``(string thingToSay, string voiceName="none")`
>
> `void`` `<mark style="color:blue;">`ListenForInterval`</mark>` ``(float time,`` `<mark style="color:blue;">`AWSpeechDoneHandler`</mark>` ``doneCallBack)`
>
> `void`` `<mark style="color:blue;">`ListenForInterval`</mark>` ``(float time,`` `<mark style="color:blue;">`AWSpeechHandler`</mark>` ``responseCallBack, AWSpeechDoneHandler doneCallBack)`

### Member Functions

#### <mark style="color:purple;">AWSpeechDoneHandler()</mark>

delegate void AnythingWorld.Speech.AnythingSpeech.AWSpeechDoneHandler (string <mark style="color:blue;">testResponse</mark>)

#### <mark style="color:purple;">AWSpeechHandler()</mark>

delegate void AnythingWorld.Speech.AnythingSpeech.AWSpeechHandler (string <mark style="color:blue;">testResponse</mark>)

#### <mark style="color:purple;">**ListenForInterval()**</mark>

void AnythingWorld.Speech.AnythingSpeech.ListenForInterval (float <mark style="color:blue;">time</mark>, <mark style="color:blue;">AWSpeechDoneHandler doneCallBack</mark>)

{% hint style="info" %}
**Listen for a specified amount of time and receive a string to a callback.**
{% endhint %}

#### <mark style="color:purple;">ListenForInterval()</mark>

void AnythingWorld.Speech.AnythingSpeech.ListenForInterval (float <mark style="color:blue;">time</mark>, <mark style="color:blue;">AWSpeechHandler responseCallBack</mark>, <mark style="color:blue;">AWSpeechDoneHandler doneCallBack</mark>)

#### <mark style="color:purple;">Speak()</mark>

void AnythingWorld.Speech.AnythingSpeech.Speak (string <mark style="color:blue;">thingToSay</mark>, string <mark style="color:blue;">voiceName =</mark> "none")

{% hint style="info" %}
**Use speech synthesis to say input string**.
{% endhint %}

#### <mark style="color:purple;">StartListening()</mark>

void AnythingWorld.Speech.AnythingSpeech.StartListening (<mark style="color:blue;">AWSpeechDoneHandler doneCallback</mark>)

#### <mark style="color:purple;">StartListening()</mark>

void AnythingWorld.Speech.AnythingSpeech.StartListening (<mark style="color:blue;">AWSpeechHandler responseCallback</mark>, <mark style="color:blue;">AWSpeechDoneHandler doneCallback</mark>)

{% hint style="info" %}
**Activates voice input and starts listening to the user.**
{% endhint %}

#### <mark style="color:purple;">StopListening()</mark>

void AnythingWorld.Speech.AnythingSpeech.StopListening()

{% hint style="info" %}
**Deactivate voice input and stop listening.**
{% endhint %}

### Property

#### <mark style="color:purple;">Instance</mark>

<mark style="color:blue;">AnythingSpeech</mark> AnythingWorld.Speech.AnythingSpeech.Instance

### Parameters

| Parameters                                          | Definition                                                                   |
| --------------------------------------------------- | ---------------------------------------------------------------------------- |
| <mark style="color:blue;">`time`</mark>             | Time in seconds to listen.                                                   |
| <mark style="color:blue;">`responseCallBack`</mark> | Callback handling any detected changes to the input string during listening. |
| <mark style="color:blue;">`doneCallBack`</mark>     | Callback handling the final detected string once listening completed         |
| <mark style="color:blue;">`thingToSay`</mark>       | String to vocalise                                                           |
| <mark style="color:blue;">`voiceName`</mark>        | Name of voice                                                                |

### Example

```csharp
using AnythingWorld.Speech;

public class SpeechController: MonoBehaviour
{  
    void Start()
    {
        AnythingSpeech speech = AnythingSpeech.Instance;
        speech.Speak("Hello Anything World");
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://anything-world.gitbook.io/anything-world/unity-1/legacy-package-api-references/api-references/anythingspeech.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
