Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2005

    Using CMdaAudioConvertUtility to convert raw audio to a wav file

    Can anyone help? I am recording raw audio data to a file using CRecordAudioInputStream. I now want to convert the raw audio data to a wave file format and possibly other file formats, using the CMdaAudioConvertUtility. I keep getting KErrNotSupported when I call OpenL(..), to open the audio conversion utility. I am testing this on the PC emulator and on a 6300 phone. Here is the code I am using

    CMdaAudioConvertUtility* CMediaFileConverter::ConstructL(const TDesC& aSourceFile, const TDesC& aTargetFile)
    TMdaFileClipLocation *SrcFile = new(ELeave) TMdaFileClipLocation(aSourceFile);
    TMdaFileClipLocation *DestFile = new(ELeave) TMdaFileClipLocation(aTargetFile);

    SrcFile.iName = aSourceFile;
    DestFile.iName = aTargetFile;

    TMdaClipFormat* SrcFormat = new(ELeave) TMdaRawAudioClipFormat;
    TMdaClipFormat* DestFormat = new(ELeave) TMdaWavClipFormat;

    TMdaRawAudioClipFormat *SrcCodec = new(ELeave)TMdaRawAudioCodec();
    TMdaPcmWavCodec *DestCodec = new(ELeave)TMdaPcmWavCodec();

    TMdaAudioDataSettings SrcSettings;
    TMdaAudioDataSettings DestSettings;

    SrcSettings.iChannels = 1;//TMdaAudioDataSettings::EChannelsMono;
    SrcSettings.iSampleRate = 8000;//TMdaAudioDataSettings::ESampleRate8000Hz;

    DestSettings.iChannels = TMdaAudioDataSettings::EChannelsMono;
    DestSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate8000Hz;

    TRAP((err, iMediaFileConvertUtility->OpenL(&SrcFile, &DestFile, SrcFormat, DestFormat, SrcCodec, &SrcSettings, DestCodec, &DestSettings));

    return iMediaFileConvertUtility;

    Could somebody please tell where I am doing wrong and show me how to get it right.

    Thanks in advance

    Last edited by rastapasta; 2005-10-31 at 12:37.

  2. #2
    Registered User
    Join Date
    Nov 2004
    Oulu, Finland

    Re: Using CMdaAudioConvertUtility to convert raw audio to a wav file

    CMdaAudioConvertUtility is not needed to create a wav file from raw audio data. All you need to do is to insert the 44 byte wav header into the beginning of the data, and edit the required byte values of the header to the corresponding values of your raw data (eg. bit depth, number of channels, length of data etc).

    More details on wav format here: http://ccrma.stanford.edu/courses/42...ts/WaveFormat/

Similar Threads

  1. Playing a mid file and a wav file at the same time
    By mlhamel in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2009-06-25, 06:03
  2. Replies: 1
    Last Post: 2005-05-26, 14:22
  3. convert wav file to ott file
    By milyzou in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2004-04-16, 10:53
  4. How can u transfer the ott file to mid or wav file.?
    By montooshah in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2003-11-13, 16:36
  5. Mixing and Matching of existing audio file?
    By hiteshw in forum Symbian
    Replies: 0
    Last Post: 2002-02-20, 02:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts