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!
See more
See less

Partner 728x90

Collapse

PlaySound not working

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

    PlaySound not working

    I use a very simple indicator

    protectedoverridevoid OnBarUpdate()
    {
    Plot0.Set(Close[0]);


    PlaySound(@"C:\win.wav");
    }

    It plots, but it doesn't play the sound. The sound works fine in Windows Media Player. I have no idea what I'm going wrong.

    This is in Ninja 7.

    Are there any general settings that I need to turn on? Any help gratefully accepted.


    #2
    Hi bubblegum,

    Are there any error messages noted in log tab of control center?

    Are you trying this with real time updates coming in? It does not work on historical bars.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Aha! Thank you. The log says

      Sound API only supports playing PCM wave files.

      What does that mean?

      I'm doing this in real-time.

      Comment


        #4
        PCM is a type of audio format. Unfortunately your sound file is not supported. For background on this, this page breaks down different ways wav files can be formatted.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          OK, thank you.

          I downloaded PCM files from Wikipedia and they work.

          The files I was trying to play are standard Windows sound files. It's strange that you don't support these.

          Comment


            #6
            Hello, can anyone help me? I have a problem with the PlaySound(). I just download a PCM from wikipedia or in this link http://en.wikipedia.org/wiki/WAV and put it in my C:\ drive but it will not work. It will only print on the output if my trigger is hit. There is no error on the log tab.

            Comment


              #7
              Originally posted by luxurious_04 View Post
              Hello, can anyone help me? I have a problem with the PlaySound(). I just download a PCM from wikipedia or in this link http://en.wikipedia.org/wiki/WAV and put it in my C:\ drive but it will not work. It will only print on the output if my trigger is hit. There is no error on the log tab.
              I believe Playsound() will only play standard Windows uncompressed wav files. Almost all the files on that page are compressed files.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by usazencort, Today, 01:16 AM
              0 responses
              1 view
              0 likes
              Last Post usazencort  
              Started by kaywai, 09-01-2023, 08:44 PM
              5 responses
              603 views
              0 likes
              Last Post NinjaTrader_Jason  
              Started by xiinteractive, 04-09-2024, 08:08 AM
              6 responses
              22 views
              0 likes
              Last Post xiinteractive  
              Started by Pattontje, Yesterday, 02:10 PM
              2 responses
              21 views
              0 likes
              Last Post Pattontje  
              Started by flybuzz, 04-21-2024, 04:07 PM
              17 responses
              230 views
              0 likes
              Last Post TradingLoss  
              Working...
              X