public void textToSpeech(string gender, string text, bool goodNews)
    {
        //StopAllCoroutines();
        LogSystem.InstallDefaultReactors();

        if (goodNews)
        {
            Runnable.Run(Examples(gender, expressAsGoodNews(text)));
        }
        else
        {
            Runnable.Run(Examples(gender, neutral(text)));
        }
    }
    protected override void Start()
    {
        base.Start();

        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        _speechToText = new SpeechToText(credentials);
        Active        = true;

        StartRecording();
    }
Beispiel #3
0
        /// <exclude />
        protected override void Start()
        {
            base.Start();
            LogSystem.InstallDefaultReactors();

            if (m_StatusText != null)
            {
                m_StatusText.text = "READY";
            }
            if (!m_STT.GetModels(OnGetModels))
            {
                Log.Error("SpeechToTextWidget", "Failed to rquest models.");
            }
        }
Beispiel #4
0
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        _personalityInsights             = new PersonalityInsights(credentials);
        _personalityInsights.VersionDate = _versionDate;

        _dataPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/personalityInsights.json";

        Runnable.Run(Examples());
    }
Beispiel #5
0
        private void Start()
        {
            // Enable TLS 1.2
            //ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

            // Disable old protocols
            //ServicePointManager.SecurityProtocol &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11);

            counter = 0;
            LogSystem.InstallDefaultReactors();
            Runnable.Run(CreateService());
            processStatus = "Idle";
            source        = gameObject.GetComponent <AudioSource>();
        }
Beispiel #6
0
    protected override void Start()
    {
        base.Start();

        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        _conversation             = new Conversation(credentials);
        _conversation.VersionDate = _conversationVersionDate;

        //Runnable.Run(Examples());
    }
Beispiel #7
0
    void Start()
    {
        playerRef = GameObject.FindGameObjectWithTag("Player");

        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        _speechToText = new SpeechToText(credentials);
        Active        = true;

        StartRecording();
    }
    /// <summary>
    /// Awake this instance.
    ///   use Awake to copy values to the Watson data structure
    /// </summary>
    void Awake()
    {
        // Watson logging initialization
        LogSystem.InstallDefaultReactors();

        print("Speech2Text user: "******"Speech2Text  pwd: " + stt_credentialSO.Password);
        print("Speech2Text  url: " + stt_credentialSO.URL);

        credentials_STT = new Credentials(
            stt_credentialSO.Username,
            stt_credentialSO.Password,
            stt_credentialSO.URL);
    }
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        convo = new convoScript();

        _speechToText = new SpeechToText(credentials);
        Active        = true;

        StartRecording();
    }
Beispiel #10
0
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        _dataController = FindObjectOfType <DataController> ();
        _voiceProcessor = FindObjectOfType <VoiceProcessor> ();

        CredentialData    serviceCredentials     = _dataController.GetServiceCredentials();
        ServiceCredential textToSpeechCredential = serviceCredentials.textToSpeechCredential;

        Credentials credentials = new Credentials(textToSpeechCredential.username, textToSpeechCredential.password, textToSpeechCredential.url);

        _textToSpeech = new TextToSpeech(credentials);
    }
Beispiel #11
0
    private void Start()
    {
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        _discovery             = new Discovery(credentials);
        _discovery.VersionDate = _versionDate;
        _filePathToIngest      = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/watson_beats_jeopardy.html";
        _documentFilePath      = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/watson_beats_jeopardy.html";

        Runnable.Run(Examples());
    }
Beispiel #12
0
    private string _translationModel_en_ja = "en-ja";     // japanese


    // All the language options here https://console.bluemix.net/docs/services/language-translator/translation-models.html
    // Use this for initialization
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        Credentials languageTranslatorCredentials = new Credentials()
        {
            Username = "******",
            Password = "******",
            Url      = "https://gateway.watsonplatform.net/language-translator/api"
        };

        _languageTranslator = new LanguageTranslator(languageTranslatorCredentials);

        //Translate("Where is the library?");
    }
