Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
sound files
Collapse
X
-
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
-
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
-
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.JesseNinjaTrader Customer Service
Comment
-
Originally posted by FCatan View Postyes, 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.
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
-
Originally posted by arbuthnot View PostHave 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.
Thank you.
Comment
-
Originally posted by emuns View PostIt 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.
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:
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:
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
-
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"); } }
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.Last edited by NinjaTrader_Jesse; 08-26-2015, 08:55 AM.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Padan, Today, 02:02 AM
|
8 responses
21 views
0 likes
|
Last Post
by Padan
Today, 03:23 PM
|
||
Started by nandhumca, Today, 03:15 PM
|
1 response
2 views
0 likes
|
Last Post Today, 03:23 PM | ||
Started by PopovDS, 03-11-2024, 12:49 PM
|
3 responses
17 views
0 likes
|
Last Post
by PopovDS
Today, 03:16 PM
|
||
Started by Lele2k24, Yesterday, 11:24 AM
|
12 responses
37 views
0 likes
|
Last Post Today, 03:07 PM | ||
Started by RaygunWizzle, Yesterday, 08:52 PM
|
3 responses
11 views
0 likes
|
Last Post Today, 02:50 PM |
Comment