Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Making NT8 Speak

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Making NT8 Speak

    Hi,

    I added the System.Speech.dll from the "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\ " directory, but I cant get "using Microsoft.Speech" to show in intellisense, is there a way to make this work?

    Thanks in advance.

    #2
    Originally posted by KhaosTrader View Post
    Hi,

    I added the System.Speech.dll from the "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\ " directory, but I cant get "using Microsoft.Speech" to show in intellisense, is there a way to make this work?

    Thanks in advance.
    That is System.Speech, not Microsoft.Speech.

    Comment


      #3
      Hi koganam,

      system speech is in the example... it just doesn't seem to work in ninjascript, the reference..




      Code:
      using System; 
      using System.Collections.Generic; 
      using System.ComponentModel; 
      using System.Data; 
      using System.Drawing; 
      using System.Linq; 
      using System.Text; 
      using System.Windows.Forms; 
      using System.Speech.Synthesis; 
      using System.IO; 
       
      namespace text_to_speech 
      { 
          public partial class Form1 : Form 
          { 
              SpeechSynthesizer reader; //declare the object 
              public Form1() 
              { 
                  InitializeComponent(); 
       
              } 
              private void Form1_Load(object sender, EventArgs e) 
              { 
                  reader = new SpeechSynthesizer(); //create new object 
                  button2.Enabled = false; 
                  button3.Enabled = false; 
                  button4.Enabled = false; 
                  textBox1.ScrollBars = ScrollBars.Both; 
              } 
       
              //SPEAK TEXT 
              private void button1_Click(object sender, EventArgs e) 
              { 
                  reader.Dispose(); 
                  if (textBox1.Text != "")    //if text area is not empty 
                  { 
       
                      reader = new SpeechSynthesizer(); 
                      reader.SpeakAsync(textBox1.Text); 
                      label2.Text = "SPEAKING"; 
                      button2.Enabled = true; 
                      button4.Enabled = true; 
                      reader.SpeakCompleted += new EventHandler<SpeakCompletedEventArgs>(reader_SpeakCompleted); 
                  } 
                  else 
                  { 
                      MessageBox.Show("Please enter some text in the textbox", "Message", MessageBoxButtons.OK); 
                  } 
              } 
       
              //event handler 
              void reader_SpeakCompleted(object sender, SpeakCompletedEventArgs e) 
              { 
                  label2.Text = "IDLE"; 
              } 
       
              //PAUSE 
              private void button2_Click(object sender, EventArgs e) 
              { 
                  if (reader != null) 
                  { 
                      if (reader.State == SynthesizerState.Speaking) 
                      { 
                          reader.Pause(); 
                          label2.Text = "PAUSED"; 
                          button3.Enabled = true; 
       
                      } 
                  } 
              } 
       
              //RESUME 
              private void button3_Click(object sender, EventArgs e) 
              { 
                  if (reader != null) 
                  { 
                      if (reader.State == SynthesizerState.Paused) 
                      { 
                          reader.Resume(); 
                          label2.Text = "SPEAKING"; 
                      } 
                      button3.Enabled = false; 
                  } 
              } 
       
              //STOP 
              private void button4_Click(object sender, EventArgs e) 
              { 
                  if (reader != null) 
                  { 
                      reader.Dispose(); 
                      label2.Text = "IDLE"; 
                      button2.Enabled = false; 
                      button3.Enabled = false; 
                      button4.Enabled = false; 
                  } 
              } 
       
              //load data from text file button 
              private void button5_Click(object sender, EventArgs e) 
              { 
                  openFileDialog1.ShowDialog(); 
              } 
       
              private void openFileDialog1_FileOk(object sender, CancelEventArgs e) 
              { 
                  //copy data from text file and load it to textbox 
                  textBox1.Text =  File.ReadAllText(openFileDialog1.FileName.ToString()); 
       
              } 
       
           } 
      }
      Last edited by KhaosTrader; 06-20-2016, 11:37 PM.

      Comment


        #4
        Hello KhaosTrader,

        Thank you for your post.

        Is it only that Intelliprompt is not showing details or are you receiving errors?

        Comment


          #5
          Originally posted by KhaosTrader View Post
          Hi koganam,

          system speech is in the example... it just doesn't seem to work in ninjascript, the reference..




          Code:
          using System; 
          using System.Collections.Generic; 
          using System.ComponentModel; 
          using System.Data; 
          using System.Drawing; 
          using System.Linq; 
          using System.Text; 
          using System.Windows.Forms; 
          using System.Speech.Synthesis; 
          using System.IO; 
           
          namespace text_to_speech 
          { 
              public partial class Form1 : Form 
              { 
                  SpeechSynthesizer reader; //declare the object 
                  public Form1() 
                  { 
                      InitializeComponent(); 
           
                  } 
                  private void Form1_Load(object sender, EventArgs e) 
                  { 
                      reader = new SpeechSynthesizer(); //create new object 
                      button2.Enabled = false; 
                      button3.Enabled = false; 
                      button4.Enabled = false; 
                      textBox1.ScrollBars = ScrollBars.Both; 
                  } 
           
                  //SPEAK TEXT 
                  private void button1_Click(object sender, EventArgs e) 
                  { 
                      reader.Dispose(); 
                      if (textBox1.Text != "")    //if text area is not empty 
                      { 
           
                          reader = new SpeechSynthesizer(); 
                          reader.SpeakAsync(textBox1.Text); 
                          label2.Text = "SPEAKING"; 
                          button2.Enabled = true; 
                          button4.Enabled = true; 
                          reader.SpeakCompleted += new EventHandler<SpeakCompletedEventArgs>(reader_SpeakCompleted); 
                      } 
                      else 
                      { 
                          MessageBox.Show("Please enter some text in the textbox", "Message", MessageBoxButtons.OK); 
                      } 
                  } 
           
                  //event handler 
                  void reader_SpeakCompleted(object sender, SpeakCompletedEventArgs e) 
                  { 
                      label2.Text = "IDLE"; 
                  } 
           
                  //PAUSE 
                  private void button2_Click(object sender, EventArgs e) 
                  { 
                      if (reader != null) 
                      { 
                          if (reader.State == SynthesizerState.Speaking) 
                          { 
                              reader.Pause(); 
                              label2.Text = "PAUSED"; 
                              button3.Enabled = true; 
           
                          } 
                      } 
                  } 
           
                  //RESUME 
                  private void button3_Click(object sender, EventArgs e) 
                  { 
                      if (reader != null) 
                      { 
                          if (reader.State == SynthesizerState.Paused) 
                          { 
                              reader.Resume(); 
                              label2.Text = "SPEAKING"; 
                          } 
                          button3.Enabled = false; 
                      } 
                  } 
           
                  //STOP 
                  private void button4_Click(object sender, EventArgs e) 
                  { 
                      if (reader != null) 
                      { 
                          reader.Dispose(); 
                          label2.Text = "IDLE"; 
                          button2.Enabled = false; 
                          button3.Enabled = false; 
                          button4.Enabled = false; 
                      } 
                  } 
           
                  //load data from text file button 
                  private void button5_Click(object sender, EventArgs e) 
                  { 
                      openFileDialog1.ShowDialog(); 
                  } 
           
                  private void openFileDialog1_FileOk(object sender, CancelEventArgs e) 
                  { 
                      //copy data from text file and load it to textbox 
                      textBox1.Text =  File.ReadAllText(openFileDialog1.FileName.ToString()); 
           
                  } 
           
               } 
          }
          NT8 is WPF, not WinForms. You will need an interop host control to host a windows Forms control in WPF.

          Comment


            #6
            I couldnt get intellisense to work, so i didnt even try to compile... What must I do to allow access to the speech api?

            Comment


              #7
              I have created a video to demonstrate adding System.Speech into your NinjaScript library and allowing for Intelliprompt to recognize it. You can view this video at the following link: http://screencast.com/t/cRspGpB9Wiak

              Comment


                #8
                Thanks for the video, I didn't realize i had to copy the file there.

                Comment


                  #9
                  Originally posted by KhaosTrader View Post
                  Thanks for the video, I didn't realize i had to copy the file there.
                  You do not have to copy a system file to anywhere. You simply need to point the reference to the correct file, in its actual location.

                  That copying procedure is fine only if you will never export your indicator to another system, because that other system will have the file only where it is supposed to be, not where you copied it to on the development system.

                  Comment


                    #10
                    Issue for playing sound when chart behind a tab..

                    Hi,

                    It seems that the sound file wont play when the chart is behind a tab, that is if I have 2 charts with two tabs, only the chart that is visible will play the text to speech (TTS).. If i click on the chart that is behind a tab and it becomes visible, then the TTS will play for that chart..so if its behind a tab and not visible then TTS for that chat wont play

                    How can I make it so the TTS will play even if the chart is not showing, because I dont have the given chart's tab selected so that chart is visible?

                    Thank you in advance.
                    Last edited by KhaosTrader; 07-18-2016, 08:19 PM.

                    Comment


                      #11
                      Originally posted by KhaosTrader View Post
                      Hi,

                      It seems that the sound file wont play when the chart is behind a tab, that is if I have 2 charts with two tabs, only the chart that is visible will play the text to speech (TTS).. If i click on the chart that is behind a tab and it becomes visible, then the TTS will play for that chart..so if its behind a tab and not visible then TTS for that chat wont play

                      How can I make it so the TTS will play even if the chart is not showing, because I dont have the given chart's tab selected so that chart is visible?

                      Thank you in advance.
                      Code:
                      IsSuspendedWhileInactive			= false;
                      From the Free Manual:

                      ref: http://ninjatrader.com/support/helpG...leinactive.htm

                      Comment


                        #12
                        the video http://screencast.com/t/cRspGpB9Wiak is not accessible, what is the correct link please?

                        Comment


                          #13
                          Hello KhaosTrader,

                          Thank you for your response.

                          The video would no longer be available. Are you unable to add the refer in NinjaScript by right clicking and selecting the file?

                          Comment


                            #14
                            No I just forgot where I whould put the speech.dll, but I figured it out.... Thanks

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by sidlercom80, 10-28-2023, 08:49 AM
                            171 responses
                            2,276 views
                            0 likes
                            Last Post QuantKey_Bruce  
                            Started by Irukandji, Yesterday, 02:53 AM
                            2 responses
                            17 views
                            0 likes
                            Last Post Irukandji  
                            Started by adeelshahzad, Today, 03:54 AM
                            0 responses
                            3 views
                            0 likes
                            Last Post adeelshahzad  
                            Started by CortexZenUSA, Today, 12:53 AM
                            0 responses
                            3 views
                            0 likes
                            Last Post CortexZenUSA  
                            Started by CortexZenUSA, Today, 12:46 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post CortexZenUSA  
                            Working...
                            X