• 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: PCM "ExtAudioFileWrite" limited to Non-Interleaved? [Solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PCM "ExtAudioFileWrite" limited to Non-Interleaved? [Solved]


  • Subject: Re: PCM "ExtAudioFileWrite" limited to Non-Interleaved? [Solved]
  • From: Charles Constant <email@hidden>
  • Date: Sun, 16 Aug 2015 18:51:02 -0700

I feel a bit ridiculous, but ten minutes after posting to you all, it's working for me! I sorted it out shortly after I hit send. I reread my code carefully, and I had *lots* of things wrong.

For starters, I misunderstood how to set up the Client ASBD for non-interleaved PCM audio. What is working fine for me now is: 

bytes_per_packet:   Per *single* buffer
frames_per_packet:  Per *single* buffer
bytes_per_frame:    Per *single* buffer
channels_per_frame: Of *all* buffers
bits_per_channel:   Per *single* buffer

Another change I made in the version that is okay is that I also am no longer storing my UnsafeMutableAudioBufferListPointer (or rather its memory) as an AudioBufferList. I just pass it in as is to ExtAudioFileWrite, which takes a pointer anyways. I guess the cast was shortening its length.

The other errors are not interesting for anyone. Anyways, I'm quite happy the code is working.

Cheers!



On Sun, Aug 16, 2015 at 5:42 PM, Charles Constant <email@hidden> wrote:
Hello CoreAudio people,

My app has a bunch of PCM float vectors in memory. I want to write them to disk as a single uncompressed file (CAF, AIFF, or Wave file). The output file on disk should be interleaved. Do I absolutely have to do this interleaving on my end? 

My code to attempt this is currently failing with "fmt?" when I try to set the Client ASBD. I'm pretty sure the flags are correct though [Float, Packed, NonInterleaved], and I filled out the rest of the ASBD for the total number of vectors.

I have two theories:
a) the only PCM support for writing ExtAudioFileWrite is for you to interleave vectors as a single mBuffer?
b) it is supported, but only if you set a valid AudioChannelLayout?

Does anyone know if it's possible?

Thanks,

Charles

PS:
As an aside, here's a snippet of how to create an AudioBufferList in Swift containing more than one mBuffer. Maybe it will save the next guy the pain:

var abl_ptr = AudioBufferList.allocate( maximumBuffers: buffers.count )
defer {
free( abl_ptr.unsafeMutablePointer )
}
for i in 0 ..< buffers.count {
abl_ptr[i] = buffers[i]
}
let abl = abl_ptr.unsafePointer.memory


 _______________________________________________
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

  • Prev by Date: PCM "ExtAudioFileWrite" limited to Non-Interleaved?
  • Next by Date: Dynamically notify a DAW about a change in parameter info
  • Previous by thread: PCM "ExtAudioFileWrite" limited to Non-Interleaved?
  • Next by thread: Dynamically notify a DAW about a change in parameter info
  • Index(es):
    • Date
    • Thread