×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    5

    Unhappy Recording in Amr Format

    Hi every body,

    I want to know if someone success recording in amr file with Nokia 6630 and Nokia 6600 and what I have to do to reach my goal?

    The code given here allow you to play an amr file with the sound example given in the sdk , the problem that I can not record in amr format with it as written in newlc.



    const TUid KMMFExControllerUID = {0x101F5022};
    const TUid KMMFExDesFormatUID = {0x101FAF66};
    const TUint32 KMMFFourCCCodeAMR = {0x524d4120};

    _LIT(KRecorderFile, "C:\\System\\Apps\\Sound\\record.amr");


    void CRecorderAdapter::ConstructL()
    {
    iMdaAudioRecorderUtility = CMdaAudioRecorderUtility::NewL(*this);


    // Open an existing sample file for playback or recording,
    // causes MMdaObjectStateChangeObserver::MoscoStateChangeEvent to be called
    //iMdaAudioRecorderUtility->OpenFileL(KRecorderFile);
    iMdaAudioRecorderUtility->OpenFileL(KRecorderFile,KMMFExControllerUID,KMMFExControllerUID,KMMFExDesFormatUID,KMMFFourCCCodeAMR);
    }



    Please help me;

    Thanks to all.

    Houda

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi,

    i dont use CMdaAudioRecorderUtility, but are you sure about USED UIDS? I tried to run those code below to enumerate ALL plugins on my N6630:

    //////////////////////////////////////////////////////////////////////////////////////////////////////
    // log data informations
    _LIT8( KController, "Controller : %d \xa\xd");
    _LIT8( KType, "Type : %S \xa\xd");
    _LIT8( KDisplayName, "Display name: %S \xa\xd");
    _LIT8( KSupplier, "Supplier : %S \xa\xd");
    _LIT8( KExtension, "Extension : %S \xa\xd");
    _LIT8( KHeader, "Header : %S \xa\xd");
    _LIT8( KMime, "Mime : %S \xa\xd");
    _LIT8( KUid, "UID : 0x%x \xa\xd");
    _LIT8( KRecord, "Record");
    _LIT8( KPlay, "Play");
    _LIT8( KDelimiter, "_______________________________________________");

    //----------------------------------------------------------------
    //
    // Resolve all audio plugins
    //
    //----------------------------------------------------------------
    void CPluginTester::ResolvePluginsL()
    {

    // selection parameters for resolving plugin formats
    // from the ECOM registry
    CMMFControllerPluginSelectionParameters* cpsp = CMMFControllerPluginSelectionParameters::NewLC();

    // defines the format support required
    CMMFFormatSelectionParameters* play_params = CMMFFormatSelectionParameters::NewLC();
    CMMFFormatSelectionParameters* record_params = CMMFFormatSelectionParameters::NewLC();

    // set the play and record format selection parameters to be blank.
    cpsp->SetRequiredPlayFormatSupportL( *play_params );
    cpsp->SetRequiredRecordFormatSupportL( *record_params );

    // set the media ids
    RArray<TUid> media_ids;
    CleanupClosePushL( media_ids );
    User::LeaveIfError( media_ids.Append( KUidMediaTypeAudio ) );

    // get plugins that support audio
    cpsp->SetMediaIdsL( media_ids, CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds );

    // Array to hold all the controllers support the match data
    cpsp->ListImplementationsL( iPlugins );

    CleanupStack::PopAndDestroy();
    CleanupStack::PopAndDestroy( record_params );
    CleanupStack::PopAndDestroy( play_params );
    CleanupStack::PopAndDestroy( cpsp );
    }

    //----------------------------------------------------------------
    //
    // Save audio plugins information into text file
    //
    //----------------------------------------------------------------
    TInt CPluginTester::SavePluginsToFile( RFs& aFs, TFileName aFileName )
    {

    // get all audio plugins
    TRAPD( error, { ResolvePluginsL(); } )
    if ( error != KErrNone )
    return error;

    // delete existing file
    if ( BaflUtils::FileExists( aFs , aFileName ) )
    if ( BaflUtils::DeleteFile( aFs, aFileName ) != KErrNone )
    return KErrAccessDenied;

    RFile file;
    error = file.Create( aFs, aFileName, EFileWrite );
    if ( error != KErrNone )
    return error;
    CleanupClosePushL( file );

    // plugin data
    TBuf<256> data16;
    TBuf8<256> data8;
    TBuf8<256> formatted8;
    CDesC8Array* data_array;
    TUid uid;

    // crlf
    TBuf8<2> crlf;
    crlf.Append( 0x0a );
    crlf.Append( 0x0d );
    // loop through all resolved ECom controller plugins
    for( TInt i = 0; i < iPlugins.Count(); ++i )
    {
    // reocrd and play loop
    for ( TInt j = 0; j < 2; j++ )
    {
    RMMFFormatImplInfoArray rp_formats;
    if ( j == 0 )
    rp_formats = iPlugins[ i ]->RecordFormats();
    else

    rp_formats = iPlugins[ i ]->PlayFormats();

    // go through formats
    for ( TInt k = 0; k < rp_formats.Count(); k++ )
    {
    // header
    file.Write ( KDelimiter );
    file.Write ( crlf );
    formatted8.Format( KController, i );

    // controller uid
    formatted8.Format( KUid, iPlugins[ i ]->Uid().iUid );
    file.Write ( formatted8 );

    if ( j == 0 )
    formatted8.Format( KType, &KRecord() );
    else
    formatted8.Format( KType, &KPlay() );
    file.Write ( formatted8 );

    file.Write ( KDelimiter );
    file.Write ( crlf );

    // An object of this type may describe either a concrete format plugin
    CMMFFormatImplementationInformation* format = rp_formats[ k ];

    // display name
    data16.Copy( format->DisplayName() );
    CnvUtfConverter::ConvertFromUnicodeToUtf8( data8, data16 );
    formatted8.Format( KDisplayName, &data8 );
    file.Write ( formatted8 );

    // supplier
    data16.Copy( format->Supplier() );
    CnvUtfConverter::ConvertFromUnicodeToUtf8( data8, data16 );
    formatted8.Format( KSupplier, &data8 );
    file.Write( formatted8 );

    // extensions
    data_array = ( CDesC8Array * )&format->SupportedFileExtensions();
    for ( TInt l = 0; l < data_array->Count(); ++l )
    {
    formatted8.Format( KExtension, &(*data_array)[ l ] );
    file.Write ( formatted8 );
    }

    // headers
    data_array = ( CDesC8Array * )&format->SupportedHeaderData();
    for ( l = 0; l < data_array->Count(); ++l )
    {
    formatted8.Format( KHeader, &(*data_array)[ l ] );
    file.Write ( formatted8 );
    }

    // mime types
    data_array = ( CDesC8Array * )&format->SupportedMimeTypes();
    for ( l = 0; l < data_array->Count(); ++l )
    {
    formatted8.Format( KMime, &(*data_array)[ l ] );
    file.Write ( formatted8 );
    }

    // plugin uid
    uid = format->Uid();
    formatted8.Format( KUid, uid.iUid );
    file.Write ( formatted8 );
    }
    }
    }
    CleanupStack::PopAndDestroy();
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////
    Where used memeber in the code are defined as:
    // all plugins
    RMMFControllerImplInfoArray iPlugins;

    The result I will put into next reply.

    Bye
    STEN

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi,
    there is the generated file:

    _______________________________________________
    UID : 101f5022
    Type : Record
    _______________________________________________
    Display name: WAV Write Format||Copyright 2002 Symbian Ltd. All Rights Reserved.||
    Supplier : Symbian
    Extension : .wav
    Header : RIFF????WAVE
    Mime : audio/wav
    Mime : audio/x-wav
    UID : 101f55e2
    _______________________________________________
    UID : 101f5022
    Type : Record
    _______________________________________________
    Display name: AU Write Format||Copyright 1997-2001 Symbian Ltd. All Rights Reserved.||
    Supplier : Symbian
    Extension : .au
    Header : .snd
    Mime : audio/basic
    Mime : audio/x-au
    Mime : audio/au
    Mime : audio/x-basic
    UID : 101f5c13
    _______________________________________________
    UID : 101f5022
    Type : Record
    _______________________________________________
    Display name: RAW Write Format||Copyright 1997-2001 Symbian Ltd. All Rights Reserved.||
    Supplier : Symbian
    Extension : .raw
    UID : 101f5c17
    _______________________________________________
    UID : 101f5022
    Type : Play
    _______________________________________________
    Display name: WAV Read Format||Copyright 2002 Symbian Ltd. All Rights Reserved.||
    Supplier : Symbian
    Extension : .wav
    Header : RIFF????WAVE
    Mime : audio/wav
    Mime : audio/x-wav
    UID : 101f55e1
    _______________________________________________
    UID : 101f5022
    Type : Play
    _______________________________________________
    Display name: AU Read Format||Copyright 1997-2001 Symbian Ltd. All Rights Reserved.||
    Supplier : Symbian
    Extension : .au
    Header : .snd
    Mime : audio/basic
    Mime : audio/x-au
    Mime : audio/au
    Mime : audio/x-basic
    UID : 101f5c12
    _______________________________________________
    UID : 101f5022
    Type : Play
    _______________________________________________
    Display name: RAW Read Format||Copyright 1997-2001 Symbian Ltd. All Rights Reserved.||
    Supplier : Symbian
    Extension : .raw
    UID : 101f5c16
    _______________________________________________
    UID : 101f7d96
    Type : Play
    _______________________________________________
    Display name: Tone Sequence Play Format
    Supplier : Nokia
    Extension : ?
    Header : 
    Header : J:
    UID : 101fafac
    _______________________________________________
    UID : 101f7d96
    Type : Play
    _______________________________________________
    Display name: Tone Sequence Play Format
    Supplier : Symbian
    Extension : .nrt
    Extension : .rng
    Header : ?application/vnd.nokia.ringing-tone
    UID : 101fafab
    _______________________________________________
    UID : 101f7d96
    Type : Play
    _______________________________________________
    Display name: Tone Sequence Play Format
    Supplier : Symbian
    Extension : .nrt
    Extension : .rng
    UID : 101f7dc5
    _______________________________________________
    UID : 101f7d96
    Type : Play
    _______________________________________________
    Display name: Tone Sequence Play Format
    Supplier : Symbian
    Extension : .sqn
    Header : SQNC
    UID : 101faf8c
    _______________________________________________
    UID : 101f8b24
    Type : Play
    _______________________________________________
    Display name: BAE Structured Audio Read Format||Beatnik Inc.||
    Supplier : Beatnik
    Extension : .mid
    Header : ?audio/sp-midi
    Header : MThd???????????????????ð?? 
    Mime : audio/sp-midi
    UID : 101f8b35
    _______________________________________________
    UID : 101f8b24
    Type : Play
    _______________________________________________
    Display name: BAE Structured Audio Read Format||Beatnik Inc.||
    Supplier : Beatnik
    Extension : .mxmf
    Header : ?audio/mobile-xmf
    Header : XMF_2.00
    Mime : audio/mobile-xmf
    UID : 101f8b36
    _______________________________________________
    UID : 101f8b24
    Type : Play
    _______________________________________________
    Display name: BAE Structured Audio Read Format||Beatnik Inc.||
    Supplier : Beatnik
    Extension : .rmf
    Header : ?audio/x-beatnik-rmf
    Header : IREZ
    Mime : audio/x-beatnik-rmf
    UID : 10202709
    _______________________________________________
    UID : 101f8b24
    Type : Play
    _______________________________________________
    Display name: BAE Structured Audio Read Format||Beatnik Inc.||
    Supplier : Beatnik
    Header : ?audio/x-rmf
    Mime : audio/x-rmf
    UID : 1020270a
    _______________________________________________
    UID : 101f8b24
    Type : Play
    _______________________________________________
    Display name: BAE Structured Audio Read Format||Beatnik Inc.||
    Supplier : Beatnik
    Header : ?audio/rmf
    Mime : audio/rmf
    UID : 101f8b29
    _______________________________________________
    UID : 101f8b24
    Type : Play
    _______________________________________________
    Display name: BAE Structured Audio Read Format||Beatnik Inc.||
    Supplier : Beatnik
    Extension : .mid
    Header : ?audio/midi
    Header : MThd
    Mime : audio/midi
    UID : 101f8b26
    _______________________________________________
    UID : 101faf7d
    Type : Play
    _______________________________________________
    Display name: AMR Read Format
    Supplier : Nokia
    Extension : .amr
    Header : #!AMR

    Header : ?audio/amr
    Mime : audio/amr
    UID : 101f5c50
    _______________________________________________
    UID : 101faf7d
    Type : Play
    _______________________________________________
    Display name: AMRWB Read Format
    Supplier : Nokia
    Extension : .awb
    Header : #!AMR-WB

    Header : ?audio/amr-wb
    Mime : audio/amr-wb
    UID : 101f7b1b
    _______________________________________________
    UID : 101faf7d
    Type : Play
    _______________________________________________
    Display name: AAC Read Format
    Supplier : Nokia
    Extension : .aac
    Header : ?audio/aac
    Header : ADIF
    Mime : audio/aac
    UID : 101f7b1f
    _______________________________________________
    UID : 101faf7d
    Type : Play
    _______________________________________________
    Display name: AAC Read Format
    Supplier : Nokia
    Extension : .aac
    Mime : audio/aac
    UID : 101f7b1e
    _______________________________________________
    UID : 101faf7d
    Type : Play
    _______________________________________________
    Display name: MP3 Read Format
    Supplier : Nokia
    Extension : .mp3
    Header : ??audio/mpeg
    Header : ?audio/mp3
    Mime : audio/mpeg
    UID : 101f7b1c
    _______________________________________________
    UID : 101faf7d
    Type : Play
    _______________________________________________
    Display name: MP3 Read Format
    Supplier : Nokia
    Extension : .mp3
    Mime : audio/mpeg
    UID : 101f7b1d
    _______________________________________________
    UID : 101faf7e
    Type : Record
    _______________________________________________
    Display name: AMR Write Format
    Supplier : Nokia
    Extension : .amr
    Header : #!AMR

    Mime : audio/amr
    UID : 101faf7e
    _______________________________________________
    UID : 101fafb1
    Type : Play
    _______________________________________________
    Display name: 3GP Read Format
    Supplier : Nokia
    Extension : .3gp
    Header : ????ftyp3gp
    Header : ?audio/3gpp
    Mime : audio/3gpp
    UID : 0
    _______________________________________________
    UID : 101fafb1
    Type : Play
    _______________________________________________
    Display name: MP4 Read Format
    Supplier : Nokia
    Extension : .m4a
    Extension : .mp4
    Header : ????ftypM4A
    Header : ????ftypmp4
    Header : ?audio/m4a
    Header : ?audio/mp4
    Mime : audio/mp4
    UID : 1111
    _______________________________________________
    UID : 101fafb1
    Type : Play
    _______________________________________________
    Display name: MP4 Read Format
    Supplier : Nokia
    Extension : .m4a
    Extension : .mp4
    Header : ????ftypM4A
    Header : ????ftypmp4
    Mime : audio/mp4
    UID : 3333
    _______________________________________________
    UID : 101fafb1
    Type : Play
    _______________________________________________
    Display name: 3G2 Read Format
    Supplier : Nokia
    Extension : .3g2
    Header : ????ftyp3g2
    Header : ?audio/3gpp2
    Mime : audio/3gpp2
    UID : 4444
    _______________________________________________
    UID : 101fafb1
    Type : Play
    _______________________________________________
    Display name: 3G2 Read Format
    Supplier : Nokia
    Extension : .3g2
    Header : ????ftyp3g2
    Mime : audio/3gpp2
    UID : 5555

    Bye STEN

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi ,

    so as I understand those UIDs should be used in the OpenFileL() method.

    // record: WAV, AU, RAW
    // play : WAV, AU, RAW
    const TUid KUidControllerAudio1 = { 0x101f5022 };
    // record: ---
    // play : AMR, AMR-WB, AAC, MP3
    const TUid KUidControllerAudio2 = { 0x101faf7d };
    // record: AMR
    // play : ---
    const TUid KUidControllerAudio3 = { 0x101faf7e };

    // write into wav
    const TUid KUid_WAV_WriteFormat = { 0x101f55e2 };
    // write into amr
    const TUid KUid_AMR_WriteFormat = { 0x101faf7e };
    // read amr
    const TUid KUid_AMR_ReadFormat = { 0x101f5c50 };
    // read amr-wb
    const TUid KUid_AMRWB_ReadFormat = { 0x101f7b1b };
    // read mp3
    const TUid KUid_MP3_ReadFormat = { 0x101f7b1c };

    I test it on emulator for WAV and it works, but when i tried to use it on N6630 I receive KErrNotSupported in the MoscoStateChangeEvent(). Did I do anything wrong??????

    #ifdef __WINS__
    iRecorder->OpenFileL( iTmpFile, KUidControllerAudio1, KUidControllerAudio1, KUid_WAV_WriteFormat );
    #else
    iRecorder->OpenFileL( iTmpFile, KUidControllerAudio3, KNullUid, KUid_AMR_WriteFormat );
    #endif

    Bye STEN

  5. #5
    Registered User
    Join Date
    Jul 2003
    Posts
    33
    Hi Sten,

    You said:

    i dont use CMdaAudioRecorderUtility

    Does this mean that you use something else entirely for audio recording, or simply don't work with audio recording at all?

  6. #6
    Nokia Developer Champion
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi,

    I dont use audio recording classes. I am streaming PCM16 format into buffer and than I encode it to AMR (see my other posts). It is not best, but always working solution... The only weakness of it is posiibility of data underflow, when for example file system is used during recording... So you must keep an eye if the size of streamed data is the same as you expected and leave if error detected.

    BTW. Did you test the recording with the new UIDs???? I test it just little bit - code works perfectly for WAV, but when I changed UID it leaves -5 KErrNotSupported. I think that I must do something wrong...

    I donr want jump to conclusions , but it seems, that Nokia simply bullshit from us

    Ask if I could help you...
    Bye
    STeN

  7. #7
    Registered User
    Join Date
    Jul 2003
    Posts
    33
    Hi STeN,

    Actually, I occasionally do some research for my programming team, so many of the technical points are beyond me, however audio recording has been a huge pain in our ass, for every phone model, and nearly every firmware update, so I'm always digging for more info on the subject.

    I appreciate your reply.

    Cheers!

    Josh

  8. #8
    Registered User
    Join Date
    Mar 2003
    Location
    Luttenberg (Netherlands)
    Posts
    577

    Re: Recording in Amr Format

    Hi,

    I tried to use CMdaAudioRecorderUtility->RecordL() on N95 with AMR UIDs as you indicated. It gives "Feature not supported".

    Did anyone write a recording application succesfully using CMdaAudioRecorderUtility->RecordL() ?

    BR,

    Rene
    Rene Heuven
    Inmote - Creative Smartphone Solutions
    Web: www.inmote.com
    E-mail: rene@inmote.com

  9. #9
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Recording in Amr Format

    Hi,

    In general you shouldn't hard code UIDs in your application for these things - it isn't portable. If you need to use a specific controller you should query the available controller plug-ins and select the appropriate one.

    Much better if possible though, is just to set the destination format and data type then open the file with one of the overloads that doesn't take any UIDs at all.

    Hope that helps,
    Sorcery

  10. #10
    Registered User
    Join Date
    Mar 2003
    Location
    Luttenberg (Netherlands)
    Posts
    577

    Re: Recording in Amr Format

    Hi Sorcery-ltd,

    I am just writing a test application to see if the requirement of my customer (recording using AMR-NB at 12.2Kbps) is feasible or not on S60. I am supprised that
    CMdaAudioRecorderUtility->RecordL() gives "Feature not supported", but CMdaAudioInputStream works.

    So my question stays: Did anyone use CMdaAudioRecorderUtility succesfully on S60? Is there an example using this specific class. It suggest it can also stream to a URL (but unknown if this works and if not why it does not work).

    We will not use any hardcoded UIDs in our application when it is released to market. Thanks for this general advice.

    BR,

    Rene
    Rene Heuven
    Inmote - Creative Smartphone Solutions
    Web: www.inmote.com
    E-mail: rene@inmote.com

  11. #11
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Recording in Amr Format

    Hi,

    I haven't personally recorded AMR with the CMdaAudioRecorderUtility, however, I remember seeing other posts on this forum for people that have. Have a search.

    Have you tried what I was suggesting and just specify the format and type you want via the appropriate API calls and then just opening a file to record to without specifying any UIDs? It's actually quite likely that you are getting "Feature not supported" because the UIDs you are using are incorrect - if you leave the system to pick the appropriate controller via the method I suggest then you will find out if it is actually possible.

    It is in fact possible that on some models you would be able to record in some formats via CMdaAudioInputStream and not via CMdaAudioRecorderUtility. That's because the latter requires an appropriate controller plug-in whereas the former just requires support for the codec in the DevSound layer. However, other devices may have the support the other way around, particularly older devices. That is there may be a controller plug-in and a soft codec but no support for the codec in DevSound. In that case CMdaAudioInputStream wouldn't work.

    This is a tricky area where support has changed over time and you need to be careful about what devices you want to support.

    Hope that helps,
    Sorcery

  12. #12
    Registered User
    Join Date
    Mar 2003
    Location
    Luttenberg (Netherlands)
    Posts
    577

    Re: Recording in Amr Format

    Hi Sorcery,

    thanks for this clarification. Unfortunately I have to pause this project for 1-2 weeks (the next 2 weeks I have some other development priorities). I will get back when I have some more results.

    BR,

    Rene
    Rene Heuven
    Inmote - Creative Smartphone Solutions
    Web: www.inmote.com
    E-mail: rene@inmote.com

  13. #13
    Registered User
    Join Date
    Mar 2009
    Posts
    1

    Smile Re: Recording in Amr Format

    could anyone tell me what different encoded video files'headers are?

Posting Permissions

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