Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              576 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              334 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              553 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              551 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X