• 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: Truncating an audio file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Truncating an audio file


  • Subject: Re: Truncating an audio file
  • From: Kevin Dixon <email@hidden>
  • Date: Wed, 31 Jul 2013 22:17:03 -0700

AIFF and WAV should also work perfectly, as they are flat files (header, header, PCM), though you will have to close/truncate the file, the open and update the header to have correct info about duration, etc.
I think you will find you need to update the header of MP3 as well, though "missing data", if it falls after a frame boundary, will probably just generate a warning in a decoder--then again, 60 seconds of silence should compress pretty well-- you'll have to update the header regardless if you want the length info to be right.

-Kevin


On Wed, Jul 31, 2013 at 10:06 PM, Jens Alfke <email@hidden> wrote:

On Jul 31, 2013, at 12:34 PM, patrick machielse <email@hidden> wrote:

In an application, I'm recording audio to file using the ExtAudioFile API. After recording is finished, there may be the need to chop off up to 60 seconds of audio from the end of the file (which will be silence).

ExtAudioFile doesn't seem to have functions that would support this type of operation.

It’s been a long time since I looked at the API; if it has a way to get the byte offset corresponding to a particular timestamp, you can then just pass that offset to the truncate() system call.

Whether this will actually work correctly depends on the file format, though. It should work with MPEG-type formats like MP3 and AAC because the decoder just looks for frames in the file and doesn’t expect anything else around them. It might not work for AIFF though. Experiment :)

—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

 _______________________________________________
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: 
 >Truncating an audio file (From: patrick machielse <email@hidden>)
 >Re: Truncating an audio file (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Truncating an audio file
  • Next by Date: Re: Forcing AppleUSBAudio to add PassThru mute and volume controls
  • Previous by thread: Re: Truncating an audio file
  • Next by thread: Re: Forcing AppleUSBAudio to add PassThru mute and volume controls
  • Index(es):
    • Date
    • Thread