Beispiel #13
0
        void Start()
        {
            LogSystem.InstallDefaultReactors();

            if (string.IsNullOrEmpty(iamApikey))
            {
                throw new IBMException("Please set the Speech to Text iamApikey in the inspector.");
            }
            if (languageTranslatorSample == null)
            {
                throw new IBMException("Please set the languageTranslatorSample in the inspector.");
            }

            Runnable.Run(CreateService());
        }
Beispiel #14
0
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials stt_credentials   = new Credentials(stt_username, stt_password, stt_url);
        Credentials convo_credentials = new Credentials(convo_username, convo_password, convo_url);

        _speechToText             = new SpeechToText(stt_credentials);
        _conversation             = new Conversation(convo_credentials);
        _conversation.VersionDate = _conversationVersionDate;
        Active = true;

        StartRecording();
    }
Beispiel #15
0
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        string[] returnFields = { Fields.ENRICHED_URL_ENTITIES, Fields.ENRICHED_URL_KEYWORDS };
        Dictionary <string, string> queryFields = new Dictionary <string, string>();

        queryFields.Add(Fields.ENRICHED_URL_RELATIONS_RELATION_SUBJECT_TEXT, "Obama");
        queryFields.Add(Fields.ENRICHED_URL_CLEANEDTITLE, "Washington");

        if (!m_AlchemyAPI.GetNews(OnGetNews, returnFields, queryFields))
        {
            Log.Debug("ExampleAlchemyData", "Failed to get news!");
        }
    }
    void Start()
    {
        //Create the credentials to pass to the speech to text service
        Credentials credentials = new Credentials(_username, _password, _url);

        //Instantiate a new SpeechToText object
        m_SpeechToText = new SpeechToText(credentials);


        LogSystem.InstallDefaultReactors();
        Log.Debug("ExampleStreaming", "Start();");

        Active = false;
        //StartRecording();
    }
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        _speechToText         = new SpeechToText(credentials);
        _customCorpusFilePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/test-stt-corpus.txt";
        _customWordsFilePath  = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/test-stt-words.json";
        _wavFilePath          = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/test-audio.wav";
        _audioClip            = WaveFile.ParseWAV("testClip", File.ReadAllBytes(_wavFilePath));

        Runnable.Run(Examples());
    }
    // Use this for initialization
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        Credentials languageTranslatorCredentials = new Credentials()
        {
            Username = "******",
            Password = "******",
            Url      = "https://gateway.watsonplatform.net/language-translator/api"
        };

        _languageTranslator = new LanguageTranslator(languageTranslatorCredentials);

        Translate(translateString);
    }
Beispiel #19
0
    private void Start()
    {
        //getFileNames();
        //spawner spawner1 = new spawner();



        //var spawnableItemsList = new string[] { "bed", "table", "ball", "bottle", "carpet" };
        //foreach (string item in spawnableItemsList)
        //{
        //    spawnableItems.Add(item);

        //}



        // Enable TLS 1.2
        //ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

        // Disable old protocols
        //ServicePointManager.SecurityProtocol &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11);

        LogSystem.InstallDefaultReactors();
        Runnable.Run(CreateService());
        chatStatus = ProcessingStatus.Idle;

        // Since coroutines can't return values I use the onValueChanged listener
        // to trigger an action after waiting for an input to arrive.
        // I originally used enums or flags to keep track if a process such
        // as obtaining a chat response from IBM Assistant was still being processed
        // or was finished processing but this was cumbersome.

        if (externalInputField != null)
        {
            if (externalTriggerType == InputFieldTrigger.onEndEdit)
            {
                externalInputField.onEndEdit.AddListener(delegate { Runnable.Run(ProcessChat(externalInputField.text)); });
            }
            else
            {
                externalInputField.onValueChanged.AddListener(delegate { Runnable.Run(ProcessChat(externalInputField.text)); });
            }
        }

        inputField = gameObject.AddComponent <InputField>();
        inputField.textComponent = gameObject.AddComponent <Text>();
        inputField.onValueChanged.AddListener(delegate { Runnable.Run(ProcessChat(inputField.text)); });
    }
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        dataPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/personalityInsights.json";

        if (!m_personalityInsights.GetProfile(OnGetProfileJson, dataPath, ContentType.TEXT_HTML, ContentLanguage.ENGLISH, ContentType.APPLICATION_JSON, AcceptLanguage.ENGLISH, true, true, true))
        {
            Log.Debug("ExamplePersonalityInsights", "Failed to get profile!");
        }

        if (!m_personalityInsights.GetProfile(OnGetProfileText, testString, ContentType.TEXT_HTML, ContentLanguage.ENGLISH, ContentType.APPLICATION_JSON, AcceptLanguage.ENGLISH, true, true, true))
        {
            Log.Debug("ExamplePersonalityInsights", "Failed to get profile!");
        }
    }
