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. C / C++ / MFC
  4. How to decode non-PCM wave files to PCM format

How to decode non-PCM wave files to PCM format

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
10 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
    Danzy83
    wrote on last edited by
    #1

    I am programming a console player that plays audio files. I have been able to write the program such that it can now play PCM .wav files. I have also programmed it such that it can decode .mp3 audio files to PCM using libmad and it plays well. I now want to the program to also play non-PCM wave files. I'm sure this will have to be decoded to PCM format but I don't know how this is done. Could anyone help me with how to do this, or a link to books or tutorials useful? Thanks in advance.

    C 1 Reply Last reply
    0
    • D Danzy83

      I am programming a console player that plays audio files. I have been able to write the program such that it can now play PCM .wav files. I have also programmed it such that it can decode .mp3 audio files to PCM using libmad and it plays well. I now want to the program to also play non-PCM wave files. I'm sure this will have to be decoded to PCM format but I don't know how this is done. Could anyone help me with how to do this, or a link to books or tutorials useful? Thanks in advance.

      C Offline
      C Offline
      chandu004
      wrote on last edited by
      #2

      i remember, there is a tool called SOX, which does the conversion from non-PCM(for example, GSM) to PCM. it is a command line tool. if you search for it, you may get it. also you may get its open source, if you search more. all the best.

      -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

      D 1 Reply Last reply
      0
      • C chandu004

        i remember, there is a tool called SOX, which does the conversion from non-PCM(for example, GSM) to PCM. it is a command line tool. if you search for it, you may get it. also you may get its open source, if you search more. all the best.

        -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

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

        I just downloaded the SOX source code. Do you please remember or have a sample project that demonstrates its use? There is an example1 file in the folder but it is not documented which will make it difficult for me to understand how it is used. Thanks.

        C 1 Reply Last reply
        0
        • D Danzy83

          I just downloaded the SOX source code. Do you please remember or have a sample project that demonstrates its use? There is an example1 file in the folder but it is not documented which will make it difficult for me to understand how it is used. Thanks.

          C Offline
          C Offline
          chandu004
          wrote on last edited by
          #4

          if you have an exe file, then this is how, it can be used from the command line. sox nonpcm.WAV -s -r 16000 PCM.wav let me know if you have any issues.

          -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

          D 1 Reply Last reply
          0
          • C chandu004

            if you have an exe file, then this is how, it can be used from the command line. sox nonpcm.WAV -s -r 16000 PCM.wav let me know if you have any issues.

            -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

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

            I have the the intent to use it later in a GUI application after understanding its use. This will mean that I will need to understand how it works that is why I need sample applications or tutorials that explains how it is used.

            C enhzflepE 2 Replies Last reply
            0
            • D Danzy83

              I have the the intent to use it later in a GUI application after understanding its use. This will mean that I will need to understand how it works that is why I need sample applications or tutorials that explains how it is used.

              C Offline
              C Offline
              chandu004
              wrote on last edited by
              #6

              thats what i was trying to say DAN, you have SOX source code right, try to get the sox exe also, and use the command i have given, and test if it works for your need. if it works, then you can understand from the src, how it is done. all the best.

              -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

              D 1 Reply Last reply
              0
              • C chandu004

                thats what i was trying to say DAN, you have SOX source code right, try to get the sox exe also, and use the command i have given, and test if it works for your need. if it works, then you can understand from the src, how it is done. all the best.

                -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

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

                I have the executable now which I have installed. When I tried what you told me to do, I had the following error message: "Unknown WAV file encoding ". As I said earlier, this WAV file is not in PCM format. Any way around this?

                C 1 Reply Last reply
                0
                • D Danzy83

                  I have the the intent to use it later in a GUI application after understanding its use. This will mean that I will need to understand how it works that is why I need sample applications or tutorials that explains how it is used.

                  enhzflepE Offline
                  enhzflepE Offline
                  enhzflep
                  wrote on last edited by
                  #8

                  Failing an understanding of how to use the code, you could always take the approach oft taken to using ffmpeg, and just include the command line exe in your release then run it from your program, rather than the cmd line. Dunno if you could suppress the cmd-line window from appearing when you run the program, but the question is bound to have been asked a thousand times before, so somewhere the answer lies silently in wait. :)

                  D 1 Reply Last reply
                  0
                  • enhzflepE enhzflep

                    Failing an understanding of how to use the code, you could always take the approach oft taken to using ffmpeg, and just include the command line exe in your release then run it from your program, rather than the cmd line. Dunno if you could suppress the cmd-line window from appearing when you run the program, but the question is bound to have been asked a thousand times before, so somewhere the answer lies silently in wait. :)

                    D Offline
                    D Offline
                    Danzy83
                    wrote on last edited by
                    #9

                    Are you talking about ffmpeg source code itself or the one included in SOX (which I see in the folder)? Or are they the same? I had that separately long time ago but I do not how to use it. Now I know how to decode .mp3 using libmad but I want to try non-PCM wave. I just used a HEX editor to view the non-PCM wave file and I could see that the ENCODER name is vorbis.

                    modified on Friday, June 11, 2010 5:45 AM

                    1 Reply Last reply
                    0
                    • D Danzy83

                      I have the executable now which I have installed. When I tried what you told me to do, I had the following error message: "Unknown WAV file encoding ". As I said earlier, this WAV file is not in PCM format. Any way around this?

                      C Offline
                      C Offline
                      chandu004
                      wrote on last edited by
                      #10

                      Dan_K wrote:

                      As I said earlier, this WAV file is not in PCM format

                      sox donot require pcm formats as source file, to convert to PCM format. long back, i used this exe, to convert wav files in gsm format to pcm format. iam not sure of what is the input format you are using, and if sox supports that format. you can do the following things. 1.take a pcm file which is able to be played in a media player, and convert it to itself. i mean, pcm itself. if it works, it proves that, the exe you are holding is the right one. other wise, we will see an alternative. 2.put me a mail, attaching the sample file you are trying to convert, the sox.exe you have with you, and the source you have downloaded. i will try to help you at my best. please find a mail in your inbox, where i stated my mail id.

                      -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

                      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