×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    44

    CMMFCodec uid for converting AMR to PCM16

    what is the UID of the CMMFCodec class for converting
    AMR to PCM16? (I've tried 0x101FAF67 but it does not work),
    and in the mmfcodecimplementationsuids.hrh there isn't
    a uid for AMRtoPCM16 only :
    KMmfUidCodecAlawToPCM16,
    KMmfUidCodecAudioU16ToPCMS16,KMmfUidCodecAudioU8ToPCMS16,
    KMmfUidCodecIMAADPCMToPCM16,
    KMmfUidCodecGSM610ToPCM16.
    Any ideas?

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi,
    both UIDss are:
    KAdvancedUidCodecPCM16ToAMR 0x101FAF68
    KAdvancedUidCodecAMRToPCM16 0x101FAF67

    Method for converting should look like:

    // create pcm16 and amr buffers
    iPcm16Buffer = CMMFDescriptorBuffer::NewL( KPcmBufferSize );
    iAmrBuffer = CMMFDescriptorBuffer::NewL( KAmrFrameSize );

    // initialize codec
    iOCodec = CMMFCodec::NewL( TUid::Uid( KAdvancedUidCodecAMRToPCM16 ) );

    ....

    TDesC8* ConvertAmr2PcmL( const TDesC8& aAmrData )
    {

    // amr input data
    iAmrBuffer->Data().Copy( aAmrData );

    // decode
    TCodecProcessResult result = iOCodec->ProcessL( *iAmrBuffer, *iPcm16Buffer );

    if ( ( result.iStatus == TCodecProcessResult::EProcessComplete ) &&
    ( result.iSrcBytesProcessed == KAmrFrameSize ) &&
    ( result.iDstBytesAdded == KPcmBufferSize ) )
    {
    // return buffer
    return &( iPcm16Buffer->Data() );
    }
    else
    return NULL;
    }

    Bye

    STeN

  3. #3
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    BTW: could be possibkle that Nokia "forgot" to put them into SDK mmfcodecimplementationuids.hrh file....
    Bye
    STeN

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    15

    Support for AMR

    I saw that too. There seems to be minimal support for AMR for some reason. Because of this, I used GSM610, which is adequate for my needs.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    44
    thanks. The reason it did not work the first time was because
    I tried to parse a bufffer which included the .amr header...

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    44
    Hi Everyone

    What are the buffer sizes I shold use for pcm and amr data
    (when using small buffer for amr the conversion between
    amr and pcm only worked for the first buffer).

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    44
    Let me answer my own question .The buffers size should be
    320 as mentioned in one of the posts in this forum.

  8. #8
    Registered User
    Join Date
    Jan 2005
    Posts
    3
    I use stenlik's method.But, When I convert PCM16 to AMR, Whatever the KPcmBufferSize I give ,the result of AMR always is 13. WHY??
    Who can help me?

  9. #9
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi,

    my observation is that on the emulator the buffer for PCM is filled up to 4096 bytes - if you use bigger it is only wasting resources. But on device you could use arbitrarily big buffer, but only 320 bytes will be filled by raw pcm data, rest of buffer stay unused. So I decided to use KPcmBufferSize as 320. It is equal to 20 ms of sound. Using amr 4.75kbps for encoding sound data 320 bytes are reduced into 13 bytes. I hardcoded thoses sizes...

    Bye
    STeN

  10. #10
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: CMMFCodec uid for converting AMR to PCM16

    Hi,

    may be it's obsolete but streaming into PCM and than converting into AMR was U-Turn and BIG fool at all. This was my stupid solution... Now (almost one year later) I saw 5 lines code using CMMFDevSound class doing nice AMR recording, with better quality and resource demands... I don't beleive I was so blinded I omit this class and use the PCM2AMR solution. Sorry to all.

    Bye,
    STeN

    P.S. I'm wondering why anyone from Nokia didn't help us at those days I was developing with black glasses((((((((((((((((

  11. #11
    Registered User
    Join Date
    Mar 2006
    Posts
    1

    Re: CMMFCodec uid for converting AMR to PCM16

    I've tried this code below and got no usable data from the output of ProcessL. Does the output data go straight to WriteL for CMdaInputStream? I've used 13 for KAmrFrameSize and 320 KPcmBufferSize as well as large buffer sizes. Nothing seems to work. Does 13 bytes of AMR really translate to 320 bytes of PCM. Seems unrealistic to me. I just want this to work.

    KAdvancedUidCodecPCM16ToAMR 0x101FAF68
    KAdvancedUidCodecAMRToPCM16 0x101FAF67

    Method for converting should look like:

    // create pcm16 and amr buffers
    iPcm16Buffer = CMMFDescriptorBuffer::NewL( KPcmBufferSize );
    iAmrBuffer = CMMFDescriptorBuffer::NewL( KAmrFrameSize );

    // initialize codec
    iOCodec = CMMFCodec::NewL( TUid::Uid( KAdvancedUidCodecAMRToPCM16 ) );

    ....

    TDesC8* ConvertAmr2PcmL( const TDesC8& aAmrData )
    {

    // amr input data
    iAmrBuffer->Data().Copy( aAmrData );

    // decode
    TCodecProcessResult result = iOCodec->ProcessL( *iAmrBuffer, *iPcm16Buffer );

    if ( ( result.iStatus == TCodecProcessResult::EProcessComplete ) &&
    ( result.iSrcBytesProcessed == KAmrFrameSize ) &&
    ( result.iDstBytesAdded == KPcmBufferSize ) )
    {
    // return buffer
    return &( iPcm16Buffer->Data() );
    }
    else
    return NULL;
    }

  12. #12
    Registered User
    Join Date
    Aug 2006
    Posts
    18

    Re: CMMFCodec uid for converting AMR to PCM16

    Does this code will work on 8.1 ?
    Quote Originally Posted by stenlik
    KAdvancedUidCodecPCM16ToAMR 0x101FAF68
    KAdvancedUidCodecAMRToPCM16 0x101FAF67

    // initialize codec
    iOCodec = CMMFCodec::NewL( TUid::Uid( KAdvancedUidCodecAMRToPCM16 ) ); <<-- here is applicarion crashed
    I have a problem when try to create CMMFCodec such as showed.

  13. #13
    Regular Contributor
    Join Date
    May 2006
    Location
    Hyderabad,India
    Posts
    89

    Re: CMMFCodec uid for converting AMR to PCM16

    Hi,

    Can we use CMMFDevSound for streaming?

    Thanks & Regards,
    Sheshu Kumar Inguva.

  14. #14
    Registered User
    Join Date
    Aug 2006
    Posts
    18

    Re: CMMFCodec uid for converting AMR to PCM16

    Quote Originally Posted by stenlik
    may be it's obsolete but streaming into PCM and than converting into AMR was U-Turn and BIG fool at all. This was my stupid solution... Now (almost one year later) I saw 5 lines code using CMMFDevSound class doing nice AMR recording, with better quality and resource demands... I don't beleive I was so blinded I omit this class and use the PCM2AMR solution. Sorry to all.
    Can you please give any code as example on how to use CMMFDevSound to record sound in AMR ?

    Thanks in advance !

  15. #15
    Registered User
    Join Date
    May 2006
    Posts
    13

    Re: CMMFCodec uid for converting AMR to PCM16

    Hi Oncer,

    I have the same problem on N91. Did you solve it?
    Serdar Tahir Kabaoglu
    Software Engineer

Posting Permissions

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