Beispiel #21
0
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        Credentials languageTranslatorCredential = new Credentials()
        {
            Username = "******",
            Password = "******",
            Url      = "https://gateway.watsonplatform.net/language-translator/api"
        };

        _languageTranslator = new LanguageTranslator(languageTranslatorCredential);

        _dropDownCallback = DropDown.GetComponent <DropDownCallback>();
        SetEvent();
    }
Beispiel #22
0
    /// <summary>
    /// Awake this instance.
    ///   use Awake to copy values to the Watson data structure
    /// </summary>
    void Awake()
    {
        // Watson logging initialization
        LogSystem.InstallDefaultReactors();

        print("ToneAnalysis user: "******"ToneAnalysis  pwd: " + ta_credentialSO.Password);
        print("ToneAnalysis  url: " + ta_credentialSO.URL);

        credentials_TONE = new Credentials(
            ta_credentialSO.Username,
            ta_credentialSO.Password,
            ta_credentialSO.URL);

        textToAnalyze.OnChanged += AnalyzeText;
    }
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials_STT = new Credentials(_username_STT, _password_STT, _url_STT);
        Credentials credentials_TTS = new Credentials(_username_TTS, _password_TTS, _url_TTS);

        _speechToText = new SpeechToText(credentials_STT);
        _textToSpeech = new TextToSpeech(credentials_TTS);

        Active = true;
        StartRecording();

        Runnable.Run(Examples());
    }
Beispiel #24
0
    void Start()
    {
        LogSystem.InstallDefaultReactors();
        if (!Utility.GetToken(OnGetTokenSST, sttUrl, sttUsername, sttPassword))
        {
            Log.Debug("ExampleGetToken.Start()", "Failed to get token.");
        }

        if (!Utility.GetToken(OnGetTokenTTS, ttsUrl, ttsUsername, ttsPassword))
        {
            Log.Debug("ExampleGetToken.Start()", "Failed to get token.");
        }

        if (!Utility.GetToken(OnGetTokenNLU, nluUrl, nluUsername, nluPassword))
        {
            Log.Debug("ExampleGetToken.Start()", "Failed to get token.");
        }

        //STT
        Credentials credentials = new Credentials(sttUsername, sttPassword, sttUrl)
        {
            AuthenticationToken = _authenticationTokenSST
        };

        _speechToText = new SpeechToText(credentials);
        Active        = true;
        StartRecording();

        //TTS
        Credentials ttscredentials = new Credentials(ttsUsername, ttsPassword, ttsUrl)
        {
            AuthenticationToken = _authenticationTokenTTS
        };

        _textToSpeech = new TextToSpeech(ttscredentials);

        //NLU
        Credentials nlucredentials = new Credentials(nluUsername, nluPassword, nluUrl)
        {
            AuthenticationToken = _authenticationTokenNLU
        };

        _naturalLanguageUnderstanding = new NaturalLanguageUnderstanding(nlucredentials);

        //Canvas
        menu.SetActive(false);
    }
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        _speechToText             = new SpeechToText(credentials);
        _customCorpusFilePath     = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/theJabberwocky-utf8.txt";
        _customWordsFilePath      = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/test-stt-words.json";
        _acousticResourceMimeType = Utility.GetMimeType(Path.GetExtension(_acousticResourceUrl));
        _oggResourceMimeType      = Utility.GetMimeType(Path.GetExtension(_oggResourceUrl));

        _speechToText.StreamMultipart = true;

        Runnable.Run(Examples());
    }
