Configuring CMMFCodec for encoding audio to AMR

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Platform(s): S60 2nd Edition, FP2 and FP3, S60 3rd Edition
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
Keywords: CMMFCodec, AMR
Created: User:Technical writer 2 (19 Oct 2006)
Last edited: lpvalente (27 Jul 2014)


Configuring CMMFCodec for encoding audio to AMR.


On S60 2nd Edition, Feature Pack 2 and 3, manual conversion from PCM16-format audio to AMR-NB can be done via the CMMFCodec interface. CMMFCodec also provides a method for configuring the encoder — in this case, specifying the AMR encoding mode (bitrate).


#include <mmf\plugin\mmfCodecImplementationUIDs.hrh>
const TUid KMMFCodecAMREncode = {KAdvancedUidCodecPCM16ToAMR}; // 0x101FAF68
const TUid KUidConfig = {KUidMmfCodecAudioSettings}; // 0x10203622
CMMFCodec* codec = CMMFCodec::NewL(KMMFCodecAMREncode);
TAmrEncParams iEncoderParams;
iEncoderParams.iMode = mode; // AMR-NB mode between 0...7
iEncoderParams.iDTX = EFalse;
// DTX mode
codec->ConfigureL(KUidConfig, (const TDesC8&)iEncoderParams);
// proceed to call CMMFCodec::ProcessL()
// see CMMFCodec documentation on SDK Help for more info

The TAmrEncParams class definition is no longer in the SDK. The following definition can be used:

class TAmrEncParams
inline TAmrEncParams();
// encoding mode 0-7 (0=MR475,1=MR515,...,7=MR122, default 7)
TInt iMode;
// DTX (discontinuous transmission) flag (true/false)
TInt iDTX;
TAmrEncParams::TAmrEncParams() :
iMode(7), iDTX(0) {}


  • On most current S60 devices, recording/playback and streaming is already done with more efficient hardware (DSP) codecs. These codecs can be taken into use with high-level audio APIs (CMdaAudio[Player|Recorder]Utility, CMdaAudio[Input|Output]Stream), but they cannot be used via the CMMFCodec interface. For some codecs (e.g., AMR-NB) a CMMFCodec implementation is also included for maintaining backward compatibility.}}
  • S60 3rd Edition: The above definition for TAmrEncParams works for S60 3rd Edition as well, however the required AMR-NB MMF codec is not included in all S60 3rd Edition phones. The following phone models do include this codec:
    • Nokia 3250
    • Nokia E62
    • Nokia N71
    • Nokia N73
    • Nokia N75
    • Nokia N80
    • Nokia N92
    • Nokia N93
    • Nokia N95
    • Nokia 6290
This page was last modified on 27 July 2014, at 02:29.
99 page views in the last 30 days.