4

I am working on porting streaming audio player to swift. i need to conver the MP3 streaming audio in to PCM buffer before play it with AVAudioEngine. I observed that MP3 to PCM converter function(AudioConverterFillComplexBuffer) is missing in Swift.

How to write the code in swift to do the audio Conversion?

jpsasi
  • 1,905
  • 2
  • 18
  • 29

1 Answers1

0

Hmmmm. If I am not mistaken what you are looking for can be found here:

Unable to convert mp3 into PCM using AudioConverterFillComplexBuffer in AudioFileStreamOpen's AudioFileStream_PacketsProc callback

Did you see this line:

AudioConverterFillComplexBuffer(audioConverterRef, AudioConverter_Callback, &convertInfo, &framesToDecode, &localPcmBufferList, nil)

That person seems to have achieved exactly what you are trying to achieve.

Community
  • 1
  • 1
Coder1000
  • 4,071
  • 9
  • 35
  • 84