Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

sound files

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

    sound files

    is there a way to concatenate to wav files to play as one sound with PlaySound()

    #2
    Hello FCatan,

    Are you trying to play multiple sounds at the same time? If so, this will need to be done in separate PlaySound() calls.

    Are you trying to concatenate a string that provides the location of one sound file? Yes, you can do this just like any other string.

    @"C:\Program Files(x86)\"+ folderVariable + "\sounds\mySound.Wav"
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      yes, I'm trying to play multiple sounds at the same time. the first sound file identifies the instrument and the second the condition. So, for example, the first sound file will say "ES" and the second "MA Crossover". Effectively, I want is to sound like "ES MA Crossover". To do that I have 2 PlaySound() calls back to back, but they are executed so fast that only the second one is heard.

      Comment


        #4
        Hello,

        Thank you for the reply.

        What is happening is the way NinjaTrader plays sounds, only 1 sound can be played at once although the method that calls the sound can be called over and over again.

        When you submit multiple PlaySound() methods the last sound submitted would be heard if they are all happening at the same time.

        To hear these separately, there has to be a delay between the calls to PlaySound(). This can be accomplished using various logic such as a bool variable that gets toggled and the next OnBarUpdate the next PlaySound can happen and so on. This is really the only want to get sounds to play in succession from a single call to OnBarUpdate.

        Otherwise you would need to use a third party software for audio editing to combine the multiple sounds into one wav file that can be called on one time in NinjaTrader. I don't have any specific recommendations on software for this, but I am sure google would be a good resource on finding something that can do this.

        I look forward to being of further assistance.

        Comment


          #5
          Originally posted by FCatan View Post
          yes, I'm trying to play multiple sounds at the same time. the first sound file identifies the instrument and the second the condition. So, for example, the first sound file will say "ES" and the second "MA Crossover". Effectively, I want is to sound like "ES MA Crossover". To do that I have 2 PlaySound() calls back to back, but they are executed so fast that only the second one is heard.
          Have you thought about recording a separate alert message for each possibility?

          There are a few 'text-to-speech' sites out there that will allow you to type in the words you want and out comes the speech. They can be downloaded as wav files (compatible with Ninja). Go here:



          Type in "E.S. M.A. Crossover", select the voice you want and if you're happy, download it.

          Comment


            #6
            Originally posted by arbuthnot View Post
            Have you thought about recording a separate alert message for each possibility?

            There are a few 'text-to-speech' sites out there that will allow you to type in the words you want and out comes the speech. They can be downloaded as wav files (compatible with Ninja). Go here:



            Type in "E.S. M.A. Crossover", select the voice you want and if you're happy, download it.
            It seems that the AT&T text-to-speech program (http://www2.research.att.com/~ttsweb/tts/demo.php) already doesn´t work. Do you know some another similar program for free?
            Thank you.

            Comment


              #7
              Originally posted by emuns View Post
              It seems that the AT&T text-to-speech program (http://www2.research.att.com/~ttsweb/tts/demo.php) already doesn´t work. Do you know some another similar program for free?
              Thank you.
              Yup - I'd noticed that AT&T site had disappeared!

              But, using a two-stage process, you can get text to speech (free) that works a treat. I've used it and the sound alerts work fine in NT7.

              Firstly, go here:

              For over a decade, FromTextToSpeech.com offered one of the most popular free text to speech tools online. Millions used our basic service for everything from homework and eLearning to presentations and accessibility. But as AI voices grew more sophisticated and the TTS industry matured, we began to fall behind. Rather than compete with modern platforms


              Experiment with

              - Select language

              - Select voice (I've found the 'Heather' voice is very clear)

              - Select speed

              You end up downloading MP3s.

              You need to convert these to WAV format, and this can be done, again free, here:

              Convert your audio to the WAV format with this free online WAV converter. You can optionally extract audio tracks from video and convert them to WAV.


              This certainly works. Sometimes the sites can take a few moments (or more) to do the 'recording'.
              Last edited by arbuthnot; 08-26-2015, 06:56 AM.

              Comment


                #8
                Hello,

                A simple way to speak using NinjaScript would be to use the System.Speech namespace with C#.



                You would need to add a reference to the following file, this should be available on any PC with .net.

                C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.Speech. dll

                Next you would need to add the using statement to your script:

                using System.Speech.Synthesis;

                Finally a simple test:
                Code:
                private SpeechSynthesizer synth;
                
                protected override void OnStartUp()
                {
                	synth = new SpeechSynthesizer();
                	synth.SetOutputToDefaultAudioDevice();
                }
                protected override void OnBarUpdate()
                {
                	if(!Historical && Close[0] > Open[0])
                	{
                		synth.Speak(Instrument.FullName + " Close is greater than open");
                	}
                }
                I have included an export and the speech assembly in case anyone is unable to find it on their system.

                One note with this method, this does take priority so a long message happening over and over would "lock" the UI thread, so this would not work good for alerts that happen frequently. For alerts that happen frequently I would suggest the wav files as described by the other members.

                I look forward to being of further assistance.
                Attached Files
                Last edited by NinjaTrader_Jesse; 08-26-2015, 08:55 AM.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                597 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                343 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                556 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                555 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X