Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Playing Music in VB.Net application [modified]

Playing Music in VB.Net application [modified]

Scheduled Pinned Locked Moved Visual Basic
csharpvisual-studiohelp
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DarkSorrow38
    wrote on last edited by
    #1

    I am trying to play music in my application using command My.Computer.Audio.Play (complete path , AudioPlayMode.Background). The file I am trying to use is a wavefile(.wmv). However when the command is executed an exception is thrown saying The specified file is not PCM type wavefile. Please help regarding what i am supposed to do. I am using Visual Studio 2008.

    modified on Wednesday, May 6, 2009 2:40 PM

    D D 2 Replies Last reply
    0
    • D DarkSorrow38

      I am trying to play music in my application using command My.Computer.Audio.Play (complete path , AudioPlayMode.Background). The file I am trying to use is a wavefile(.wmv). However when the command is executed an exception is thrown saying The specified file is not PCM type wavefile. Please help regarding what i am supposed to do. I am using Visual Studio 2008.

      modified on Wednesday, May 6, 2009 2:40 PM

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      It's quite plain. The file you're trying to play is not in the correct format. Just because the file extension is WMV doesn't mean that the audio is encoded the same as every other WMV. The audio in each file, no matter what the extension, is encoded using different codecs, compressor/decompressors. But, there is a standard format called PCM (Pulse Coded Modulation) that is kind of like the Text file of the audio world. It's audio that is not compressed at all. This is the format that the Audio.Play method supports. It cannot play audio that is compressed. You have to use some kind of tool to create a new file with the audio uncompressed.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      D 1 Reply Last reply
      0
      • D Dave Kreskowiak

        It's quite plain. The file you're trying to play is not in the correct format. Just because the file extension is WMV doesn't mean that the audio is encoded the same as every other WMV. The audio in each file, no matter what the extension, is encoded using different codecs, compressor/decompressors. But, there is a standard format called PCM (Pulse Coded Modulation) that is kind of like the Text file of the audio world. It's audio that is not compressed at all. This is the format that the Audio.Play method supports. It cannot play audio that is compressed. You have to use some kind of tool to create a new file with the audio uncompressed.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        D Offline
        D Offline
        DarkSorrow38
        wrote on last edited by
        #3

        Any possible different method I can use the sound-file in my application. Also guide me as how i can come to know the compression/decompression technique. Thank You.

        D 1 Reply Last reply
        0
        • D DarkSorrow38

          Any possible different method I can use the sound-file in my application. Also guide me as how i can come to know the compression/decompression technique. Thank You.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Ishaan Karnik wrote:

          Any possible different method I can use the sound-file in my application.

          You can use a Windows Media Player component. Drop one from the ToolBox onto your form and you can use that to play the files.

          Ishaan Karnik wrote:

          Also guide me as how i can come to know the compression/decompression technique.

          It's not technique you use in your code. Google for "what is a codec" for more information.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          D 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Ishaan Karnik wrote:

            Any possible different method I can use the sound-file in my application.

            You can use a Windows Media Player component. Drop one from the ToolBox onto your form and you can use that to play the files.

            Ishaan Karnik wrote:

            Also guide me as how i can come to know the compression/decompression technique.

            It's not technique you use in your code. Google for "what is a codec" for more information.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            D Offline
            D Offline
            DarkSorrow38
            wrote on last edited by
            #5

            Sir, I couldnot find a Media Player Component in my toolbox. Please guide me for the same. Thank You

            D 1 Reply Last reply
            0
            • D DarkSorrow38

              Sir, I couldnot find a Media Player Component in my toolbox. Please guide me for the same. Thank You

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Then add it. Right-click the ToolBox, then click on Choose Items... In the dialog that comes up, click on the COM tab, scroll down the list until you find Windows Media Player and check the box next to it. Click on OK, and you're done.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              1 Reply Last reply
              0
              • D DarkSorrow38

                I am trying to play music in my application using command My.Computer.Audio.Play (complete path , AudioPlayMode.Background). The file I am trying to use is a wavefile(.wmv). However when the command is executed an exception is thrown saying The specified file is not PCM type wavefile. Please help regarding what i am supposed to do. I am using Visual Studio 2008.

                modified on Wednesday, May 6, 2009 2:40 PM

                D Offline
                D Offline
                DidiKunz
                wrote on last edited by
                #7

                ...normaly a WMV file contains video and audio. My.Computer.Audio.Play supports only uncompressed .WAV Audio files. Convert your file to .WAV and try again. Regards: Didi

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups