×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Mar 2005
    Location
    Hyderabad, India
    Posts
    19

    yucca, I need your help ( Topic -Playing Mp3 )!

    hello,

    I need to play Mp3 on 6600. Presently I am getting mostly only noises as output. What are the things that I need to consider to play Mp3 on 6600. If you know some details in getting this task done please refer the source.

    Thanking you in anticipation,

    Arun S L,
    Hyderabad, India.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    6600 does not implement the Feature Pack 1, so it does not nativly support MP3 playing. Only way to make it to play MP3s is to make application that would handle all MP3 processing in it.

    See OggPlay for an example that works.

    yucca

  3. #3
    Registered User
    Join Date
    Mar 2005
    Location
    Hyderabad, India
    Posts
    19

    Explaining my situation more,

    Thank you for your response yucca,

    Presently I am using the libmad library and using the DecodeOneFrame function in that to get the file decoded frame by frame and I am appending the output into an HBufC. Then I am converting the HBufC to HBufC8 and writing the HBufC8 into the audio buffer by using the normal streaming functionality. Still I am seeing that the output I am recieving is only noise.

    Some observations while decoding the code (All tests were done only on emulator) were:

    (1) While converting the HBufC to HBufC8 when bufferes of different size were converted, I got different results. I have found the maximum conversion were made when convertions were made using temporary TBuf's of length 8. Most of the times the ConvertFromUnicodeToUtf8 function is still returning error "KErrCorrupt" identified by return value of -20. In such situations there was no conversion that had taken place whatso ever.


    (2) Different MP3 files gave different responses to the same code. In one file, using TBuf's of length 8 all the frames are sucessfully converted, but still not playing properly. In rest of the files most of the times the ConvertFromUnicodeToUtf8 function is still returning error "KErrCorrupt" identified by return value of -20.

    Please guide me to overcome this problem,

    Thanking you,

    Yours truly,

    Arun S L,
    Hyderabad,
    05-07-2005.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    have you checked the SDK docs for the ConvertFromUnicodeToUtf8 ?

    It is located under character converters, so I dont think that you can use it to convert audio data...

    yucca

  5. #5
    Registered User
    Join Date
    Mar 2005
    Location
    Hyderabad, India
    Posts
    19

    Clarrificaton

    Thank you yucca for a prompt response,

    How can I convert the 16 bit data that the DecodeOneFrame funcftion is giving into an 8 bit value and retain its audio properties so as to sucessfully pass it onto WriteL function and get the desired output sound?

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    have a look at OggPlay applications web pages, it at least does quite many different conversions for ogg files, and propably has same for MP3.

    Anyway,since there is no native support for MP3 in 6600, I think there are no ready made function to handle the audio format in th platform either.

    yucca

  7. #7
    Registered User
    Join Date
    Mar 2005
    Location
    Hyderabad, India
    Posts
    19

    I am having the decoded data ->I just need to play it sucessfully

    I am finding that the decoded MP3 data is present in the 16 bit HBufC. I need some code to properly write the same audio information to be copied into 8-bit descriptors to be played sucessfully in the mobile phone. Please could you tell me a proper method of conversion without loss of essential data.

    Thanking you yucca in anticipation,

    Arun S L.

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    14
    hi,arun_sl:
    I encountered the same problem with you now! If you solve the problem, can you do me a favor to let me know? Thanks!

  9. #9
    Registered User
    Join Date
    Sep 2004
    Posts
    11

    Using CMdaAudioOutputStream

    Hi,

    I did same thing;

    I got frame data in TPtr16 (CHBufC:es()) using libmad.

    CMdaAudioOutputStream need TPtr8 data to play.

    Here is my solution to play these frame.

    // creating buffer to hold 8-bit data
    TPtr8 iDescBuf;
    TUint8* iGenBuffer;
    iGenBuffer = new (ELeave) TUint8[KBufferSize];
    iDescBuf.Set(iGenBuffer,KBufferSize,KBufferSize);

    iDescMp3 shows 16-bit data from libmad output.

    Here is the most important part!

    TInt mp3Len = iDescMp3.Length();
    aDescBuf.SetLength(mp3Len*2);
    TInt offset = 0;
    for(TInt i=0; i<mp3Len; i++)
    {
    TInt16 value = iDescMp3[i];
    aDescBuf[offset++] = (TUint8)(value & 0x00ff);
    aDescBuf[offset++] = (TUint8)((value & 0xff00)>>8);
    }

    using this I can play mp3 files. But I get some noise, I think this is releated to output stream.

    If you can create good quality please tell me how.

    I hope this works for you

    bsekerci

  10. #10
    Registered User
    Join Date
    Apr 2005
    Posts
    32
    Hi bsekerci,

    Are you able to put the output of the decoder in a TUint16 array directly?
    If so, then you don't need that expensive for loop (and iGenBuffer) because you can set the array-pointer directly in the iDescBuf var. You have to cast the TUint16 * to a TUint8 * then, but that's no problem.

    The code will the be something like:

    // creating buffer to hold 8-bit data
    TPtr8 iDescBuf;

    // Get the length of the MP3 data somehow (from decoder?)
    // iMp3toPcmStream array contains the decoded stream.
    TInt mp3Len = decoder.getbyteswritten(); // if you get samples, multiply with sizeof( TUint16 )
    iDescBuf.Set((TUint8*) iMp3toPcmStream,mp3Len ,mp3Len );

    // Write data to audio device
    iAudioDevice->WriteL( iDescBuf );

    Regards,

    Harreld.

  11. #11
    Registered User
    Join Date
    Sep 2004
    Posts
    11
    You are right.

    I changed like this and it worked.

    TInt mp3Len = iDescMp3.Length(); aDescBuf.Copy((TUint8*)iDescMp3.Ptr(), mp3Len*2);

    I don't like the sound quality, problem is in decoder or my streaming player. I am trying to find out.

    Thanks mobhaku.

    Regards.

    bsekerci

Posting Permissions

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