locked
Windows 8 Javascript Metro App / Transcoding audio format to PCM RRS feed

  • Question

  • Hi,

    I have read the following thread http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/fcb0fdf9-f09c-440c-95a0-248e89d052c7 and I was wondering if there is another way to convert a M4A, WMA or MP3 audio format to PCM instead of developing a custom C++ component. I thought that in the Release Preview, the  Windows.Media.MediaProperties.MediaEncodingProfile class would offer a native method to save a file as PCM. It's not the case unfortunately. 

    Any idea on how to do this using something like this:

     var transcoder = new Windows.Media.Transcoding.MediaTranscoder();
    
                var profile = new Windows.Media.MediaProperties.MediaEncodingProfile();
                profile.audio.subtype = "PCM";
    
                var promise = Windows.Storage.KnownFolders.documentsLibrary.createFileAsync("Test.pcm",
                                                                         Windows.Storage.CreationCollisionOption.replaceExisting);
                promise.then(function (pcmFile) {
                    var prepareOp = transcoder.prepareFileTranscodeAsync(audioFile, pcmFile, profile);
                    prepareOp.done(function (result) {
                        if (result.canTranscode) {
                            result.transcodeAsync(function (response) {
                            });
                        } else {
                           
                        }
                    }, function (error) {
                    }); // prepareOp.done
    
                });
    Thanks.


    Omid Bayani


    Friday, June 22, 2012 11:30 PM

Answers

  • Hello Omid,

    Unfortunately at this time we have not released any guidance on creating a PCM profile for use with the WinRT APIs. I have been pushing for this feature but it doesn't appear that a PCM output profile will make it into the final product . Unfortunately this means that in order to support transcoding of PCM data you will either have to find an open source MF Metro sink or write one yourself using C++ Cx.

    I wish I had better news for you,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Saturday, June 23, 2012 1:21 AM
    Moderator

All replies

  • Hello Omid,

    Unfortunately at this time we have not released any guidance on creating a PCM profile for use with the WinRT APIs. I have been pushing for this feature but it doesn't appear that a PCM output profile will make it into the final product . Unfortunately this means that in order to support transcoding of PCM data you will either have to find an open source MF Metro sink or write one yourself using C++ Cx.

    I wish I had better news for you,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Saturday, June 23, 2012 1:21 AM
    Moderator
  • Thanks a lot James.

    I am unfortunately not a C++ developer but I'll see what I can do.


    Omid Bayani - KwypeSoft


    • Edited by Omid Bayani Wednesday, July 18, 2012 1:06 PM
    Sunday, June 24, 2012 4:40 PM
  • Hi,

    I have read the following thread http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/fcb0fdf9-f09c-440c-95a0-248e89d052c7 and I was wondering if there is another way to convert a M4A, WMA or MP3 audio format to PCM instead of developing a custom C++ component. I thought that in the Release Preview, the  Windows.Media.MediaProperties.MediaEncodingProfile class would offer a native method to save a file as PCM. It's not the case unfortunately. 

    Any idea on how to do this using something like this:

     var transcoder = new Windows.Media.Transcoding.MediaTranscoder();
    
                var profile = new Windows.Media.MediaProperties.MediaEncodingProfile();
                profile.audio.subtype = "PCM";
    
                var promise = Windows.Storage.KnownFolders.documentsLibrary.createFileAsync("Test.pcm",
                                                                         Windows.Storage.CreationCollisionOption.replaceExisting);
                promise.then(function (pcmFile) {
                    var prepareOp = transcoder.prepareFileTranscodeAsync(audioFile, pcmFile, profile);
                    prepareOp.done(function (result) {
                        if (result.canTranscode) {
                            result.transcodeAsync(function (response) {
                            });
                        } else {
                           
                        }
                    }, function (error) {
                    }); // prepareOp.done
    
                });
    Thanks.


    Omid Bayani


    Hello,

      we are in your same situation...PCM and WAV are standard to WP7, it's a pity they are totally unknown to WinRT....


    Venetasoft

    Thursday, July 12, 2012 2:13 AM
  • Hi,

    I finally found a solution: Naudio.

    NAudio works quite well over WinRT so I use it to convert MP3 to WAV/PCM. But be careful: the source and destination file must be stored under the Windows.Storage.ApplicationData.current.temporaryFolder folder otherwise you will get an access denied exception. This exception took me few hours to isolate but I finally caught it J


    Omid Bayani - KwypeSoft


    • Edited by Omid Bayani Wednesday, July 18, 2012 7:38 PM
    Wednesday, July 18, 2012 7:38 PM
  • it is a really bad idea not to support was/pcm on win8 RT, it causes big pain for our developers
    Friday, July 20, 2012 9:47 AM
  • Hi Omid,

    I am also suffering by same problem and I have also found that NAudio library. But  when I used it  it gives me error. I building a metro style App. How u have done it can you please guide me regarding this.

    Wednesday, October 10, 2012 7:03 AM
  • Hi,

    Please guide me how to use NAudio for Win8 Apps.

    I hope you will help me.

    Thursday, October 25, 2012 7:29 AM
  • I am now seeing PCM as a subtype under audio encoding properties api (http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.media.mediaproperties.audioencodingproperties.subtype.aspx) as of 12/4/2012 (6 months after James Dailey posted saying PCM profile is not supported). Does this mean PCM profile is now supported?
    • Proposed as answer by Joe Levy_ Monday, April 15, 2013 8:31 AM
    Monday, April 15, 2013 8:30 AM