Beispiel #26
0
    private void OnEnable()
    {
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        _textToSpeech = new TextToSpeech(credentials);
        audioObject   = new GameObject("AudioObject");
        source        = audioObject.AddComponent <AudioSource>();
        if (RestfulMainScript.isNlpComplete)
        {
            Debug.Log("TTS enabled: " + RestfulMainScript.nlpAnswer);
            RunnableTTS.Run(Examples(RestfulMainScript.nlpAnswer));
            RestfulMainScript.isNlpComplete = false;
        }
    }
Beispiel #27
0
    void Start()
    {
        LogSystem.InstallDefaultReactors();
        m_WorkspaceID = Config.Instance.GetVariableValue("ConversationV1_ID");
        Debug.Log("User: " + m_Input);

        //  Message with input only
        //m_Conversation.Message(OnMessage, m_WorkspaceID, m_Input);

        //  Message by creating message request
        //MessageRequest messageRequest = new MessageRequest();
        //messageRequest.inputText = m_Input;
        //m_Conversation.Message(OnMessage, m_WorkspaceID, messageRequest);

        //  Message by passing input, alternate intents and conversationID
        m_Conversation.Message(OnMessage, m_WorkspaceID, m_Input, false, null);
    }
    void Start()
    {
        /// TTS TEST ON START
        LogSystem.InstallDefaultReactors();
        //  Create credential and instantiate service

        Credentials credentials_TTS = new Credentials(_username_TTS, _password_TTS, _url_TTS);

        _textToSpeech = new TextToSpeech(credentials_TTS);

        _testString = "<speak version=\"1.0\"><express-as type=\"GoodNews\">Hi! I'm MacKenzie! A Unity demo for the IBM Watson Software Development Kit </express-as></speak>";
        Runnable.Run(Examples());

        /// STT BEGIN
        Credentials credentials_STT = new Credentials(_username_STT, _password_STT, _url_STT);

        _speechToText = new SpeechToText(credentials_STT);
        Active        = true;

        StartRecording();

        Agent_Status.text = "Listening";
        System_Mode.text  = "mode: listen-learn";

        voicebox_prosody_pitch   = 200; // 150 hZ to 350 hz
        voicebox_pitch_range     = 0;   // -100% to 100%
        voicebox_glottal_tension = 25;  // -100% to 100%
        voicebox_breathiness     = 50;  // -100% to 100%
        voicebox_rate            = 0;   // -100% to 100%
        voicebox_timbre_extent   = 50;  // -0% to 100%
        //voicebox_timbre  // "Sunrise" or "Breeze"



        //// Check if LOG file exists (later, we dont need to do this all the time, but here for now.  OPTIMIZE LATER
        string path = @"MacKenzie_Conversation_Log.txt";

        if (!File.Exists(path))
        {
            // Create a file to write to if the file does not exist
            using (StreamWriter sw = File.CreateText(path)) {
                sw.WriteLine(string.Concat("timestamp,", "mode,", "transcript"));
                sw.WriteLine(string.Concat(System.DateTime.Now.ToLongTimeString(), "-", System.DateTime.Now.ToString("MM/dd/yyyy"), ",log_initialized,", "MacKenzie_Conversation_Log Initialized"));
            }
        }
    }
Beispiel #29
0
    void Start()
    {
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials()
        {
            Url      = "https://stream.watsonplatform.net/speech-to-text/api",
            Username = "******",
            Password = "******"
        };

        _speechToText = new SpeechToText(credentials);
        Active        = true;

        StartRecording();
    }
Beispiel #30
0
    /////////////////////////////////////////////////////////////////////////////////////


    void Start()
    {
        _targetBuffer = new List <string>(16);
        _wordBuffer   = new List <string>(32);
        LogSystem.InstallDefaultReactors();

        //  Create credential and instantiate service
        Credentials credentials = new Credentials(_username, _password, _url);

        _speechToText = new SpeechToText(credentials);
        Active        = true;

        _textPtr = Random.Range(0, TargetTextList.Length);
        _pickNewText();

//        StartRecording();
    }