1

So my question is: what are the valid audio formats to use with ExtAudioFileCreateWithURL?

I am recording in a renderCallback from RemoteIO - and have it working using these specs:

AudioStreamBasicDescription :: mFormatID :: kAudioFormatLinearPCM

ExtAudioFileCreateWithURL :: AudioFileTypeID :: kAudioFileWAVEType

But the resulting files are huge, so I want to use a compressed format. I've been searching for a few hours and plugging in various format combinations but I get errors:

uncaught exception 'NSInternalInconsistencyException', 
reason: 'Couldn't create file for writing'

I've also seen conflicting info about what formats can and cannot be used to record. For a reality check, I tinkered with the SpeakHere example and got it working with kAudioFormatMPEG4AAC - but for the life of me, I can't those settings to work in my own project.

Any tips on using ExtAudioFileCreateWithURL to record compressed audio?

Community
  • 1
  • 1
spring
  • 18,009
  • 15
  • 80
  • 160

2 Answers2

0

You can use AudioFileGetGlobalInfo (etc.) to determine what the current system supports.

When recording, just record as PCM, compress the result, dispose the PCM recording, if the system does not support the destination format you need.

justin
  • 104,054
  • 14
  • 179
  • 226
0

I finally solved this - recording to AAC directly to ExtAudioFile. Details here: Recording to AAC from RemoteIO: data is getting written but file unplayable

Community
  • 1
  • 1
spring
  • 18,009
  • 15
  • 80
  • 160