• 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: MTCoreAudio, CAAudioFileWriter and conversion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MTCoreAudio, CAAudioFileWriter and conversion


  • Subject: Re: MTCoreAudio, CAAudioFileWriter and conversion
  • From: William Stewart <email@hidden>
  • Date: Tue, 11 Oct 2005 12:55:07 -0700

There are some simple examples in the latest release of the CA SDK. One of these is called ConvertFile, and this uses the ExtendedAudioFile API directly to write a file. This is, as Doug described previously, asynchronous, so safe to call from any thread.

If you are just targeting 10.4 or better, then I would use that API directly - its very simple (as you can see from that code) and clear

Bill

On 11/10/2005, at 9:34 AM, Michael Thornburgh wrote:


if you're using an MTAudioBuffer as i described earlier, then on the read side feeding your audioFileWriter, the buffer is probably blocked waiting for more data. i wouldn't be surprised then if the audioFileWriter->Stop() can't actually do anything.


if audioFileWriter->Stop() is synchronous (that is, it doesn't return until writing has completed and the file is closed), simply reversing the order of these two operations should fix that problem. that is:

    audioFileWriter->Stop();
    [[self recordingDevice] deviceStop];

if audioFileWriter->Stop() is not synchronous, then you will need to somehow otherwise synchronize the actual stopping/closing of your output file before doing -deviceStop, so there will still be audio samples filling the buffer and keeping it from blocking.

-mike


On Oct 11, 2005, at 6:17 AM, Olivier Destrebecq wrote:


In my stop recording message i do the following:

 // stop recording
  [[self recordingDevice] deviceStop];
  audioFileWriter->Stop();

I assume this is enough...
thanks
Olivier Destrebecq
http://otusweb.spymac.com/portfolio/


On Oct 11, 2005, at 2:09 AM, Jens Alfke wrote:



On 10 Oct '05, at 5:45 PM, Olivier Destrebecq wrote:


My code run, the file gets created, but then when i try to open it with Quicktime, it tells me it cannot open it. Also if i add code to try to convert to AAC before writing to disk i get an error. I include the code in this email for your review.


The code you showed us doesn't ever close the output file. Are you just killing the process after recording enough audio? As far as I can tell, an AIFF file has to be explicitly closed after writing the data, so that the writer can either add a necessary trailer or update the header. Otherwise the file isn't openable.



email@hidden wrote:


My question would be: in minimal lines of code, how would one save a sampled sound buffer (which MTCoreAudio provides) into an AIFF file.


It's really easy using CAAudioFile. You call CreateNew() on the file object, repeatedly call its Write() method passing in a buffer list, then call Close().


--Jens

_______________________________________________
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


--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __


_______________________________________________
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


References: 
 >MTCoreAudio, CAAudioFileWriter and conversion (From: Olivier Destrebecq <email@hidden>)
 >Re: MTCoreAudio, CAAudioFileWriter and conversion (From: Jens Alfke <email@hidden>)
 >Re: MTCoreAudio, CAAudioFileWriter and conversion (From: Olivier Destrebecq <email@hidden>)
 >Re: MTCoreAudio, CAAudioFileWriter and conversion (From: Michael Thornburgh <email@hidden>)

  • Prev by Date: Re: Audio Units - newbie questions
  • Next by Date: RE: Audio Units - newbie questions
  • Previous by thread: Re: MTCoreAudio, CAAudioFileWriter and conversion
  • Next by thread: OT: GetCurrentEventLoop() leaks?
  • Index(es):
    • Date
    • Thread