• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Convert an in-memory mp3 file to PCM
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert an in-memory mp3 file to PCM


  • Subject: Re: Convert an in-memory mp3 file to PCM
  • From: Richard <email@hidden>
  • Date: Wed, 01 Oct 2014 11:34:24 -0400

Also, Have you sen this old post?

    http://lists.apple.com/archives/coreaudio-api/2013/Jun/msg00006.html

Chris Adamson suggested that I use this technique for my problem of converted in-memory AAC files into PCM. Unfortunately I have been busy with other things these past few days, so I probably won't be able to try it out until this Friday.

Richard


On Tue, Sep 30, 2014 at 10:50 PM, Richard <email@hidden> wrote:
Hi,

Have you tried the sample code from chapter 6 of the Core Audio book? I didn't
get far with it myself but that was because my AAC file was coming off the 
network and I didn't want to save it to disk, which your code fragment looks like 
it is reading from a disk file, which is the case that the Core Audio book addressed.

Richard


On Tue, Sep 30, 2014 at 4:50 AM, claudio santoro <email@hidden> wrote:
Hi all,


I have a c++ mediaplayer that playes mp3 files and in its callback function I'd like to get the pcm flow of the buffer that is being playing.

This is my playback callback:

static void HandleOutputBuffer (
    void                *aqData,
    AudioQueueRef       inAQ,
    AudioQueueBufferRef inBuffer
)
{
    OSStatus status;

    AQPlayerState *pAqData = (AQPlayerState *) aqData;       
    if (pAqData->mIsRunning == 0) return;                    
    UInt32 numBytesReadFromFile;                             
    UInt32 numPackets = pAqData->mNumPacketsToRead;          
    status = AudioFileReadPackets (
                 pAqData->mAudioFile,
                 false,
                 &numBytesReadFromFile,
                 pAqData->mPacketDescs,
                 pAqData->mCurrentPacket,
                 &numPackets,
                 inBuffer->mAudioData
             );
//    checkStatus(status);
    if (numPackets > 0) {                                     
        inBuffer->mAudioDataByteSize = numBytesReadFromFile;  
        status = AudioQueueEnqueueBuffer (
                     pAqData->mQueue,
                     inBuffer,
                     (pAqData->mPacketDescs ? numPackets : 0),
                     pAqData->mPacketDescs
                 );
//        checkStatus(status);
        pAqData->mCurrentPacket += numPackets;               


// Here: how to retreve the PCM from the buffer???

}



Can you tell me how to get the PCM of the buffer? I'd need it because I need to make a merge/mix with the line in microphone.

Thanx in advance.

Dodo

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Convert an in-memory mp3 file to PCM
      • From: Dodo <email@hidden>
  • Prev by Date: Process Buffer size in Logic Pro X
  • Next by Date: Re: Convert an in-memory mp3 file to PCM
  • Previous by thread: Process Buffer size in Logic Pro X
  • Next by thread: Re: Convert an in-memory mp3 file to PCM
  • Index(es):
    • Date
    • Thread