S60 v2: mp3 file to wav file convert
Login to reply to this topic.
mar, 2006-07-11 11:23
Joined: 2006-06-27
Forum posts: 34
I trying to convert mp3 file to wav file 8000Hz, 16 bit using SDK S60V2FP2.
I use next code:

void CMp3ToWavConverter::ConvertL(  )
{
    iConverterUtility = CMdaAudioConvertUtility::NewL( *this );
    TUid    ControllerUid = {KMmfUidControllerAudio};
    TUid    DestFormatUid = {KMmfUidFormatWAVWrite};
    TFourCC DestDataType(KMMFFourCCCodePCM16);

    TMdaFileClipLocation sourceClipFile( iAudioSourceFileName );
    TMdaFileClipLocation destClipFile( iAudioDistinationFileName );

   iConverterUtility->OpenL(
      &sourceClipFile,
      &destClipFile,
      ControllerUid,
      DestFormatUid,
      DestDataType );
}


void CMp3ToWavConverter::MoscoStateChangeEvent( CBase* aObject,
      TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
{
   if ( iConverterUtility== aObject)
   {
      if ( aPreviousState == 0 && aCurrentState == 1 ) // convert
      {
         //Prepare to converting
         TInt sampleRateHz = 8000;
         //set destination audio properties
         iConverterUtility->SetDestinationNumberOfChannelsL(1);
         iConverterUtility->SetDestinationSampleRateL( sampleRateHz );

         //Convert
         iConverterUtility->ConvertL();
      }
   }
}


Converter opening is ok, but after calling iConverterUtility->ConvertL() i get error: -5 KErrNotSupported.
I cant find any examples on sdk, how to use CMdaAudioConvertUtility converter.
Any ideas will approach how to convert from mp3 file to wav.

Can any help me to solve problem?

mar, 2006-07-11 23:56
Joined: 2006-06-27
Forum posts: 34
I found few unanswered posts similar to this theme on forum, is it possible to convert from mp3 to wav using CMdaAudioConverterUtility?

Can I use CMMFCodec to convert whole mp3 file to wav sample by sample?
If I can do it, then i need to retrieve from mp3 file samples to give it to CMMFCodec in order to converting, is it hard?

Or better and fastest will be using of third party library, example MadLib?

Sorry for my english,
Thanks

dim, 2006-07-16 06:52
Joined: 2006-06-27
Forum posts: 34
I shall try to answer some of my questions itself.
I have tried to use a class CMMFCodec, and on the emulator something is converted, however instead of a normal sound I receive only noise.
On the 6680 phone I get KErrNotSupported error at attempt to create CMMFCodec object with the following parameters:

TFourCC srcDataType (KMMFFourCCCodeMP3);
TFourCC dstDataType (KMMFFourCCCodePCM16);

CMMFCodec* mmfCodec = NULL;
TRAPD (err, mmfCodec = CMMFCodec:: NewL (srcDataType, dstDataType));

Somebody have ideas how to solve this problem?

copyright 2003-2009 NewLC SARL